cancel
Showing results for 
Search instead for 
Did you mean: 

WKUP pin - which edge (rising/falling) and can it still be monitored when MCU is running ?

freeflyer
Senior

Follow-on from STM32L433RCT6 - Which external interrupt GPIO pin can I used for wakeup ?


I am using the STM32L433RCT6 with a WKUP pin (GPIO PC13) to wake the MCU from shutdown mode.

Does it matter which edge I used (rising or falling) ?

I am currently using a switch to ground (i.e. falling edge)...

freeflyer_0-1752134951858.png

freeflyer_1-1752135031976.png

 

Also, once the MCU is awake and running, am I still able to read this pin as a digital input ?

Because the switch will also be used to put the MCU back into standby, so I need to be able to monitor the state of the WJUP pin.

1 ACCEPTED SOLUTION

Accepted Solutions
freeflyer
Senior

Fixed by TDKs suggestion in this post...

"Probably should put the delay before you clear the flag. If not debounced, the flag is certainly getting set immediately after you clear it and/or when button is released."

https://community.st.com/t5/stm32-mcus-boards-and-hardware/nucleo-l433rc-p-wake-up-from-shutdown-wakes-even-though-the/m-p/822722

View solution in original post

8 REPLIES 8
Andrew Neil
Super User

@freeflyer wrote:

Does it matter which edge I used (rising or falling) ?


See the Datasheet; eg,

AndrewNeil_1-1752140790148.png

 


@freeflyer wrote:

once the MCU is awake and running, am I still able to read this pin as a digital input ?


Yes.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
freeflyer
Senior

Thanks Andrew, I did see that the edge is configurable.

I was just wondering if there is an advantage to using one edge compared to another, such as power consumption etc

freeflyer
Senior

How do I read the WKUP pin (GPIO PC13) when the MCU is running ?

It does not work If I read the pin using HAL_GPIO_ReadPin.... 

status = HAL_GPIO_ReadPin(GPIOC, PWR_SWITCH_Pin);

Do I have to change the pin to a GPIO_input to read the pin and then change it back to SYS_WKUP2 before shutting down ?

Just configure PC13 as EXTI instead of SYS_WKUP. It should still wake up from Standby mode.

I'm not 100% sure it'll work as I don't have an L433 on hand to test. However, I've tested with an STM32G071RB and it does wake up using EXTI.

Also, setting for EXTI only works for pins that do have SYS_WKUP pins and not just any pin with EXTI.

If you FIFO doesn't work, then it's called GIGO.
TimerCallback tutorial! | UART and DMA Idle with multiple UART instances tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.

@Karl Yamashita wrote:

Just configure PC13 as EXTI instead of SYS_WKUP. It should still wake up from Standby mode.


Yes - that's the way I do it on STM32F0:

The pin is configured as EXTI in the .ioc for "normal" operation.

The WKUP function is enabled immediately before going into STANDBY

    /* 3: Enable WKUP pin */
    HAL_PWR_EnableWakeUpPin( Sw_WKUP );

    /* 4: Request to enter STANDBY mode */
    HAL_PWR_EnterSTANDBYMode();

 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

I need wake-up from shutdown, not standby. 

I was told that only WKUP pins are able to wake the MCU from shutdown

 

See here…

https://community.st.com/t5/stm32-mcus-products/stm32l433rct6-which-external-interrupt-gpio-pin-can-i-used-for/m-p/820260#M282312

 

Well I've tested Standby because I saw the datasheet posted and it showed Standby.

But yes, it'll still wake up from Shutdown. I have an NUCLEO-L432KC at home and tested it just now.

 

void Shutdown(void)
{
	HAL_SuspendTick();

	__HAL_PWR_CLEAR_FLAG(PWR_FLAG_WUF4);
	HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN4_LOW);

	HAL_PWREx_EnterSHUTDOWNMode();

	SystemClock_Config();
	HAL_ResumeTick();
}

 

If you FIFO doesn't work, then it's called GIGO.
TimerCallback tutorial! | UART and DMA Idle with multiple UART instances tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.
freeflyer
Senior

Fixed by TDKs suggestion in this post...

"Probably should put the delay before you clear the flag. If not debounced, the flag is certainly getting set immediately after you clear it and/or when button is released."

https://community.st.com/t5/stm32-mcus-boards-and-hardware/nucleo-l433rc-p-wake-up-from-shutdown-wakes-even-though-the/m-p/822722