cancel
Showing results for 
Search instead for 
Did you mean: 

Once in a while STM32F446 is unable to drive pin PA0 high or low

arnold_w
Senior

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

5 REPLIES 5

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

arnold_w
Senior

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!

Thanks for letting us know.

Do you have VBAT connected to VDD on your PCB?

JW

arnold_w
Senior

Yes, VBAT is routed to 3.3V, just like all the VDD pins.

Thanks.

JW