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.

MSPM0G3507: Precisely measuring period despite TIMER_ERR_01 errata

Part Number: MSPM0G3507


<p>I'm working on an application that needs to precisely measure the period a very fast incoming pulse train (on the order of tens of microseconds).</p>
<p>While working on this, I came across "TIMER_ERR_01" as described <a href="../lit/er/slaz742d/slaz742d.pdf?ts=1763564998637&amp;ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FMSPM0G3106">here</a>.</p>
<p>Does this mean that the timer is incapable of automatically resetting itself?</p>
<p>Following the example timx_timer_mode_capture_duty_and_period, I wrote this:</p>
<pre class="language-c"><code>uint32_t hw_freq_get_period((GPTIMER_Regs * instance)
{
    // See TIMER_ERR_01 errata.
    DL_TimerG_setTimerCount(instance, 0);

    return DL_TimerG_getCaptureCompareValue((GPTIMER_Regs *) instance, DL_TIMER_CC_1_INDEX);
}</code></pre>
<p>If I feed this a steady square wave, I get a consistent result, however if I add any code before setTimerCount, I get a slightly different result.</p>
<p>Is there any way to implement this where the period counter is not affected by firmware execution?</p>

  • Hi Michael,

    The current workaround for this issue will be impact by the time we reload Timer counter. There is an idea for your reference to reduce this impact: (assume we are using a down counting mode, and the counter load value is L)

    • When a capture event occurs (the counter is C at this time), ideally we want to achieve the counter reload at this time by hardware, but as the Errata(SLAZ742D) descripted, we could not capture the counter and reload the counter at the same time in hardware. So we need to reload counter in software.
    • By there is a time delay from the capture event (counter = C) and the time we reload counter by software (counter = R), so when we reload the timer counter , we could reload the counter as L - (C-R). In this way, it has the same effect that timer counter is load as L at the time capture event.
  • Alternatively: Don't restart the counter at all. Instead, set the LOAD value to -1 [to make the arithmetic easy] and subtract successive capture values.