cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L011K4T6 Wake Up Pin Configuration

LMill.2
Associate

I've struggled with this for a few days and read a dozen forum posts that end unanswered.

I am trying to put my micro controller into standby mode and then wake it up with an IMU pulling the PA0/SYS_WKUP1 pin high. What I am finding, which is somewhat corroborated by the reference manual, is that PA0 is pulling low harder than my IMU can pull high.

The IMU is a BMX160 that is programmable and doesnt require continuous communication with the MCU, it is designed to provide wakeup interrupts for smart watches and wearables.

What I have seen is that I am able to pull the WKUP pin High while the device is in normal mode, but not when it is in standby mode. I have triggered an interrupt just before going into standby and watched the pin state go low prematurely. I have made the wkup pin go high while in sleep mode, but gave up on sleep mode after realizing that wakeup and sleep aren't related.

I'm wondering if i am either configuring my standby wrong or the wakeup wrong, I am using Cube_IDE and I see nothing configurable about the SYS_WKUP pin other than the name.

Heres my standby function:

void enterStandby(void){

   //HAL_PWR_DisableWakeUpPin(WKUP_Pin);

   __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

   __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);

   __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);

   HAL_PWR_EnableWakeUpPin(WKUP_Pin);

   HAL_PWR_EnterSTANDBYMode();

}

Appreciate the help,

Luke

1 ACCEPTED SOLUTION

Accepted Solutions
LMill.2
Associate

So the problem was that I was using the name that I had given the wakeup pin as opposed to the assigned name that I was supposed to use: PWR_WAKEUP_PIN1.

void enterStandby(void){

   __HAL_RCC_CLEAR_RESET_FLAGS();

   __HAL_RCC_PWR_CLK_ENABLE();

   HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);

   __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

   __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);

   __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);

   HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);

   HAL_PWR_EnterSTANDBYMode();

}

If you check the enable/disable wake up pin functions it should say what the right pin name to use is.

View solution in original post

1 REPLY 1
LMill.2
Associate

So the problem was that I was using the name that I had given the wakeup pin as opposed to the assigned name that I was supposed to use: PWR_WAKEUP_PIN1.

void enterStandby(void){

   __HAL_RCC_CLEAR_RESET_FLAGS();

   __HAL_RCC_PWR_CLK_ENABLE();

   HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);

   __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);

   __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&hrtc, RTC_FLAG_WUTF);

   __HAL_PWR_CLEAR_FLAG(PWR_FLAG_SB);

   HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN1);

   HAL_PWR_EnterSTANDBYMode();

}

If you check the enable/disable wake up pin functions it should say what the right pin name to use is.