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. Every 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 just 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?

| improve this question | | | | |
  • \$\begingroup\$ Is the gpio clocked? Do all values read back as expected? Run your reinit routine in a loop until some indication of physical success and then log the number of tries. \$\endgroup\$ – Chris Stratton Aug 21 '19 at 16:14
  • \$\begingroup\$ All above was already done. All readbacks as expected. Clock on. I have checked all the obvious stuff. I can write, read back but the written values are ignored by the actual hardware. All other ports are configured the same way - and they work OK. \$\endgroup\$ – P__J__ Aug 21 '19 at 16:19
  • \$\begingroup\$ Can you monitor the supply voltages during wakeup? If there are glitches, then this errata may apply: 2.3.3 Some I/Os must not be used as output when VDDA > VDD + 0.6 Vor VDDUSB > VDD + 0.6 V or VLCD > VDD + 0.6 V \$\endgroup\$ – berendi - protesting Aug 21 '19 at 16:58
  • \$\begingroup\$ @berendi power supply is OK. This board is actually the power controller for the rest of the system and its own power supply comes from the separate high quality source. \$\endgroup\$ – P__J__ Aug 21 '19 at 17:04

I have found the workaround. If I dispable the GPIOA clock just before entering the sleep mode and on exit reenable it everything works fine. Do not know what is causing the problem but the workaround I have found is good enough for me.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.