STM32F031K6 Bootloader Write Memory Command Failure (No ACK or NACK)
Hi,
I'm trying to utilise the built-in UART bootloader in the STM32F031K6 to perform firmware update. I've read the AN3155 and AN2606 documentation but unfortunately, I'm out of luck so far when trying to write the firmware via the bootloader to the target MCU's internal flash.
What I've got working so far:
- I can communicate successfully over the UART interface to the bootloader
- The GET command response indicates the bootloader protocol version is 3.1 and the following commands are supported:
- 0x01 (Get Version & Read Protection Status)
- 0x02 (Get ID)
- 0x31 (Write Memory)
- 0x73 (Write Unprotect)
- 0x92 (Readout Unprotect)
- The GET ID command response indicates the PID is 0x401
The following is not working for me:
- I send the "write memory" command and checksum, e.g. 0x31, 0xCE
- I receive the ACK, e.g. 0x79
- I send the 4 byte start address and checksum, e.g. 0x08, 0x00, 0x00, 0x00, 0x08
- I expected to receive either an ACK or a NACK but no response from the bootloader
Some observations:
- Immediately following the above set of steps, I send the "Get ID" command + checksum. It fails and I receive two NACKs (i.e. 0x1F)
- In the AN3155 document, it mentions the following:
"When a Read Memory command or Write Memory command is issued with an unsupported memory address and a correct address checksum (i.e. address 0x6000 0000), the command is aborted by the bootloader device, but the NACK (0x1F) is not sent to the host. As a result, the next two bytes (that is, the number of bytes to be read/written and its checksum) are considered as a new command and its checksum"
My questions:
- The start address and checksum I'm using, is it invalid (but it looks okay to me)?
- The list of supported commands seems weird, why is the GET command (i.e. 0x00) missing?
- The device PID is also odd, I cannot find it in the AN2606 document. In fact, according to chapter "64 Device-dependent bootloader parameters", page 326, the PID for STM32F03xx4/6 should be 0x444
Maybe I'm missing something obvious? All help and suggestions will be gratefully received.
Thanks to all in advance.
