Skip to main content
pj_stm
Associate III
August 21, 2019
Solved

Strange STM32L476RG GPIO behaviour when leaving STOP mode 2. Is it a silicone bug?

  • August 21, 2019
  • 2 replies
  • 676 views

Before I enter the stop mode 2 I save all the GPIO MODER, OSPEEDR and PUDPR registers, configure pins as analogue (to save some power) and enter the STOP mode 2. When I exit the stop mode (I use RTC wakeup and GPIOs for that) I restore the above registers. Vvery second exit the GPIOA is disconnected from the physical pins. I can read and write the GPIOA registers (I was testing it using debug interface and the UART trace as well) but there is no effect when I write the ODR register. ODR sets correctly, but there is no action on the appropriate pins. It happens every second exit from the STOP mode. So the first exit all works fine, when I enter and exit the stop mode for the second time it does not, the third time all is fine and so on.

Other ports work fine

I have tried almost everything. Resetting, disabling and enabling the port. Adding the barriers delays and other magic, but unfortunately nothing works.

Do you have any clues?

This topic has been closed for replies.
Best answer by pj_stm

I have found the workaround. If is switch the clock off before going to sleep and when exit enable the clock again all works fine.

2 replies

waclawek.jan
Super User
August 21, 2019

Could you post a *minimal*, but complete compilable code exhibiting the problem? Do you have a L476 DISCO to try it there?

JW

pj_stm
pj_stmAuthorBest answer
Associate III
August 21, 2019

I have found the workaround. If is switch the clock off before going to sleep and when exit enable the clock again all works fine.