cancel
Showing results for 
Search instead for 
Did you mean: 

prevent peripherals being automatically reset during STM32 user BL upgrade code process?

Tokit
Associate II

During the user-defined BL upgrade process of the STM32, is it possible to keep an IO pin, which has already been pulled high in the user code, at a high level throughout the entire sequence of steps: 'jumping from the user code to the BL, erasing and writing the flash, and then jumping back to the user code after the upgrade is complete'? This IO pin is not used during the upgrade process. The essential requirement is to avoid resetting the peripheral states during the BL upgrade process.I noticed that my IO pin was automatically reset after jumping from the user code to the user-defined BL code.

1 ACCEPTED SOLUTION

Accepted Solutions

Your understanding is correct. Pin configuration is only changed when something changes them. Probably the BL is configuring all pins on a port instead of just the pins it cares about.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

3 REPLIES 3
TDK
Guru

The bootloader is in ROM and its behavior cannot be changed. If it resets a pin, no way around that.

If you wanted to do some reverse engineering, you could probably figure out where the specific bootloader you're using is located and jump there instead of the general bootloader address. Probably this would preserve pin states.

More info on the bootloader you're using, the peripheral/pin you're using keeping high would be helpful.

If you feel a post has answered your question, please click "Accept as Solution".
Tokit
Associate II
Sorry for the ambiguity in my earlier explanation. The 'BL' I mentioned refers to user code — a bootloader program flashed into the user Flash area of the MCU, not the factory low-level BL selected via the BOOT0 pin. My understanding is: if my BL contains no GPIO operations, the pins should not be reset. However, during actual debugging, I observed that pins pulled high in the user code were reset to a high-impedance state immediately upon entering the BL. Is this a misunderstanding on my part, or is there a bug in the code?

Your understanding is correct. Pin configuration is only changed when something changes them. Probably the BL is configuring all pins on a port instead of just the pins it cares about.

If you feel a post has answered your question, please click "Accept as Solution".