cancel
Showing results for 
Search instead for 
Did you mean: 

Enable/Disable interrupt in sleep mode

Shush1908
Associate II

Hi all,

I work with STM32F413 and CMSIS os.

I have a problem when I put the CPU in sleep mode by HAL_PWR_EnterSTOPMode.

In the os_idle_demon I need to disable one external interrupt, do some job and enable again the interrupt and so on.

My problem is that the interrupt is always disabled.

Please your help,

Shush

Here is peace of my code:

void os_idle_demon (void) 

{

  for (;;) 

  {

   while(x)

   {

    HAL_SuspendTick() ;

    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFE);

    SystemClock_Config();

  

    HAL_NVIC_EnableIRQ(irqType) ;

    DoSomeJob();

    HAL_NVIC_DisableIRQ(irqType) ;

    HAL_ResumeTick() ;

   }

 }

}

3 REPLIES 3
TDK
Guru

> I need to disable one external interrupt, do some job and enable again the interrupt and so on.

>  HAL_NVIC_EnableIRQ(irqType) ;

>   DoSomeJob();

>   HAL_NVIC_DisableIRQ(irqType) ;

Your text says one thing but your code does the opposite.

How are you verifying that it's always disabled? What IRQ is it?

If you feel a post has answered your question, please click "Accept as Solution".
Shush1908
Associate II

Hi @TDK​ ,

You are right. The example is wrong. The explanation is correct: " I need to disable one external interrupt, do some job and enable again the interrupt and so on".

I'm verify the status, by the status on NVIC->ISER and NVIC->ICER ant there all is OK.

This is External IRQ "EXTI9_5_IRQn".

Shush

Shush1908
Associate II

Hi,

I want to clarify something:

In DoSomeJob() I communicate with the One-Wire bus. All is perfect, but when I finish it and enable the IRQ and the CPU goes to the stop mode , I see in scope that the OneWire bus is in high level(OK) but when one wire device(keypad) try to make a pulse in the bus - it couldn't. If I don't call the DoSomeJob() all is ok. I think I need to do something in the bus when DoSomeJob() is finished. But What????

Shush