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.

RTOS/CC2538: Timer Problem

Part Number: CC2538


Tool/software: TI-RTOS

Hi,

I'm using Zstack-3.0 for ZigBee communication.

Here i'm facing froblem in osal_start_timerEx();

I'm using this function for periodic sending data for every 1 min by calling osal_start_timerEx();. But after every 5 min, 5th min data sending twice.

i.e. 5th min data send twice

10th min data twice

15th min data twice so on...


This osal_start_timerEx(); calling twice for every 5 min at a time.

the below code shows how I'm calling

if( events & PERIODIC_EVT )
{
    WatchdogClear();
   // periodic Activity if device is in network //
    if(bdb_isDeviceNonFactoryNew())
   {
      osal_start_timerEx( Kiko_Activity_TaskID, PERIODIC_EVT,20000 );
      do_Periodic_Report();
      return (events ^ PERIODIC_EVT);
   }

        }

  • sorry,

    osal_start_timerEx( Kiko_Activity_TaskID, PERIODIC_EVT,60000 );
  • Check if your application calls osal_start_timerEx( Kiko_Activity_TaskID, PERIODIC_EVT... to trigger the event accidentally.
  • yah, i checked no where i'm calling again
  • What is the define of your PERIODIC_EVT?
  • #define PERIODIC_EVT 0x0200
  • Is there other event define the same value to 0x0200?
  • Strange. I see no reason why it would come twice.
  • Hi chethan,

    Re-confirm that there are no other periodic timer event calls, and that the PERIODIC_EVT is properly cleared the first time during the fifth minute. Does the same occur if you change the period? What if you use a different value for PERIODIC_EVT?

    Regards,
    Ryan
  • Hi Ryan Brown1,

    yah, I checked for 30 sec at that time 10th data sending twice i.e 5th minute. As like previous.
    I'm calling periodic event at 1 place, that is every 1 minute the periodic event I'm calling. But parallaly other event calling this periodic event for every 300 ms (i.e 5 min).

    the code is like below,
    /*******************************************************************************************************
    void touchpannel_Init( byte task_id )
    {
    Kiko_TouchPannel_TaskID = task_id;
    CONFIG_TOUCH_INT();

    bdb_StartCommissioning(BDB_COMMISSIONING_REJOIN_EXISTING_NETWORK_ON_STARTUP);
    osal_start_timerEx( Kiko_Activity_TaskID, KIKO_FINDNWK_EVT, 30 );
    }

    /*******************************************************************************************************
    if( events & PERIODIC_EVT )
    {
    if(bdb_isDeviceNonFactoryNew())
    {
    periodic_var = true;
    osal_start_timerEx( Kiko_Activity_TaskID, PERIODIC_EVT,60000 );
    do_Periodic_Report();
    return (events ^ PERIODIC_EVT);
    }
    else
    {
    osal_start_timerEx( Kiko_Activity_TaskID, PERIODIC_EVT,10000 );
    return (events ^ PERIODIC_EVT);
    }
    return (events ^ PERIODIC_EVT);
    }

    // Network Event of Kiko connect with Kiko Network //
    if( events & KIKO_FINDNWK_EVT )
    {
    WatchdogClear();
    if(_NIB.nwkDevAddress == 0xFFFE){
    bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING);
    osal_start_timerEx( Kiko_Activity_TaskID, KIKO_STAYNWK_EVT, 10000 );
    }else
    {
    if(bdb_isDeviceNonFactoryNew())
    {
    if(!periodic_var){
    osal_start_timerEx( Kiko_Activity_TaskID, PERIODIC_EVT, 10 );
    }
    }else
    {
    bdb_StartCommissioning(BDB_COMMISSIONING_REJOIN_EXISTING_NETWORK_ON_STARTUP);
    }

    osal_start_timerEx( Kiko_Activity_TaskID, KIKO_STAYNWK_EVT, 300000 );
    }
    return (events ^ KIKO_FINDNWK_EVT);
    }



    // Maintain Device in Network by Rejoin when lost //
    if( events & KIKO_STAYNWK_EVT )
    {
    if(bdb_isDeviceNonFactoryNew())
    {
    osal_start_timerEx( Kiko_Activity_TaskID, KIKO_FINDNWK_EVT, 30 );
    osal_start_timerEx( Kiko_Activity_TaskID, KIKO_STAYNWK_EVT, 300000 );

    }else{
    osal_start_timerEx( Kiko_Activity_TaskID, KIKO_FINDNWK_EVT, 300000 );
    osal_start_timerEx( Kiko_Activity_TaskID, KIKO_STAYNWK_EVT, 300000 );
    }
    return (events ^ KIKO_STAYNWK_EVT);
    }
  • If KIKO_STAYNWK_EVT and PERIODIC_EVT share the same value or if KIKO_STAYNWK_EVT immediately raises PERIODIC_EVT then this behavior is explained. Please further debug your code.

    Regards,
    Ryan
  • Hi chethan,

    Have you been able to further investigate this matter?

    Regards,
    Ryan