Skip to main content
FLewz.1
Associate III
Jun 24, 2022 7:24 PM UTC
Question

Unable to communicate with SPI bootloader

Hi,

​

I am trying to use the ROM bootloader on the STM32G071 to change the contents of specific flash sections. I was able to enter the bootloader just fine, at least I think so because I can see in the debugger how different points in the address space above 1fff0000 are accessed.

I am using this library on another STM32 as a master:

​https://github.com/glegrain/STM32-SPI-Bootloader-host

​

​Since it's written by an STM employee and the commands are exactly like in AN2606 I am confident this is correct. However I can't even get past the first synchronization sequence. The bootloader only responds with seemingly random data.

​

The baud rate is below 8MHz ​as necessary. Is there some additional timing I have to adhere to, or anything else that I am missing?

This topic has been closed for replies.

3 replies

MM..1
Super User
Jun 25, 2022 7:58 AM UTC

Check your connect config to G071 is

0693W00000NsjxSQAR.pngor SPI2 on next page.

gfxfloro
Associate III
Jun 27, 2022 6:38 AM UTC

The master spi config is correct so far. I used the CubeMX configuration for SPI on master side with CPOL Low, CPHA Edge 1, MSB first 8bit. Using the master code from the linked repo I am calling BL_Init a moment after I am sure the slave uC has entered the BL. Is there specific timing to adhere to? I am not using any other periphery to connect to the BL. I can see that the bootloader sends a dummy while the master sends the sync byte. However after that the master loops in wait_for_ack() because the bootloader just sends garbage data while the master sends dummies

snigg
Associate III
Mar 7, 2025 5:36 PM UTC

Was the issue ever solved? Is it a timing issue of any kind or what led to success?