cancel
Showing results for 
Search instead for 
Did you mean: 

Why is it necessary to disable interrupts before enter stop mode in BL072Z board end_node example?

jg_spitfire
Senior
while( 1 ) 
 {
 
   if (AppProcessRequest==LORA_SET) 
   {
 
     /*reset notification flag*/
 
     AppProcessRequest=LORA_RESET;
 
    /*Send*/
 
     Send( NULL );
   }
 
   if (LoraMacProcessRequest==LORA_SET)
   {
 
     /*reset notification flag*/
 
     LoraMacProcessRequest=LORA_RESET;
 
     LoRaMacProcess( ); 
   }
 
   /*If a flag is set at this point, mcu must not enter low power and must loop*/
 
   DISABLE_IRQ( );
 
   /* if an interrupt has occurred after DISABLE_IRQ, it is kept pending 
 
    * and cortex will not enter low power anyway */
 
   if ((LoraMacProcessRequest!=LORA_SET) && (AppProcessRequest!=LORA_SET))
 
   {
 
#ifndef LOW_POWER_DISABLE
 
     LPM_EnterLowPower( );
 
#endif
 
   }
 
   ENABLE_IRQ();
 }

Hi, I don't understand why I need to disable the IRQ before enter stop mode and enable it when the board wakes up, if I comment those functions (DISABLE_IRQ and ENABLE_IRQ) the node does not send or receive data properly

Thanks

0 REPLIES 0