This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

cc1110 wake mode 3


I am developing with CC11110. I am trying to wake from sleep at mode 3. The wake is by 4 buttons(external input interrupt).
when there is no sleep, the application identify every button press. But with sleep, sometimes it wake and sometimes not.
I tried to add the following command:
SLEEP &= 0xFC; // clearing of the SLEEP.MODE bits will ensure that the application does not enter PM{1 – 3}.
at every interrupt ISR that I got, without successful.
The external IO I use are P0_0,P0_1,P0_2,P0_3.
The configuration before sleep is as follows:
P0SEL &= 0xf0; //GENERAL IO
P0DIR &= 0xf0; //inputs.
P0INP &= 0xff; //tristate
P0IFG = 0; //clear interrupts flag
PICTL |= 8; //Port 0, inputs 3 to 0 interrupt enable.
PICTL |= 1; //Port 0, inputs 7 to 0 1 Falling edge on input gives interrupt.


Is someone can help me with this issue?

  • I ran the below code on the SmartRF 04EB and where able to wake up the CC1110 from PM3 by pressing S1. The green LED toggles every time the radio is woken from PM3.

    /*==== DEFINES  ==============================================================*/
    #define G_LED           P1_0
    #define LED_OFF         1
    #define LED_ON          0

    // Initialization of source buffers and DMA descriptor for the DMA transfer
    unsigned char __xdata PM3_BUF[7] = {0x07,0x07,0x07,0x07,0x07,0x07,0x04};
    unsigned char __xdata dmaDesc[8] = {0x00, 0x00, 0xDF, 0xBE, 0x00, 0x07, 0x20, 0x42};


    /*******************************************************************************
    * @fn  main
    *
    * @brief
    *      Main function.
    *
    * Parameters:
    *
    * @param  void
    *
    * @return void
    *
    *******************************************************************************/
    void main(void) {
     
      unsigned char temp;
         
      //----------------------------------------------------------------------------
      // Init LEDs for debug purposes 
      P1DIR = 0x01;       // P1_0 (Grenn LED)  set as outputs
      G_LED = LED_OFF;
     
      //----------------------------------------------------------------------------
      // Init P0.1 (S1) as input and enable interrupt
      // Select function
      P0SEL &= ~0x02;       // Select to function as General Purpose I/O

      // Select direction
      P0DIR &= ~0x02;       // Select direction to input

      // Select input type
      P0INP &= ~0x02;       // Pull up/pull down
       
      //----------------------------------------------------------------------------
      // Update descriptor with correct source
      dmaDesc[0] = (unsigned int)& PM3_BUF >> 8;
      dmaDesc[1] = (unsigned int)& PM3_BUF;
       
      // Associate the descriptor with DMA channel 0 and arm the DMA channel
      DMA0CFGH = (unsigned int)&dmaDesc >> 8;
      DMA0CFGL = (unsigned int)&dmaDesc;
      DMAARM = 0x01;
     
      //----------------------------------------------------------------------------
      // Clear interrupt flags for P0
      P0IFG &= ~0x02;       // Clear status flag for pin
      P0IF = 0;             // Clear CPU interrupt status flag for P1
     
      // Set individual interrupt enable bit in the peripherals SFR.
      PICTL |= 0x08;        // Enable interrupt from pin
      PICTL |= 0x01;        // Set interrupt on rising edge and for P0

      // Enable P0 interrupts
      IEN1 |= 0x20;

      // Enable global interrupt by setting the IEN0.EA=1
      EA = 1;
      
      while (TRUE) {
       
        // NOTE! At this point, make sure all interrupts that will not be used to
        // wake from PM are disabled as described in chapter 13.1.3 of the datasheet.
        // Align with positive 32 kHz clock edge as described in chapter 13.8.2
        // of the datasheet.
        char temp = WORTIME0;
        while( temp == WORTIME0);
       
        // Make sure XOSC is powered down when entering PM2/3 and that the flash
        // cache is disabled
        // NB! Replace 0x06 with 0x07 if power mode 3 is chosen instead
        MEMCTR |= 0x02;
        SLEEP = 0x07;
       
        // Enter power mode as described in chapter 13.1.3 in the datasheet.
        // Make sure DMA channel 0 is triggered just before setting PCON.IDLE
        asm("NOP");
        asm("NOP");
        asm("NOP");
        if(SLEEP & 0x03) {
          asm("MOV 0xD7,#0x01");  // DMAREQ = 0x01;
          asm("NOP");             // Needed to perfectly align the DMA transfer
          asm("ORL 0x87,#0x01");  // PCON |= 0x01;
          asm("NOP");
        }
       
        // Enable Flash Cache
        MEMCTR &= ~0x02;
      }
    }

    /*******************************************************************************
    * @fn          p0_ISR
    *
    * @brief       Interrupt Service Routine for port 0 and the chosen pin.
                   Clears interrupt flags and toggles LED.
    *
    * @param       void
    *
    * @return      void
    */

    #pragma vector = P0INT_VECTOR
    __interrupt void p0_ISR(void)
    {
        // Note: It is necessary to clear the MODE bits before returning from all
        // ISRs associated with interrupts that can be used to wake the device from
        // PM{1 - 3}.
        SLEEP &= ~0x03; // SLEEP.MODE = 00 
       
        // Note that the order in which the following flags are cleared is important.
        // For level triggered interrupts (port interrupts) one has to clear the module
        // interrupt flag prior to clearing the CPU interrupt flags. */

        P0IFG &= ~0x02;              // Clear status flag for pin
        P0IF = 0;                   // Clear CPU interrupt status flag for P1

        G_LED = ~G_LED;
    }

    BR

    Siri