2020-12-28 11:51 AM
EE designed the board with both pins in use and both needing to wake up from STOP2. At start PA5 must be used to awake. Once awake, switch interrupt to PB5 for normal processing. When normal processing is done, switch back to PA5 and enter STOP2. Is there some sample code out there that I can use? Or do I need to reinvent the wheel?
Solved! Go to Solution.
2021-01-08 01:42 PM
In HAL_GPIO_Init() it initializes PA5 to use the interrupt. When I switch to run mode, I call a function to reinitialize PA5 to be GPIO_Input and PB5 (and others) to be interrupted. When it is time to go to STOP2, I call another function to make PB5 (and others) to be GPIO_Input and PA5 to be interrupted.
2020-12-28 12:12 PM
You can change which pin is connected via HAL_GPIO_Init. Just switch when you wake up, and again when you go back to sleep.
2020-12-28 03:34 PM
Are you talking about EXTI? Then simply change the setting of respective SYSCFG_EXTICRx field.
JW
2020-12-29 05:23 AM
I was getting the coding ready for the HAL_GPIO_Init(), but I like the SYSCFG_EXTICR2 idea even better. It is a simple CLEAR and OR. I don't believe that I will need to do anything with the NVIC. The ISR will have to change to accommodate the different ports.
Thanks for the quick and good responses!
2021-01-08 01:42 PM
In HAL_GPIO_Init() it initializes PA5 to use the interrupt. When I switch to run mode, I call a function to reinitialize PA5 to be GPIO_Input and PB5 (and others) to be interrupted. When it is time to go to STOP2, I call another function to make PB5 (and others) to be GPIO_Input and PA5 to be interrupted.