cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G071RBT6 bootloader crash after performing Read Protect from bootloader

medin98
Associate

Hi everyone,

I am currently working on a customer product trying to design an OTA update around 3 MCUs in star configuration. I have just started to test the commands which would be needed to accomplish this with the ST factory bootloader residing in system memory. Most of the commands seem to work fine, apart from documentation discrepancies eg.: this line of product is not mentioned to perform a system reset in the documentation (rm0444, an2606, an3155) upon modifying the option bytes when using the below commands:

  1. write protect
  2. write unprotect
  3. read unprotect
  4. read protect

Apart from this I managed to test all of them and 1-3 are performing as expected doing a system reset upon executed. However when I try to perform the 4. I get a bootloader crash (I believe) (which is confirmed if I try and read the register values after the crash: ICSR->ACTIVEVECT=0x3).

I tested this in depth and have the following findings:

First scenario:

  1. the flash is blank (or erased)
  2. I program it with CubeIDE, the "empty" bit in flash status remains set because no Power-On Reset (POR) or Option Byte Loader (OBL) launch resets it (expected)
  3. After programming, I perform a POR, and then enter the bootloader from user code.
  4. I send 0x7f as sync byte, receive 79 (OK)
  5. I set RDP (command 0x82 + 7D), and receive an OK response (0x79 0x79)
  6. Now the mcu should do a reload of the option bytes or system reset (not sure which one) and I should end up running code from user flash.
  7. But I can't, even trying to reset the MCU through NRST does nothing, and I cannot even communicate with the bootloader which should be possible if there were no resets performed.
  8. Inspecting ICSR->VECTACTIVE indicates 0x3.

Second scenario:

Doing a Read Protect from bootloader on an empty flash does seem to work and as expected after the reset I end up back in the bootloader and I am able to communicate with it.

I attach my code for entering the bootloader from user code and also a register value summary from stm32cubeprogrammer.

 

Thanks in advance for your help!

0 REPLIES 0