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.

Possible AM335x hardware synchronization issue with DMTimer1_1MS

Dear TI Development Team

It looks like I found a problem with the 1ms DMTimer. If you clear the overflow flag too early (DMTIMER_1MS_TISR_OVF_IT_FLAG), it looks like the interrupt is fired twice. If a insert a small loop after the timer interrupt is cleared, everything works perfectly as expected!

The timer is configured as recommend in the technical reference manual, please see also this post: e2e.ti.com/.../1316813

Configuration:

TPIR = 232000

TNIR = -768000

TLDR = 0xFFFFFFE0

Clock source: PER PLL @32768KHz (CLK_32KHZ)

ARM Chip Frequency: 600MHz

Osciloscope:

A) Bad Duty Cycle:

B) Good Duty Cycle (with the delay):


Source code:

static bool debugPinState = false;
extern "C" void TINT1_1MS_IRQHandler(void) {
    debugPinState = !debugPinState;
    GPIO_Write(GPIO1, PIN30, debugPinState);

    const uint32_t tocr = DMTimer1ms_GetTimerOverflowCount();
    if (tocr > 0) {
        // This hardware bug appears in the 1-ms tick generation section of the GPTIMER blocks on some OMAP3530 chips.
        // Source: e2e.ti.com/.../297061.aspx
        DMTimer1ms_ClearTimerOverflowCount();
    }
    
    // Clear interrupt flag
    DMTimer1ms_AcknowledgeInterrupt();
    
    // Looks like there is a synchronization issue in hardware: when the timer interrupt is cleared, and the interrupt handler returns too early, the interrupt is fired twice.
    volatile uint32_t delayCounter = 0U;
    while(delayCounter < 50U) {
        ++delayCounter;
    }
}