AnsweredAssumed Answered

ADuC7060 wake up from sleep in interrupt

Question asked by JBaczuk on Apr 19, 2018
Latest reply on Apr 20, 2018 by JBaczuk

I'm trying to wake up the device to read the ADC, toggle a few GPIO, then go to sleep.  When I toggle a GPIO using GP1DAT |= 0x200000;  The device will not go back to sleep.  If I comment that line out, then it works (goes back to sleep).

 

void IRQ_Handler(void) __irq
{
   unsigned long IRQSTATUS = 0;
   mudmax_raw_data buffer;
   int i;

   IRQSTATUS = IRQSTA; // Read off IRQSTA register

   if ((IRQSTATUS & BIT4) == BIT4) //Timer 1 interrupt source
   {
      T1CLRI = 0x55; // Clear the currently active Timer1 Irq
      GP1DAT |= AVDD_REG; // comment this out and it works/goes back to sleep (AVDD_REG = 0x200000 or BIT22)

      GP1DAT |= LED_REG;

      for(i=0; i< 1000000; i++){} // time to flash

      GP1DAT &= ~AVDD_REG;
      GP1DAT &= ~LED_REG;
   }
}

Outcomes