CC2340R2: xTimerCreateStatic() parameters

Expert 4275 points

Part Number: CC2340R2

Hi team, 

Is the 4th parameter to xTimerCreateStatic() a PVTimerID or should it be the address of a variable that we will increment in the timer callback function?

 

Timers.h in this folder: C:\ti\simplelink_lowpower_f3_sdk_9_11_00_18\source\third_party\freertos\include

 

In Timers.h, the function xTimerCreateStatic() is defined this way.

#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
    TimerHandle_t xTimerCreateStatic( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
                                      const TickType_t xTimerPeriodInTicks,
                                      const BaseType_t xAutoReload,
                                      void * const pvTimerID,
                                      TimerCallbackFunction_t pxCallbackFunction,
                                      StaticTimer_t * pxTimerBuffer ) PRIVILEGED_FUNCTION;
#endif /* configSUPPORT_STATIC_ALLOCATION */

 

But the description of the function above it has this:

 *     xTimer = xTimerCreateStatic( "T1",             // Text name for the task.  Helps debugging only.  Not used by FreeRTOS.
 *                                  xTimerPeriod,     // The period of the timer in ticks.
 *                                  pdTRUE,           // This is an auto-reload timer.
 *                                  ( void * ) &uxVariableToIncrement,    // A variable incremented by the software timer's callback function
 *                                  prvTimerCallback, // The function to execute when the timer expires.
 *                                  &xTimerBuffer );  // The buffer that will hold the software timer structure.

 

Customer found this discrepancy when they tried to make the variable they increment in the callback function declared as volatile.They got a compiler error.

 

From looking at timers.c in the same directory the function traceTIMER_CREATE() is called and they do not have the code for this.

 

What they want to do is to just send an ID value to xTimerCreateStatic, and then set the variable they increment to Volatile. We don't really understand why xTimerCreateStatic() needs the variable they are incrementing since they do that in the callback function. Does this make sense?

 

Best,

Luke