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.

TMS320F28027F: Difference between timer emulation modes

Other Parts Discussed in Thread: C2000WARE

I used an interrupt on timer2 to create a 1ms tick counter in my application, and everything works, but one parameter leaves me puzzled. I tried out all 3 of the timer emulation modes (TIMER_EmulationMode_StopAfterNextDecrement, TIMER_EmulationMode_StopAtZero, TIMER_EmulationMode_RunFree), and all of them seem to result in exactly the same behavior. So I was wondering, what is the difference between them? Both in how they function and what the implications are.

For example, does TIMER_EmulationMode_StopAtZero wait until the interrupt is cleared before the timer resumes operation? Does it mean that if it's a heavy interrupt or there are other interrupts being processed when it occurs, the timer might be imprecise? Would it mean that TIMER_EmulationMode_RunFree might result in some ticks being lost under these conditions?

  • Dimitri,

    More information on the TIMER module can be found in the F2802x Driver Library User's Guide (http://www.ti.com/lit/ug/spruhx9/spruhx9.pdf) on page 282.

    Regards,

    Ozino

  • That was one of the first things that I looked at. It just rephrases the variable name. Not very informative.

  • Have you had a chance to look over the CpuTimer example in C2000Ware? That example uses timers with interrupts. Additionally, you can also reference the TRM chapter 1.3.5 32-Bit CPU Timers and to take a look at the register descriptions.

    -Ozino

  • Dimitri,

    As already referenced by Ozino, the emulation control bits 'FREE' and 'SOFT' located in the TIMERxTCR register on page 84-85 in the F2802x Technical Reference Manual are used to control the emulation halt behavior during debug.  These emulation bits also exist in other peripherals too, such as the ePWM module (to control the time-base counter), eCAP module (to control the time-stamp counter), DAC (to control the ramp generator), and SPI & SCI & I2C (to control data communication).  The FREE and SOFT bit might perform slightly different functions depending upon the peripheral, but they essentially operate very similar.  During debug with the debug probe (i.e. emulator) connected to the device the user has the capability to halt the code at a breakpoint and, for example, have the peripheral continue running or stop at a specified state (e.g. counter equals zero or perhaps a period match).  This could be useful when trying to isolate problems.  Using the ePWM module as an example, code execution could be halted, but at the same time the waveform can still be generated on the output pin.  This can easily be experienced while running CCS and halting at a breakpoint while the waveform is continuously being displayed on an oscilloscope.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken

  • So it only makes a difference for debugging, but when simply running the application, there should be no difference. Is that correct?

  • Dmitri,

    Correct.  Also, this type of debugging is typically done with real-time emulation mode.

    - Ken