cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling/Disabling Interrupts Problem in STM32WB55RG

Yusuf
Associate III

Hello, I want to develop a software which includes an external interrupt for sleep mode and it should be enabled before entering sleep mode. For this purpose, I use:

HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0) ;

HAL_NVIC_EnableIRQ(EXTI0_IRQn);

When I choose HCLK4 HPRE at bottom as /2, giving 32 MHz to HCLK4, Flash and SRAM2, it works as expected, but when I choose it as /1,giving 64 MHz, code gets stuck at HAL_NVIC_EnableIRQ function. If I exclude interrupts, my software work well with /1 HCLK4 HPRE. Could you help me? Thank you in advance.

0693W00000aJCluQAG.png

5 REPLIES 5
Remy ISSALYS
ST Employee

Hello,

I tried to reproduce your issue but I didn't succeed. Are you able to reproduce the issue starting from an example available in STM32CubeWB package, BLE_p2pServer for example? Which version of cubeMX tool and STM32CubeWB package are you using?

You can check the wate states (latency) according RM0434 table 4 for HCLK4 at 64 MHz, it should be 3.

Best Regards

Hello,

Thank you for your answer. I used CubeMX for generating clock configurations and it is equal to 3 as you said. I tried in a default STM32 example and it doesn't work at 64 MHz, changing it to 32 MHz solves the problem. Could it be because of some issue about interrupt priorities in the software?

Best Regards.

Remy ISSALYS
ST Employee

Hello,

Can you share how you configure the pin used for external interrupt?

Best Regards

Hello,

First I configure the pin with a disabled interrupt feature as follows:

 GPIO_InitStruct.Pin = GPIO_PIN_0;

 GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

 HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);

 HAL_NVIC_DisableIRQ(EXTI0_IRQn);

Then I enable it before sleep (STOP1 mode):

   HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);

   HAL_NVIC_EnableIRQ(EXTI0_IRQn);

At 64 MHz HCLK4, it gets stuck at " HAL_NVIC_EnableIRQ(EXTI0_IRQn);"

Thanks for your help,

Best Regards.

Remy ISSALYS
ST Employee

Hello,

I don't see any reason that you get stuck in HAL_NVIC_EnableIRQ(EXTI0_IRQn); when HCLK4 is at 64 MHz. Are you working on nucleo-wb55 or on custom board? If you are working on nucleo-wb55, can you share a project that reproduce the issue?

Best Regards