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.

CCS/TMS320F28335: Clock module in the sysBios does not reliable work with timer 2

Part Number: TMS320F28335
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hi All

I have a problem with the clock module in the sys bios. I'm using sys bios_6_76_00_08 and CCS studio Version: 9.0.0.00018.

I need Timer 0 and 1 in my applikation. That for I configured the clock module in the cfg file like this: 

Clock.tickSource = Clock.TickSource_TIMER;
Clock.tickPeriod = 100;

var Clock = xdc.useModule('ti.sysbios.knl.Clock');
Clock.timerId = 2;

Then I configured two instances


var clock0Params = new Clock.Params();
clock0Params.instance.name = "ADC";
clock0Params.period = 4;
clock0Params.startFlag = true;
Program.global.ADC = Clock.create("&vRunInternalAdcAndFilterInputs", 1, clock0Params);
var clock1Params = new Clock.Params();
var clock2Params = new Clock.Params();
clock2Params.instance.name = "MAIN";
clock2Params.period = 50;
clock2Params.startFlag = true;
Program.global.MAIN = Clock.create("&vSoftWatchDogHandler", 1, clock2Params);

I traced the vRunInternalAdcAndFilterInputs on the hardware with a scope.

It seams to work. But always after a certain time (1..3hours) the clock module stops and starts again.

See the atached picture.

I need help. I tryed several things but nothing helps. Does  somebody have an idee what is wrong with my configuration?

Thank You very much!

Herbert

   

  • Hi Herbert,

    Can you try it with the default timer (just leave Clock.timerId as the default)? Does it work different (I would not expect it to, but hopefully it is an easy thing to rule any issues with Timer2). 

    I see your clock period is 100us. This is a little fast, but I would not expect to see off by 10ms. Can you add a clock function that runs every tick and just toggles a GPIO. I'd like to see if a single tick is delayed or multiple ones. Also, could you halt the target and look at Tools->ROV->Clock->Module->ticks. Then let the target run for 5 seconds and halt it. Look at the tick count again. What's the difference (it should be ~50,000 ticks)?

    Could you be disabling interrupts for a long period in your application? 

    Todd

  • Hi Todd

    Thank You for Your fast replay. I appreciate that very much! -

    I measured the tick and it is ok. My question is now: Why is 100us fast? Is it possible that the Sys Bios reaches some limits?

    I changed also the Bios library type from Debug to Custom. When I did that, the system runs over 12h without any failure!

    Could be that the reason for better performance?

    The other test with a toggle GPIO on every tick I will perform that next.

    Kind regards

    Herbert

  • Hi Herbert,

    On a tick, the kernel does processing (e.g. see if any tasks should be woken up, calls the application Clock functions, etc.). The custom kernel has better performance over the debug, so it could be that every once in awhile, the Clock module's work to be done in a tick is more than 100us (e.g. it has several long clock functions created by the application). 

    Why do you need the Clock module to run at 100us? Take a look at this write-up: http://processors.wiki.ti.com/images/5/54/C28_zero_latency.pdf It talks about clock and timer usage with TI-RTOS (and when to move to a zero-latency interrupt...which I'm not necessarily recommending here, but it's good information to know.).

    Todd

  • Hi Todd

    Thank You for Your valuable inputs.

    But I do not like to change the Clock configuration if it is not really necessary.

    Fact is now, that my system runs stable over more then 5 days. It seams, it is because of the  main change I made as I said before:

    In "Basic Runtime options" I changed the library type from "Debug" to "Custom". For verification I changed the Clock module tick from 100us to 50us.

    With that the system still runs without any failure. But the clock periodes variates then from about 30us to 75us.

    I think if I now change the clock tick to 200us then I am on the safe side. What do You think about?

    May I ask You something about the stack size?

    On "Runtime Memory Options" it is possible to set the system stack size and the heap size.

    - How can I set these correctely?

    - Is there a guideline?

    - If I do not use the heap, can I set the space to 0? 

    Thank You very much for Your help.

    Kind regards

    Herbert

  • Herbert,

    If the 200us granularity works for you, I'd use that.

    Regarding the stack size, can you open another thread for that? We try to keep one topic/issue per thread.

    Todd

  • Thank You for Your great support.

    The system works now without any problems

    With kind regards

    Herbert