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.

CC2541 OSAL Timer not work after wake up from PM2

Other Parts Discussed in Thread: CC2541

Hi all,

I am working on CC2541 Low power modes.

I tested the PM2 and it is wake up by using external Interrupt.

I found that the  osal_start_timerEx() function not working.

Timer does not expire to set the event.

Can i know the issue behind it?

This is my sleep mode Entry code.

#define HAL_SLEEP_SET_POWER_MODE( mode )                                     
  st( SLEEPCMD &= ~PMODE;                                                    
      SLEEPCMD |= (mode);                                                                                                                                   
       halSetSleepMode();                                                     
       )

void setup_port_interrupt(void)
{
    // Clear Port 0 Interrupt flags.
    P0IF = 0;
    P0IFG = 0x00;

    // Interrupt enable on all pins on port 0.2.
    P0IEN = 0x04;   

    // Enable CPU Interrupt for Port 0 (IEN1.P0IE = 1).
    P0IE = 1;

    // Enable Global Interrupt by setting the (IEN0.EA = 1).
    EA = 1;
}

#pragma vector = P0INT_VECTOR
__interrupt void port0_isr(void)
{
    // Note that the order in which the following flags are cleared is important.

      // Clear Port 0 Interrupt Flags.
    P0IFG = 0x00;

    // Clear CPU Interrupt Flag for P0 (IRCON.P0IF = 0).
    P0IF = 0;

    // Set LED1 to indicate Active Mode.
    
    
    CLEAR_SLEEP_MODE();
    
 
}

void halSleep( uint32 osal_timeout )
{
 
 
  // Initialize P1_0for SRF05EB LED1.
    P1SEL &= ~(0x01);           // Function as General Purpose I/O.
    P1_0 = 1;                 // LED1 on.
    P1DIR |= 0x01;            // Output.

    // Initialize P0_0 for SRF05EB S1 button.
    P0SEL &= ~(0x04);          // Function as General Purpose I/O.
    P0DIR &= ~(0x04);          // Input.
    P0INP |= 0x04;             // 3-state input.
 
 
      setup_port_interrupt();
 
      halPwrMgtMode = HAL_SLEEP_TIMER;


      HAL_SLEEP_SET_POWER_MODE( halPwrMgtMode );
      
       
       HAL_ENABLE_INTERRUPTS();
      
      


  return;
}

Can anyone help me to solve the problem?

Thanks

Arul

  • Hi ,

    Did you resolve this issue . please let me know .I am also facing the same issue . I want to wakeup cc2541 using external interrupt
  • Arul,

    Can you tell more information. Like are you downloading this code in

    1. 2540 USB Dongle or 2541 Keyfob

    2. Which C File your referring to?

    3. What sample project ? 

  • Hi ,

    I implemented GPIO interrupt uisng KXTJ9-1007 Acceleriometer ( my cc2541 is interfaced KXTJ9-1007 at P0.2 pin) , I configure ISR routine cc2541 side and configuered KXTJ9-1007 Interrupt source registers ( Enabled IEN ,IEA bits in INT_CTRL_REG1 register DRDYE bit in CTRL_REG1 register) , the accelerometer generating interrupt but after reading INT_REL register the interrupts are not clearing ( still STATUS register and INT_SOURCE1 registers are not coming back to 0x00) , still these registers are showing interrupt is presented .

    Can any one help out here how can I clear the interrupt at accelerometer ???
    or
    Am I doing anything wrong in configuring the registers ?

    Thanks