Thursday, October 27, 2016

How to create a periodic event for CC253x/CC254x Z-Stack and BLE Stack.

The following codes show example to create a periodic event that is triggered every 5 seconds for CC253x in Z-Stack and you can do it accordingly for CC254x in BLE Stack.

1. Add "#define PERIODIC_EVT 0x0001"in your code. Please note that event define has to be an unused bit mask of uint16.

2. Put  the following line at where you want to start PERIODIC_EVT

osal_start_timerEx( zcl_XXX_TaskID, PERIODIC_EVT, 10 );

2. Create PERIODIC_EVT processing in zcl_XXX_event_loop
if( events & PERIODIC_EVT )
  //Do things that need periodic processing here!
  osal_start_timerEx( zcl_XXX_TaskID, PERIODIC_EVT, 5000 );
  return (events ^ PERIODIC_EVT);


  1. I tried this with the BLE stack but the program only enters the first time and that's it

    1. You can also refer to SBP_START_DEVICE_EVT implementation in simpleBLEPeripheral example of BLE Stack v1.4.2.

  2. This comment has been removed by the author.