2023-05-03 06:52 AM
I'm working with the STM32F446-microcontroller and once in a while after power-up the microcontroller is unable to drive pin PA0 high or low and I also suspect that it can't drive PA8, configured as an I2C-clock, either when this problem occurs. There is no issue with input sensing on PA0, i.e. reading GPIOx->IDR always returns the correct result. Also, I'm able to communicate with a custom-made PC-application via CAN-bus and I can upgrade firmware on the microcontroller using a custom-made bootloader, but it won't get PA0 out of the non-controllable state. A software reset doesn't help either, the only solution is to disconnect power for about 5-6 seconds and then things work fine again. Can anybody think of anything I can do to solve this? Are there any registers I can play with to try get PA0 controllable again?
Solved! Go to Solution.
2023-05-03 09:00 AM
What hardware? What is connected to PA0?
Read out and check/post content of GPIO registers - compare between working and non-working states.
[EDIT] PA0 is RTC_AF2, and RTC (probably) overrides GPIO settings, so in case of problems check also RTC registers content. Could this be a case of VBAT brownout issue? Tell us about how VBAT is connected and how exactly is the board powered, and also how the option bytes are set.
JW
2023-05-03 09:00 AM
What hardware? What is connected to PA0?
Read out and check/post content of GPIO registers - compare between working and non-working states.
[EDIT] PA0 is RTC_AF2, and RTC (probably) overrides GPIO settings, so in case of problems check also RTC registers content. Could this be a case of VBAT brownout issue? Tell us about how VBAT is connected and how exactly is the board powered, and also how the option bytes are set.
JW
2023-05-04 05:57 AM
I'm using the STM32F446RET6 microcontroller on our own PCB. All the GPIOA-related registers contained correct values, but a bunch of RTC registers (ALRMAR, TR, DR, CR, ISR,PRER, etc) contained seemingly random values. The option bytes were all ok. The power-up sequence is not so pretty. I added:
RCC->BDCR |= 0x00010000;
PWR->CR |= 0x00000100;
first thing in main() and then the problem disappeared. I now plan to add those two lines in ALL our products. Thanks a lot for your help and for your excellent blog webpage!
2023-05-04 06:04 AM
Thanks for letting us know.
Do you have VBAT connected to VDD on your PCB?
JW
2023-05-04 06:09 AM
Yes, VBAT is routed to 3.3V, just like all the VDD pins.
2023-05-04 07:15 AM
Thanks.
JW