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.

CC2430 TI-MAC 1.2.1 software freezes

I'm porting my application sofware based on CC-MAC to TI-MAC 1.2.1.

In my old software I have had some problems (freeze of sw execution) related to power modes and sleep. I have solved these problems following the DN106 design note rules for managing the low consumption power modes.

Now after porting to TI-MAC 1.2.1 these problems are newly apperead!

My software does this:

after initialization it try to find a valid coordinator, if it fails goes in PM2 for about 3 minutes, after that it wakes up and repeat the same operations.

The power saving is enabled during sw initialization: osal_pwrmgr_device(PWRMGR_BATTERY);

The PM2 is entered in this way:

osal_pwrmgr_task_state( osal_self(), PWRMGR_CONSERVE );

osal_start_timer( APP_EVENT_T1, CFG.INACTIVE_SLEEP_T1 ); CFG.INACTIVE_SLEEP_T1 is equals to 30000ms ( a counter let me to repeat this 6 times: 30sx6 = 180s= 3 minutes).

The code works fine but sometimes the software execution freezes, my question is why this happen?

Note that the halsleep function in hal_sleep.c file of TI-MAC seems to apply the DN106 design note rules as regards the power mode entering and oscillator settings.

The RC oscillator settings before entering PM2 haven't to be performed by application sofware because this is done directly by halsleep function.

void halSleep( uint16 osal_timeout )

Do you have any ideas? Thanks in advance.

 

  • Looking at the HAL_SLEEP_SET_MAIN_CLOCK_CRYSTAL() and the DN106 design note I don't understand a thing:

    The DN106 stays that a 64uS of NOPs have to be added as safety time (in order to allow XOSC to be stable) but the asm("NOP") + halSleepWait(63) equals to: 1+63*8=505 NOPs --> 31.5uS (if 16MHz RCOSC) and 31.5/2 (if 32MHz XOSC).

    I'm not taking into account the while(duration--) operations.

    I'm wrong?

    * set main clock source to crystal (exit sleep) */
    #define HAL_SLEEP_SET_MAIN_CLOCK_CRYSTAL()  st(SLEEP &= ~0x04;          /* turn on both oscs */ \
                                                   while(!(SLEEP & 0x40));  /* wait for XOSC */     \
                                                   asm("NOP");                                      \
                                                   halSleepWait(63);    /* required for all revs */ \
                                                   CLKCON = (0x00 | OSC_32KHZ);   /* 32MHx XOSC */  \
                                                   while (CLKCON != (0x00 | OSC_32KHZ));            \
                                                   SLEEP |= 0x04;)          /* turn off 16MHz RC */

    void halSleepWait(uint16 duration)
    {
      while (duration--)
      {
        asm("NOP");
        asm("NOP");
        asm("NOP");
        asm("NOP");
        asm("NOP");
        asm("NOP");
        asm("NOP");
        asm("NOP");
      }
    }

    Could this be a reason of the problems?