2023-05-09 09:19 AM
Hi,
I have acquired a new STM32G031 microcontroller that has not been previously flashed and have observed an unexpected behavior when powering up my circuit prior to the initial software upload.
Upon further investigation, I discovered that multiple registers were not at their reset values, but instead at different values that were not anticipated. Specifically, the registers of GPIOA (such as MODER) had critical (in my application) pins set to pull-up (e.g., MODER set to 0xEBEB FFAF).
As such, I would like to know:
Is the initial state of the registers documented anywhere? I was unable to find such information in the reference manual (RM0444.pdf).
When in production with the final PCB already assembled, what is the safest approach to ensure the registers are at their reset values even when flashing fails (e.g erasing the device prior to flashing)?
I appreciate your assistance with this matter.
Note: While I understand that the safest solution would be to ensure that the external circuit can accommodate any pin state, this is not a viable option at present.
Best regards,
Martin
Solved! Go to Solution.
2023-05-09 11:14 AM
> Upon further investigation, I discovered
How, exactly?
You are most likely running the bootloader. 'G0 is AN2606 Pattern 11, i.e. bootloader runs when FLASH is "empty".
> what is the safest approach to ensure the registers are at their reset values even when flashing fails
Maybe holding the mcu in reset since before first powerup until completely programmed (including option bytes).
JW
2023-05-09 11:14 AM
> Upon further investigation, I discovered
How, exactly?
You are most likely running the bootloader. 'G0 is AN2606 Pattern 11, i.e. bootloader runs when FLASH is "empty".
> what is the safest approach to ensure the registers are at their reset values even when flashing fails
Maybe holding the mcu in reset since before first powerup until completely programmed (including option bytes).
JW
2023-05-10 01:08 AM
Thank you for the fast and helpful suggestion.
I must admit that I was on the wrong track and totally forgot about the bootloader. As you suggested, AN2606 was indeed the correct hint, as it explains the behavior I'm experiencing.
I will test updating the programming setup to hold the MCU in reset until it is fully programmed.
Thank you again for your valuable input.
Best regards,
Martin