Possible bug in arduino_read
function of "MKRWANFWUpdate_standalone" example sketch
#134
Labels
topic: documentation
Related to documentation for the project
type: imperfection
Perceived defect in any part of project
The
arduino_read
function uses theavailable()
routine but it could happen that the STM32 did not return a reply yet.This problem is what happened when using it on a ESP32-S3 connected to a STM32F4.
When looking at
https://github.com/facchinm/stm32flash/blob/1d155f293cac0f825c73c39b4d5344113bb67052/serial_posix.c#L270C1-L292C2
This code does two things: it reads as many bytes as available directly into a buffer and checks if the total amount read is the same as the expected amount and if not continues to do so. It will also return the timeout error value if the amount read is 0.
I would therefore suggest to replace
available()
withreadBytes()
or more precise use the above quotedwhile
loop and usereadBytes()
.The text was updated successfully, but these errors were encountered: