cancel
Showing results for 
Search instead for 
Did you mean: 

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

pj_stm
Associate III

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?

1 ACCEPTED SOLUTION

Accepted Solutions
pj_stm
Associate III

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.

View solution in original post

2 REPLIES 2

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
Associate III

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.