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.

Timer period too long

CCS: Version: 6.1.2.00015
Tiva Eval Board: EK_TM4C1294XL
TivaWare_C_Series-2.1.2.111
xdctools_3_31_01_33_core

I am trying to set up a Timer to occur continuously every 256 microseconds that can be started and stopped by the program.

Using configuration I created a timer instance with:
TimerID = 0
Period = 256 (period in microseconds)
Start mode = timer will be started by user
Run mode = dynamically reporgrammed

Elsewhere in configuration, the CPU frequency is set to 120MHz

When the program tells the timer to run, the timer ISR function is invoked once every ~35 SECONDS.

This is a little more error than I would expect :)

As a test, prior to starting the timer, I called 'Timer_setPeriodMicroSecs' with a value of 256 and it returned '1' indicating it thought it could do it.

Any help would be appreciated.

  • Update: Changed config to instead of having the user start it, it auto starts and setting 'Run mode' to 'periodic and continuous'.

    This appears to have the ISR called correctly (at least it is occurring VERY FAST so I assume it is correct).

    But I do need to be able to start a timer at a specific time and know it will occur exactly every 256uS after that.

    Do I need to change to runtime instantiation rather than using config? I'm not opposed to that, it just seemed like config was a good way to set things up in one place so that more than one user is not trying to use the same resource.
  • Hi Greg,

    Could you attach a sample project?

    Just to make sure...once the ISR fires, you want to reprogram it again in the ISR? Or do you want it to run periodically every 256uS until the application stops it (and then restarts when needed)?

    You should be able to create the timer instance in the .cfg or during runtime. The only difference to creating during the runtime is the need of a heap (unless you use Timer_construct and supply the structure).

    Todd
  • Well, after some experimentation I found that the problem was primarily due to setting 'Run mode = dynamically reprogrammed'.

    The docs say this doesn't work on all platforms, but I ass.u.me.d that it would be supported on the newer (Tiva) platform.

    With run mode set to 'Continuous and periodic', it worked great, allowing me to 'dynamically reprogram' it to my heart's content even though it wasn't set that way.

    I could start and stop it and change the period.


    Thanks for the thought cycles!

    -Greg

  • Hi Greg,

    You are doing it the right way now. Our documentation is lacking here (and we just opened a bug for this)! The RunMode_DYNAMIC should only be used by the kernel's Clock module.

    Todd