I want to upload a firmware to an STM32 from another STM32 using UART. I implemented in my application the UART bootloader protocol described here:
https://www.st.com/resource/en/application_note/cd00264342-usart-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdfThe communication between the two devices works, I start the "slave" STM32 in system bootloader mode, I send write memory commands with the "master" STM32 with the data and it returns ACK which means it worked.
Then I restart the slave STM32 in normal mode, but it doesn't do anything, even a gpio toggle program doesn't work.
I'm not sure about the following things..
- The compiled code of the program to upload (.bin compiled with STM32CubeIDE) should be written directly to 0x8000000 memory address, right ? (flash base address) I'm confused because some people seems to write the code after this address, then put some custom bootloader code at 0x8000000 to jump to it but it's not mandatory, isn't it ?
- I haven't managed to make the Read Memory command to work for the UART bootloader protocol, so I can't check the written data. I followed exactly the document but I get only a 1 byte response that doesn't make sense, I even compared my code to this one (
https://github.com/ARMinARM/stm32flash/blob/master/stm32.c) to make sure I was sending the right commands.
I feel a bit stuck, I already did many things to remove them from the possible causes: using a different power supply, replacing the STM32 chip, checking all decoupling caps, using the internal oscillator to remove potential external crystal issues...