cancel
Showing results for 
Search instead for 
Did you mean: 

Wake from standby not working. STM32H743IIT6

FColl.1
Associate III

I have a custom board with an led on PD7 and Normally High push button on PI11. There is also a pushbutton set up on NRST. Device is a  STM32H743IIT6

I can get the processor to go into standby okay. This is confirmed by the __HAL_PWR_GET_FLAG(PWR_FLAG_SB) == SET being false if I repower the circuit but true if I push the NRST button. So far so good.

I can not get the processor to wake on the PI11 PWR_WAKEUP_PIN4.

HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN4);
 
   /* Clear all related wakeup flags */
   HAL_PWREx_ClearWakeupFlag(PWR_WAKEUP_PIN4);
 
   PWREx_WakeupPinTypeDef sPinParams;
 
   sPinParams.WakeUpPin    = PWR_WAKEUP_PIN4;
   sPinParams.PinPolarity  = PWR_PIN_POLARITY_LOW;
   sPinParams.PinPull      = PWR_PIN_NO_PULL;
   
   HAL_PWREx_EnableWakeUpPin(&sPinParams);
 
   /* Enter the Standby mode */
   HAL_PWR_EnterSTANDBYMode();

I've tried rising edge too but no luck. Is there some other piece of configuration I'm missing, like enabling a clock or power domain or something?

I've attached a zip of my entire cube IDE project.

3 REPLIES 3
FColl.1
Associate III

I just tried adding code to wake on RTC timer wakeup function. This works. But wake on wakeup4 still does not.

FColl.1
Associate III

OMG! I found it. ST HAL Library engineers please take note. This is horrible. The wakeup pins in the datasheet and in the CubeMX configuration are 0 to 5.

0693W00000GYVIDQA5.pngHowever in the HAL PWR library.... surprise! they are 1 to 6.

/* High level and No pull (default configuration) */
#define PWR_WAKEUP_PIN6      PWR_WKUPEPR_WKUPEN6
#if defined (PWR_WKUPEPR_WKUPEN5)
#define PWR_WAKEUP_PIN5      PWR_WKUPEPR_WKUPEN5
#endif /* defined (PWR_WKUPEPR_WKUPEN5) */
#define PWR_WAKEUP_PIN4      PWR_WKUPEPR_WKUPEN4
#if defined (PWR_WKUPEPR_WKUPEN3)
#define PWR_WAKEUP_PIN3      PWR_WKUPEPR_WKUPEN3
#endif /* defined (PWR_WKUPEPR_WKUPEN3) */
#define PWR_WAKEUP_PIN2      PWR_WKUPEPR_WKUPEN2
#define PWR_WAKEUP_PIN1      PWR_WKUPEPR_WKUPEN1

There is a mapping wakeup 0 is HAL wakeup 1 etc. Where is this mapping documented? Why even do this mapping? Who comes up with this stuff???? Thanks, You just cost me 1.5 days of wasted effort.

Thanks for sharing, I understand your frustration. I encounter such numbering offset from time to time in various projects, so did not even noted it when used wakeup pin functionality on H7. But it certainly will be helpful for those who stuck with similar problem in the future. I thought about creating small tutorial on each peripheral, specifically highlighting all common gotchas, so I bookmarked your topic for further reference. In my opinion, such flaws must be prevented by real-time automated code review systems, because people do mistakes. Unfortunately this numbering is already implemented, and changing it will require to implement additional set of constants to keep old user code compatible with the new libraries. There are some flaws in HAL drivers source code, but a lot of effort is put into it. Before STM32CubeIDE was released, I've used other IDE with code size limitation. Now, will all that free tools, I can't ask for more.