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.

Enable Timer in SYS/BIOS on c64p

Other Parts Discussed in Thread: SYSBIOS

Hi.

I am trying to enable a 1s timer in SYS/BIOS on c6472, but to make a code which is not dependant on specific target/device.

When I follow document, SPRUEX30, "SYS/BIOS User's Guide", Chap 8.3, Timer module, it recommends to use a standard interface for easy porting to any target/devices.

But, when I compile the code using example code in the document, it complains that "ti.sysbios.timers.timer64.Timer.Instance#1 : Timer 0 is already in use or reserved".

I believe if I use the standard API to create Timer handler, it should automatically allocate available timer in its lists.

So, I think one of my code is wrong but I can't find out any more documents in your site for timer configuration.

Would you give me a gudie what is wrong in my code?

Work environment : biso_6_41_04_54, xdctools_3_31_00_24_core, ccsv6.1

In .cfg

var Timer = xdc.useModule('ti.sysbios.hal.Timer');

var timerParams = new Timer.Params();
timerParams.period = 1000000;
timerParams.runMode = Timer.RunMode_CONTINUOUS;
Timer.create(Timer.ANY, "&timerIsr", timerParams);

In main.c

Timer_Handle timerHandle;

void main(void)

{

Timer_Params timerParams;

Error_Block eb;

Error_init(&eb);

Timer_Params_init(&timerParams);

timerParams.period = 1000000;

timerParams.periodType = Timer_PeriodType_MICROSECS;

timerParams.arg = 0;

timerHandle = Timer_create(Timer_ANY, timerIsr, &timerParams, &eb);

if(timerHandle == NULL)

{

Log_print("Failed to create Timer Handle");

}

....

}  // end of main

void timerIsr()

{

..... // will be added

}

 

  • Hi Joondong,
      In your cfg file I see you're creating a timer instance and doing the same thing in your c file are you trying to create 2 separate timer instances? In TI-RTOS, there are two ways to create instances of modules, statically using the cfg script or dynamically in your c file. Creating an instance of a module in your cfg script ensures that it is allocated during build time while creating in your c file allocates resources for the instance at run-time.

      Can you attach your project so I can try building it and see what's going wrong?


    Let me know if this helps.

    Regards,
    Moses

  • Hi Moses.

    Thank you for your help.
    I misunderstood the document. After removing lines in .cfg, it works fine.

    Regards
    Joondong