Skip to content
Discussion options

You must be logged in to vote

The Pyboard UART uses interrupts and is buffered. The key is probably to set a sufficiently large receive buffer size (.rxbuf) so that bytes are not lost while the SD card is being updated. The advice to handle data one character at a time is really targeted at text data where the data must be parsed. With binary data there is no real merit. If you have a 1024 byte buffer, at 115200 baud, it will take 88ms to fill. Assuming that the SD card write blocks for less than this, it will work.

I would start out with a 1024 byte .rxbuf buffer, reading 128 bytes at a time into a pre-allocated 128 byte bytearray (uart.readinto). If bytes are lost, increase the size of the .rxbuf.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@skysurf76
Comment options

Answer selected by peterhinch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants