I have started to use stm32flash and it works great execpt for one functoin: stm32_get_ack_timeout
The issue that I am having is that the current system fails about 70% of the time calling this function. If I add a 10ms delay, it fails 10% of the time. If I add a 100ms delay it works every time.
Is there a command line arguement that I can pass in (or add a command line argument) to increase this timeout? I assume you would not want to add a hardcoded delay into this function.
I am running this code on a embedded linux board that is updating a STM32L073 co-proccessor. I use this command to do the firmware update:
stm32flash -b 115200 -i '506&-505,505,:-506&-505,505' -w stm32L073.bin -R /dev/ttymxc4
Anonymous
Indeed, as little as possible. But we have some hardcoded values depending on the operation. Which operation does this concern?
Hello Tormod,
This is within the stm32_get_ack function that is called a bunch of times while writing the chunks of the binary file to the STM32 MCU.
You mean when it is called with timeout = STM32_BLKWRITE_TIMEOUT ?
STM32_BLKWRITE_TIMEOUT is 1 (second). It is an integer. Can you try using 2 seconds?
Last edit: Tormod Volden 2022-04-14
So I wanted to double-check this. Running with the deubgger, the issue seems to be this function call list:
main -> stm32_init -> stm32_guess_len_cmd -> stm32_send_command->stm32_send_command_timeout
The output from the program is:
Using Parser : Raw BINARY
Size : 35588
Interface serial_posix: 115200 8E1
Failed to read ACK byte
Unexpected reply from device on command 0x00
It seems that the ACK read is failing here. I changed the function to add a 1 second delay here:
And the issue still persists.