At my company we have an STM32F407 MCU and we are trying to use the in-built boot-loader. I have read
- AN2606 - STM32 microcontroller system memory boot mode and
- AN3154 - CAN protocol used in the STM32 bootloader
The boot loader version that is reported by the Get command is 2.0 (byte 0x20?).
I am trying to find a reliable but fast way to readout and program images to the in built FLASH.
I thought that synchronising with the ACK from the device (0x79) each time this is required by the protocol would have been enough, but it seems that if commands are sent "too quickly" (even after having waited for the ACK) will cause the bootloader to get into an inconsistent state (I have currently it continuously sending the NACK byte, 0x1F even though nothing is sending to it). This happened if, for example, a read command (0x11) is sent straight after having read the ACK (0x79) from the last group of 8 bytes from the previous read command. I have seen that inserting a 1sec delay before "starting" the next read makes the process more reliable, but I do not want to hunt for the "right" delay.
Question 1: is there a requirement for the delay between commands (a part from waiting for the ACK)?
Question 2: is there a way to "reset" the program, a part from unplugging / plugging back the power cable?