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.

External interrupts not handled during sleep mode

Other Parts Discussed in Thread: CC2430

In my application, CC2430 is connected to a digital accelerometer ADXL345 from Analog devices. This accelerometer has two interrupt output pins which are connected to CC2430's two GPIO pins. When there is an interrupt, CC2430 will read data from ADXL345.

My algorithm for the accelerometer runs well if POWER_SAVING is disabled. By the way, I use Zstack. A image below shows what happened when there is an interrupt from ADXL345. It can be seen that, when INT1 is low (active low), in less than 1ms, CC2430 will read data from ADXL345 via SPI.

However, when I enable power saving, the interrupt is served 2 seconds later. I observed that the 2 seconds here is related to the -DPOLL_RATE defined in f8wConfig.cfg file coz when I changed -DPOLL_RATE to 5000 (ms), the interrupt will be handled 5 seconds later. That means, interrupts are only handled when CC2430 wakes up to poll messages from its parent.

By the way, I also had a push button on the board. If the button is pressed, a packet will be sent. I can see that the packet is sent immediately after the button is pressed.

What could be the possible cause?

Thanks for any help.

regards,

Yuan Jian

  • Today I found out that the external interrupts are handled on time actually. 

    In the ISR, I used a osal_set_event(Hal_TaskID, HAL_ADXL345_INT1_EVENT)  to set an event so HAL will read data from the accelerometer outside of the ISR. It turns out that CC2430 failed to pick up the HAL_ADXL345_INT1_EVENT event immediately after that and the system goes to sleep mode right after the ISR.  Only after it wakes up 2 seconds later, it starts reading the accelerometer data.

    I tried to add a osal_pwrmgr_task_state( Hal_TaskID, PWRMGR_HOLD ) to force the CC2430 into the awake state. However, this statement does not make any difference. 

    P.S. INT1 and INT2 line will be back to High state when data is read from the accelerometer.

    Yuan Jian

     

  • Hi,

    I figured out the problem myself, after continuously working on it for two days.

    The external interrupt can wake up the device. It is just that in halSleep() function in hal_sleep.c, there was a statement if ( HalKeyExitSleep() ). Only if HalKeyExitSleep() evaluates to a nonzero value, CC2430 will process that event.

    So In HalKeyExitSleep, I added something that if INT1 or INT2 are pressed, HalKeyExitSleep will return non-zero. Then CC2430 will be kept in the active mode.

    Yuan Jian