Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comms via UART between RP2040 and ESP #31

Open
alexphobby opened this issue Dec 16, 2022 · 2 comments
Open

Comms via UART between RP2040 and ESP #31

alexphobby opened this issue Dec 16, 2022 · 2 comments

Comments

@alexphobby
Copy link

Hello
T-PicoC3 Tutorial for comms between internal RP2040 and ESP

RP2040(sender):

from machine import UART, Pin
import time
time.sleep(3)
uart = UART(1, baudrate=115200 , tx=Pin(8), rx=Pin(9), cts=Pin(10), rts=Pin(11))
uart.write('ATE0\r\n')
led = machine.Pin(25,Pin.OUT) #on board LED

while True:
try:
led.toggle()
uart.write('TEST\r\n')
print("uart OK")
except:
print("err")
time.sleep(1)

ESP32(receier):

from machine import UART
uart = UART(1, baudrate=115000 , tx=7, rx=6, cts=5, rts=4)
uart.init(115000, bits=8, parity=None, stop=1)
uart.any() # >0 means data received
uart.read() #data being received

So, one use case scenario is to use ESP32 to send and receive messages from a MQ (HiveMQ tested by me).

Have fun with this nice board!

@maxun
Copy link

maxun commented May 15, 2023

Thank you Alex,

With your example, I was able to do something similar between RP2040 and ESP with arduino IDE.

If it can help someone else:

RP2040:
void setup()
{
Serial2.setTX(8);
Serial2.setRX(9);
Serial2.begin(115200);
}

ESP32:
void setup() {
Serial0.begin(115200);
Serial0.setPins(6, 7, 5, 4);
}

@Arquedy
Copy link

Arquedy commented Jun 1, 2023

you two helped me a lot, i really appreciate it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants