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/TM4C1294NCPDT: Timer_Construct, is there way to start/stop timer?

Part Number: TM4C1294NCPDT

Tool/software: TI-RTOS

The TImer_Create(....) provide handle which allow Timer_Start() and Timer_Stop(). However the Timer_Construct() does not provide handle nor ID which required to get handle to make use of start/stop

Based on Timer_Construct(), is there way to start/stop timer and if so how, please provide code. How to extracts handle from a constructed timer where ID is Timer_Any. 

  • Few additional query, I'm using CCS8.0 and BIOS 6_45_01_29

    (1) I'm I allowed one timer or many timer?

    (2) The program crashed when I do this. I have checked user manual and could not find issue in the code......

    Timer_Handle         RFD_FIFOTest_Timer_Handle;    
    
    Timer_Params        RFD_FIFOTest_TimerParams;    
    
    void RFD_DM_FIFOTest_SetupTimer(void)
    {
    zMODBUSOpFlags.isFIFOTestEmulationSysTick = 1;
    Error_Block eb;
    Error_init(&eb);
    //-----------------------------------------------------------------------Setup 100mSec event.
    
    Timer_Params_init(&RFD_FIFOTest_TimerParams);
    RFD_FIFOTest_TimerParams.periodType = Timer_PeriodType_MICROSECS; // Period in uSec (default)
    RFD_FIFOTest_TimerParams.runMode = Timer_RunMode_CONTINUOUS; // Continuous Run (default)
    RFD_FIFOTest_TimerParams.startMode = ti_sysbios_hal_Timer_StartMode_USER; // User Control via Timer_Start/Stop.
    RFD_FIFOTest_TimerParams.period = 10000; // 10000 uSecs = 10ms
    //Handle = Timer_create(Int id, ITimer_FuncPtr tickFxn, const Timer_Params *params, Error_Block *eb);
    
    RFD_FIFOTest_Timer_Handle = Timer_create(Timer_ANY, (Timer_FuncPtr)RFD_FIFOEmuADC24_TimerFxn, &RFD_FIFOTest_TimerParams, &eb);
    if (RFD_FIFOTest_Timer_Handle==NULL)
    {
    System_abort("RFD_FIFOTest_Timer_Handle create failed");
    };
    }
    
    Void RFD_FIFOEmuADC24_TimerFxn(UArg arg)
    {
    ....
    }

    (3) As I read, the RTOS Timer use Timer0 together with Clock, correct?, I have no code (TivaWare) attached Timer0 and 1. I do have several TivaWare code attached to other timer (2,3,4,5,6) using hand written RTOS code HWI/SWI/Semp.

  • Hi Richard,

    You need to convert the Struct to a Handle when you construct. Details are on this page: processors.wiki.ti.com/.../TI-RTOS_Object_Creation_Comparison

    The Clock module be defaults grabs one GP timer for TM4C. You can create additional ones. You need to check your device to see how many there are. By default it grabs a free one (Timer_ANY). Usually this is 0 since there are no other timers created in the .cfg file. You can look at Tools->ROV to confirm this.

    The code looks fine to me. When does it crash?

    Todd

  • Additionally, can you check ROV->BIOS->Scan for Errors to see if any stacks are blown.
  • Did this get resolved?

    [Update 8/16: Marking TI Thinks Resolved because of inactivity]

  • Sorry I was away on vacation, thank for closing, all is good. I scrapped timer and adopts alternative solution.

    As I understood now, there no way to obtains handle from created object, Only the constructed object, 

  • richard payne said:
    As I understood now, there no way to obtains handle from created object, Only the constructed object, 

    The handle is returned from the <Mod>_create call.