Replies: 4 comments 11 replies
-
The rp2040 (i.e. Pico) has some constraints on which pins can be used for a given peripheral (e.g. UART). The rules for the rp2040 are: #define IS_VALID_PERIPH(uart, pin) (((((pin) + 4) & 8) >> 3) == (uart))
#define IS_VALID_TX(uart, pin) (((pin) & 3) == 0 && IS_VALID_PERIPH(uart, pin))
#define IS_VALID_RX(uart, pin) (((pin) & 3) == 1 && IS_VALID_PERIPH(uart, pin))
#define IS_VALID_CTS(uart, pin) (((pin) & 3) == 2 && IS_VALID_PERIPH(uart, pin))
#define IS_VALID_RTS(uart, pin) (((pin) & 3) == 3 && IS_VALID_PERIPH(uart, pin)) This translates to:
So in your case, you'll need to use Also please use triple-backticks for formatting code (I've updated your post). Single backticks are used for |
Beta Was this translation helpful? Give feedback.
-
About this sequence: print(uart.write(bytes(data)))
print(uart.read()) The python code returns immediately after the uart.write() statemen and before all data has been written. So the uart.read() statement returns what has been received up to the, which is None. You have to wait after uart.write() until all data has been sent and the answer arrived. Doing that, you can insert a time.sleep_ms(), or add a timeout when creating the UART object, or use uart.any() to poll for incoming data. |
Beta Was this translation helpful? Give feedback.
-
the hardware works with all loopback tests, the code in python works try:
except Exception as e:
if ser.isOpen(): the code in micropython doesnt work and return b'00' ` |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions