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.

TMS320F280025: Spurious interrupts after HWBIST test

Part Number: TMS320F280025
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Hello,

I am working with the TMS320F280025 microcontroller and the Safety Diagnostic Library v4.01.00. I am currently experiencing the following issues:

1. After each execution of the HWBIST micro-run test, an unexpected Timer 2 interrupt is triggered.
2. Occasionally, after the HWBIST micro-run test, I have to manually clear the acknowledge bits of the PIE interrupt group, as if spurious interrupts are being generated.

Are these behaviors expected?  
Is there a recommended way to prevent or handle these issues?

Thank you in advance for your support.

  • Andrea,

    Apologies for the delay, I'm looking into this and will give a reply by the end of the week.

    Best,

    Matthew

  • Andrea,

    This looks related to this errata:

    https://www.ti.com/document-viewer/lit/html/SPRZ466C#GUID-35E690A0-2BAA-4D53-BED0-70FD566B84E7/GUID-46C92F20-5B89-40A5-84A5-7FEAF9C7A2A3

    However, after talking with the SDL owner the workaround mentioned in the errata should be included in SDL V4.01 you are using.

    Can you look for this inside the stl_hwbist_s.asm file to verify you see something similar to what is mentioned in the errata?

    Best,
    Matthew

  • Hello Matthew,

    I confirm that the workaround mentioned in the errata is included.
    Anyway, my issue seems to be different from the one described, because the Timer 2 interrupt is triggered on every execution, and PIE interrupts are also involved.

    Best,

    Andrea

  • Any updates?

  • Andrea,

    I'm currently trying to reproduce #1 above; some more questions from my side:

    Can you provide both the System clock setting(i.e. 120MHz, or something else) that you are running at, as well as the main clock source.  The default here is INTOSC2.

    2. Occasionally, after the HWBIST micro-run test, I have to manually clear the acknowledge bits of the PIE interrupt group, as if spurious interrupts are being generated.

    Can you also provide which PIE IFRs are getting set? 

    Are these interrupts that you would expect in your normal code execution, or completely unrelated to your application?

    If the answer to the above is yes, are the modules involved kept running while HWBIST is executing or have those been disabled?

    Best,

    Matthew

  • Hello Matthew,

    1. The SYSCLK is running at 100 MHz, derived from an external crystal oscillator (XTAL) using the following PLLSYSCLK configuration: 12 MHz (XTAL_OSC) × 50 (IMULT) / [2 (REFDIV) × 3 (ODIV) × 1 (SYSDIV)].
      Timer 2 is clocked from INTOSC1 with a prescaler of 1 and is configured to generate an interrupt every 500 ms.
      STL_HWBIST_runMicro() is executed every 55 µs. After each execution of STL_HWBIST_runMicro(), I observe a Timer 2 ISR being triggered.

    2. The PIE IFRs correspond to interrupts that are enabled and may occur during the execution of the HWBIST test.
      After further investigation, it seems (though it's not certain) that the issue only arises when an interrupt event occurs during the HWBIST execution.
      In such cases, it's necessary to call Interrupt_clearACKGroup() (as shown in the code below), otherwise the corresponding ISR is no longer triggered.

    The code is something like the following:

    // ADC ISR
    interrupt void ADC_ISR(void)
    {
        // Some code...
        
        // Acknowledge interrupt group 1 to allow further interrupts from this group
        Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP1);

        // Some code...

        // Execute HWBIST micro-run
        STL_HWBIST_runMicro();

        // Some code...

        // This Acknowledge should not be necessary
        Interrupt_clearACKGroup(HWREGH(PIECTRL_BASE + PIE_O_ACK));
    }

    Best,

    Andrea

  • The PIE IFRs correspond to interrupts that are enabled and may occur during the execution of the HWBIST test.
    After further investigation, it seems (though it's not certain) that the issue only arises when an interrupt event occurs during the HWBIST execution.
    In such cases, it's necessary to call Interrupt_clearACKGroup() (as shown in the code below), otherwise the corresponding ISR is no longer triggered.

    Andrea, thanks for this; from our side this is expected behavior, the HWBIST will log all interrupts that occur during HWBIST execution to a buffer and then restore them back to the system after execution has finished.  https://www.ti.com/lit/an/spraca7a/spraca7a.pdf (page 5) 

    I will use your settings on #1 above to see if I can replicate this behavior on my device.

    Best,
    Matthew

  • Andrea,

    I believe I have the answer, there is an assumption in the stl_hwbist_s.asm file that the user is clearing the TIF(Timer Interrupt Flag) bit 15 inside the timer ISR.  However, clearing the TIF bit is not absolutely necessary for repeated timer ISRs, so I would need you to check to see if this is being done in your Timer 2 ISR. 

    If TIF is not cleared, then you will get a Timer 2 INT on every HWBIST run(which is what you are seeing).Potentially this could happen even if you are clearing the bit, but that would assume the timer 2 period is ~same as the time between your micro runs, and I don't think this is the case.

    Here's the background:

    Before we enable interrupt logging before the HWBIST micro-run we save off the state of the timer1 and timer2 TCR regs(which contain the TIF and the TIE(Timer Interrupt Enable), before clearing the TIE bit to avoid spurious ISRs as we noted above

            MOVW    DP, #TmrRegs
            MOV     AL, @TMR1TCR            ; Save TCR registers in the ACC
            MOV     AH, @TMR2TCR
    
            AND     @TMR1TCR, #~(3 << 14)   ; Clear TIE bit without clearing TIF
            AND     @TMR2TCR, #~(3 << 14)   ; Clear TIE bit without clearing TIF
    
            EALLOW
    
            MOVW    DP, #HWBRegs
            MOVW    @CSTCGCR3, #0x0A        ; Start logging interrupts

    Now, when we come back to context restore from the micro run we re-look at the stored versions of the TCR regs in the following code.

       ; Restore the CPU Timer 1 & 2 interrupt enable status. If the TCR.TIF bit
        ; is set and interrupts were enabled force the corresponding bit in IFR.
        ;
            MOVW    DP, #TmrRegs
    
            TBIT    AL, #14             ; Branch if TIE wasn't set
            SB      noEnableTIE1, NTC
    
            TBIT    @TMR1TCR, #15       ; Branch if TIE was set, but TIF isn't
            SB      enableTIE1, NTC
            OR      IFR, #(1 << 12)     ; Set the IFR flag for INT13
    
    enableTIE1:
            MOV     AL, @TMR1TCR        ; Reenable CPU Timer 1 interrupts
            AND     AL, #~(1 << 15)     ; TIF is W1C, so take care not to clear it
            OR      AL, #(1 << 14)
            MOV     @TMR1TCR, AL
    
    noEnableTIE1:
            TBIT    AH, #14             ; Check if TIE was set
            SB      noEnableTIE2, NTC
    
            TBIT    @TMR2TCR, #15       ; Branch if TIE was set, but TIF isn't
            SB      enableTIE2, NTC
            OR      IFR, #(1 << 13)     ; Set the IFR flag for INT14
    
    enableTIE2:
            MOV     AL, @TMR2TCR        ; Reenable CPU Timer 2 interrupts
            AND     AL, #~(1 << 15)     ; TIF is W1C, so take care not to clear it
            OR      AL, #(1 << 14)
            MOV     @TMR2TCR, AL
    
    noEnableTIE2:

    If the TIE bit wasn't set(meaning the user was not using the Timer Interrupt) we skip to the next timer since we don't care about the TIF(and based on how the timers work, these are enabled from reset, so even if not used TIF will be set).

    In your case, since Timer 1 isn't used we skip it and move on to Timer 2.

    Now, since Timer 2 had TIE set, we fall through and then proceed to evaluate bit 15, TIF.  If it was set before we started the HWBIST, the assumption is that we caught it before the ISR was serviced, so it needs to be serviced when we return.

    If the user is not intentionally clearing the TIF in the Timer 2 ISR, then this bit will always be set; and as such the ASM code will manually set the IFR bit corresponding to the Timer 2.

    So, we have two options:

    1)Clear the TIF bit in the Timer 2 ISR.  I think this is the simplest

    2)Change the code stl_hwbist_s.asm to intentionally clear the TIF bit as part of the context save.  The worst this does it delay the timer 2 ISR by one timer 2 period.  The drawback here is that we have to re-compile the stl_diagnostic.lib, since the ASM file is part of that library.  The project does exist in C2000Ware, so its not too difficult, but an extra step depending on how you want to proceed.

    Best,
    Matthew