Closed Flashton91 closed 1 year ago
The baud rate is very low and is also non-standard. Did you try, say 1200, and 9600?
If you set the timeout to 0, then .readinto()
will only read as many characters as are available. It will not wait for the whole array to fill. It returns how many bytes it actually read. Add print statemtns to see what .in_waiting
and .readinto()
return.
Are the two boards connected to have a common ground?
Thank you, you are right - apparently the problem was timeout=0.
With this configuration, everything is transferred correctly:
uart = busio.UART(board.GP4, board.GP5, baudrate=9600, timeout=5)
I receive messages in the correct order and without distortion:
array([[1, 0, 0],
[0, 0, 0],
[0, 0, 0]], dtype=uint8)
array([[2, 0, 0],
[0, 0, 0],
[0, 0, 0]], dtype=uint8)
Glad you got it working!
CircuitPython version
Code/REPL
Behavior
Hello. I use latest version (8.2) I have connected two Raspberry Pi Pico and am trying to transfer ndarray (ulab.numpy) between them using UART.
I noticed several problems:
The microcontroller - receiver reads messages not in the order in which they are sent by the microcontroller - sender. For example, "array 3" comes, then "array 1", and "then 2". I may be talking nonsense, but it would be cool to add an option to control the reading order so messages can be read in the order they were sent.
Many arrays containing only zeros arrive. This is weird because when I sending bytearrays rather than ndarray, I don't see any corruption. I can't figure out where these null ndarrays come from that I'm not sending. For some reason _uart.inwaiting: misses such messages.
Description
No response
Additional information
No response