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.

AM2634: RTI Timers are getting stooped in Debug Mode

Part Number: AM2634

Hi, I need help understanding why my timers stop running while debugging. We are using three different hardware timers in our code (500 µs, 1 ms, and 256 ms). During debugging, one of the timers eventually stops, and its interrupt flag is not getting cleared. We tried changing the stall mode (both ON and OFF), and it is currently set to ON, but the issue persists.

Can someone help me figure out why this is happening? and how to resolve

 

image.png

image.png

image.png


image.png

  • Hi,

    1. Can you please share the RTI register dump for all three RTI instances being used?

    2. May I know how do you confirm that the specific RTI2 is stopping.

    3. Can you share your example.syscfg file as well.

    Regards,
    Shaunak

  • Hi,

    i'm providing the related information.

    ->

    When the code functionality stops which is called in rti callback, I set a breakpoint to check whether the ISR is still being triggered or not. I also verified this by toggling three different pins and observing them on an oscilloscope. The issue doesn’t consistently occur on a specific timer like RTI2—instead, the behaviour is apply to other timers. Sometimes RTI1 and RTI2 stop, and other times a different combination of timers stops.

    ->

    static void Drivers_rtiOpen(void)

    {
    HwiP_Params rtiHwiParams;
    int32_t status;
    uint32_t baseAddr;
    uint64_t timeInNsec;
    uint32_t cntrPrescaler;
    uint32_t compPrescaler;

    baseAddr = CONFIG_RTI1_BASE_ADDR;

    /* Configure RTI input clock source */
    SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, MSS_RCM_PARTITION0);
    *(volatile uint32_t*)AddrTranslateP_getLocalAddr(CONFIG_RTI1_CLOCK_SRC_MUX_ADDR) = CONFIG_RTI1_CLOCK_SRC_WUCPUCLK;
    SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MAIN, MSS_RCM_PARTITION0);

    /* Enable/Disable Continue on Suspend */
    RTIG_setStallMode(baseAddr, RTI_GC_STALL_MODE_ON);

    /* Configure Counter block 0 */
    cntrPrescaler = (CONFIG_RTI1_INPUT_CLK_HZ/CONFIG_RTI1_CNTR0_OUTPUT_CLK_HZ) - 1;
    RTI_counterConfigure(baseAddr, RTI_TMR_CNT_BLK_INDEX_0, RTI_TMR_CLK_SRC_COUNTER, RTI_TMR_NTU_0, cntrPrescaler);
    RTI_captureConfig(baseAddr, RTI_TMR_CNT_BLK_INDEX_0, RTI_TMR_CAPTURE_EVT_0);


    /* Configure Compare event 0 */
    timeInNsec = CONFIG_RTI1_NSEC_PER_TICK_COMP0;
    if(timeInNsec == 0)
    {
    timeInNsec = CONFIG_RTI1_USEC_PER_TICK_COMP0 * 1000U;
    }
    compPrescaler = (timeInNsec*CONFIG_RTI1_COMP0_INPUT_CLK_HZ)/1000000000;

    RTI_compareEventConfig(baseAddr, RTI_TMR_CMP_BLK_INDEX_0, CONFIG_RTI1_COMP0_SRC, compPrescaler, compPrescaler);
    RTI_intStatusClear(baseAddr, RTI_TMR_INT_INT0_FLAG);
    HwiP_Params_init(&rtiHwiParams);
    rtiHwiParams.intNum = CONFIG_RTI1_INT_NUM_EVENT0;
    rtiHwiParams.callback = RTI1_event0Isr_1mSec;
    rtiHwiParams.isPulse = 0; // level Edge but we tried with pulse edge but same result
    rtiHwiParams.priority = 13;
    status = HwiP_construct(&gRtiEvent0HwiObj[CONFIG_RTI1], &rtiHwiParams);
    DebugP_assertNoLog(status==SystemP_SUCCESS);

    RTI_intEnable(baseAddr, RTI_TMR_INT_INT0_FLAG);

    RTI_intDisable(baseAddr, RTI_TMR_INT_DMA0_FLAG);


    baseAddr = CONFIG_RTI2_BASE_ADDR;

    /* Configure RTI input clock source */
    SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, MSS_RCM_PARTITION0);
    *(volatile uint32_t*)AddrTranslateP_getLocalAddr(CONFIG_RTI2_CLOCK_SRC_MUX_ADDR) = CONFIG_RTI2_CLOCK_SRC_WUCPUCLK;
    SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MAIN, MSS_RCM_PARTITION0);

    /* Enable/Disable Continue on Suspend */
    RTIG_setStallMode(baseAddr, RTI_GC_STALL_MODE_ON);

    /* Configure Counter block 0 */
    cntrPrescaler = (CONFIG_RTI2_INPUT_CLK_HZ/CONFIG_RTI2_CNTR0_OUTPUT_CLK_HZ) - 1;
    RTI_counterConfigure(baseAddr, RTI_TMR_CNT_BLK_INDEX_0, RTI_TMR_CLK_SRC_COUNTER, RTI_TMR_NTU_0, cntrPrescaler);
    RTI_captureConfig(baseAddr, RTI_TMR_CNT_BLK_INDEX_0, RTI_TMR_CAPTURE_EVT_0);


    /* Configure Compare event 0 */
    timeInNsec = CONFIG_RTI2_NSEC_PER_TICK_COMP0;
    if(timeInNsec == 0)
    {
    timeInNsec = CONFIG_RTI2_USEC_PER_TICK_COMP0 * 1000U;
    }
    compPrescaler = (timeInNsec*CONFIG_RTI2_COMP0_INPUT_CLK_HZ)/1000000000;

    RTI_compareEventConfig(baseAddr, RTI_TMR_CMP_BLK_INDEX_0, CONFIG_RTI2_COMP0_SRC, compPrescaler, compPrescaler);
    RTI_intStatusClear(baseAddr, RTI_TMR_INT_INT0_FLAG);
    HwiP_Params_init(&rtiHwiParams);
    rtiHwiParams.intNum = CONFIG_RTI2_INT_NUM_EVENT0;
    rtiHwiParams.callback = RTI2_event0Isr_500uSec;
    rtiHwiParams.isPulse = 0;
    rtiHwiParams.priority = 14;
    status = HwiP_construct(&gRtiEvent0HwiObj[CONFIG_RTI2], &rtiHwiParams);
    DebugP_assertNoLog(status==SystemP_SUCCESS);

    RTI_intEnable(baseAddr, RTI_TMR_INT_INT0_FLAG);

    RTI_intDisable(baseAddr, RTI_TMR_INT_DMA0_FLAG);

    baseAddr = CONFIG_RTI3_BASE_ADDR;

    /* Configure RTI input clock source */
    SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, MSS_RCM_PARTITION0);
    *(volatile uint32_t*)AddrTranslateP_getLocalAddr(CONFIG_RTI3_CLOCK_SRC_MUX_ADDR) = CONFIG_RTI3_CLOCK_SRC_WUCPUCLK;
    SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MAIN, MSS_RCM_PARTITION0);

    /* Enable/Disable Continue on Suspend */
    RTIG_setStallMode(baseAddr, RTI_GC_STALL_MODE_ON);

    /* Configure Counter block 0 */
    cntrPrescaler = (CONFIG_RTI3_INPUT_CLK_HZ/CONFIG_RTI3_CNTR0_OUTPUT_CLK_HZ) - 1;
    RTI_counterConfigure(baseAddr, RTI_TMR_CNT_BLK_INDEX_0, RTI_TMR_CLK_SRC_COUNTER, RTI_TMR_NTU_0, cntrPrescaler);
    RTI_captureConfig(baseAddr, RTI_TMR_CNT_BLK_INDEX_0, RTI_TMR_CAPTURE_EVT_0);


    /* Configure Compare event 0 */
    timeInNsec = CONFIG_RTI3_NSEC_PER_TICK_COMP0;
    if(timeInNsec == 0)
    {
    timeInNsec = CONFIG_RTI3_USEC_PER_TICK_COMP0 * 1000U;
    }
    compPrescaler = (timeInNsec*CONFIG_RTI3_COMP0_INPUT_CLK_HZ)/1000000000;

    RTI_compareEventConfig(baseAddr, RTI_TMR_CMP_BLK_INDEX_0, CONFIG_RTI3_COMP0_SRC, compPrescaler, compPrescaler);
    RTI_intStatusClear(baseAddr, RTI_TMR_INT_INT0_FLAG);
    HwiP_Params_init(&rtiHwiParams);
    rtiHwiParams.intNum = CONFIG_RTI3_INT_NUM_EVENT0;
    rtiHwiParams.callback = RTI3_event0Isr_256mSec;
    rtiHwiParams.isPulse = 0;
    rtiHwiParams.priority = 15;
    status = HwiP_construct(&gRtiEvent0HwiObj[CONFIG_RTI3], &rtiHwiParams);
    DebugP_assertNoLog(status==SystemP_SUCCESS);

    RTI_intEnable(baseAddr, RTI_TMR_INT_INT0_FLAG);

    RTI_intDisable(baseAddr, RTI_TMR_INT_DMA0_FLAG);


    }

    the below images contains state of INTflag when my rti stops, here rti1 and rti2 gets stopped.

    Regards,

    Gopala Lakshmana Swamy

  • Hi,

    Let me review and get back.

    Regards,
    Shaunak

  • HI,

    A few more questions:

    1. How long is your ISR logic? Generally huge ISR logics can cause delayed interrupt flag clearing and cause timing issues.

    2. Do you set breakpoints in your ISR? IF yes, this is expected,

    3. Can you verify each ISR calls the RTI_intStatusClear() flag.

    4. Can you confirm how many compare and counter events have you configured (i see 3 interrupts) and if you are clearing the interrupts for all of them.

    I believe unconfigured compare blocks 1, 2, 3 are generating spurious interrupts that never get cleared, causing interrupt controller lockup. Clear and disable all compare blocks at initialization, then only enable the one you're using.

    Regards,
    Shaunak

  • Hi,

    1. my isr contains only led blinking.

    2. if led blinking is stopped, then i'm setting breakpoint and verifying.

    3.yes, all 3 ISR calls  RTI_intStatusClear() inside ISR API.

    4.i've configured one compare and one counter events, clearing interrupt inside ISR API using HwiP_clearInt(). and meanwhile i will check by clearing unconfigured compare blocks

  • Can you please share your ISR code?

    Regards,
    Shaunak

  • HI, please find isr below.

    Regards,

    Gopala Lakshmana Swamy

  • Hi,

    I believe the issue is that we are only clearing INT0, not all flags, Try to clear all the possible flags instead of just INT0.

    Regards,
    Shaunak

  • Hi shaunak,

    thanks for your time.

    1) i made changes as you suggested in my isr, but still facing same issue.

    2) in my actual isr code, in 1ms timer i'm setting different flags and based on it i'm calling my functions. can i do it like that. and is it possible to hold my isr for extra time than iactual time it is taking.

    void SendData1ms_timer (void)
    {


    if((timerFlag.tmr16mSecFlags >> 0) & (0x01))
    {
    timerFlag.tmr16mSecFlags = (timerFlag.tmr16mSecFlags & 0xFFFFFFFE);
    ICMtimer1ms++;
    }

    }


    void SL_ICM_SER_IncreICMSyncTimer_100mSec(void)
    {
    // this function will get called by 100 mSec RTI timer


    if((timerFlag.tmr100mSecFlags >> 0) & (0x01))
    {
    timerFlag.tmr100mSecFlags = (timerFlag.tmr100mSecFlags & 0xFFFFFFFE);
    ICM_Handle.syncTimer ++;
    ICM_Handle.uiFrameMsgTmr_100mSec ++;
    ICM_Handle.hrtBeatMsgTmr_100mSec ++;
    ICM_Handle.msgDataTmr_100msec ++;
    }


    }

    as i shared above. i'm setting variable and based on the different bits state(0 or 1) i'm incrementing my funciton related flag . is that ok or any suggestion can i get.

     we cannot hold isr for more time and we have more function to be called in isr, so we followed this approach.

  • Hi,

    I am currently on business travel, Please allow me some time to get back.

    Regards,
    Shaunak

  • Hi,

    Is this issue still open? If yes, Can you please share your application for me to debug?

    Regards,
    Shaunak

  • Hi,

    It is still open , but i cannot share the application. its confidential.

    as of now we are using systick in place of timers.

    thanks & regards.

  • I'm unable to reproduce this using out of box examples.

    Regards,
    Shaunak