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.

Compiler/TMS320F28388D: Timer 2 for SYS/BIOS

Part Number: TMS320F28388D
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI C/C++ Compiler

Hi all,

Timer 2 is used for SYS/BIOS by default according to the TRM of TMS320F28388D, as follows:

Is it necessary to configure Timer 2 explicitly in script, just like the code below?

/*
 * Create a timer instance to generate a periodic interrupts.
 *
 *  Timer ID : 2 (CPU TIMER2 Interrupt (forTI/RTOS use))
 *
 *  Core Priority: 18
 *
 * The timer will be started within the BIOS_start()
 * thread
 */
var Timer = xdc.useModule('ti.sysbios.family.c28.Timer');
var timerParams = new Timer.Params();
timerParams.startMode = Timer.StartMode_AUTO;
timerParams.runMode = Timer.RunMode_CONTINUOUS;
/* Timer period is 1 milisecond (1,000 uSeconds) */
timerParams.period = 1000;
timerParams.periodType = Timer.PeriodType_MICROSECS;
timerParams.emulationModeInit.free = 1;
var myTimer = Timer.create(2, '&OS_1ms_ISR', timerParams);

Another question, there are 3 Timer for TMS320F28388D, i.e. Timer0/1/2.  How does the SYS/BIOS know which Timer is selected for time base reference?

In other words, I confogure two timers, TIMER0/2, in script file just like this:

var Timer = xdc.useModule('ti.sysbios.family.c28.Timer');
var timerParams = new Timer.Params();
timerParams.startMode = Timer.StartMode_AUTO;
timerParams.runMode = Timer.RunMode_CONTINUOUS;
/* Timer period is 1/2 second (500,000 uSeconds) */
timerParams.period = 100;
timerParams.periodType = Timer.PeriodType_MICROSECS;
var myTimer = Timer.create(0, '&OS_100us_ISR', timerParams);

var Timer = xdc.useModule('ti.sysbios.family.c28.Timer');
var timerParams = new Timer.Params();
timerParams.startMode = Timer.StartMode_AUTO;
timerParams.runMode = Timer.RunMode_CONTINUOUS;
/* Timer period is 1 milisecond (1,000 uSeconds) */
timerParams.period = 1000;
timerParams.periodType = Timer.PeriodType_MICROSECS;
timerParams.emulationModeInit.free = 1;
var myTimer = Timer.create(2, '&OS_1ms_ISR', timerParams);

Then which timer is selected for SYS/BIOS use?

Thanks.

  • Hi,

    It is not necessary to explicitly configure Timer 2 for the kernel.

    If you do happen to use Timer 2, the kernel will still attempt to use that Timer leading to unexpected runtime behavior. The timer used by the kernel may be reconfigured in your script using the Clock module.

    Derrick

  • The default timer used by the kernel is "ANY", which means it take any free one. It happens that it starts on the higher timer ids first (to avoid potential conflicts in cases where you use a timer directly without using kernel's Timer APIs). If you explicitly use Timer 0 and 2 in the .cfg (as you did above), Timer 1 will be used by the kernel (since it it is the only one free).

    Todd