Binary over USB/serial #11889
-
On ESP32S3 (not sure if the port matters), I'm transfering binary over USB to my application. I'm having two issues which I think should have simple configuration issues which I can't seem to find. My goal is to update firmware, ota partition update, without going into bootloader. I already have this working over wifi, but want USB update option as well. Should be staight forward, right? I'm sending binary data over USB and reading in the bytes via streamreader. Something like:
I have As a test, transferring 256 bytes (eg.
I'm hoping someone has run into this as it's driving me a bit nuts! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
For anyone else that expects to read the same bytes that were sent over stdio: Here's the culprit for item 1. In shared/runtime/sys_stdio_mphal.c, read method. Commenting out the \r to \n conversion will fix it.
|
Beta Was this translation helpful? Give feedback.
-
Part two answer, the stdin buffer size on esp32 is set here: Increasing the size works as expected. Should this be a #define option? |
Beta Was this translation helpful? Give feedback.
First, thank you for the response. First yes, it works. Now that I've found
shared/runtime/sys_stdio_mphal.c
I can see it.I'm using asyncio, this seems to do the trick:
asyncio.StreamReader(sys.stdin.buffer)
From there on out, my readinto's are working as expected.
Still feels quite quirky as I would expect readintos to straight up copy byte for byte, but this will do.