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.

AMIC110: Interrupt service routine

Part Number: AMIC110

Hello,

I am maintaining a section of legacy code, which is a DMTimer1_1ms and its overflow interrupt service routine.

NDK 3.61.1.01

SYS/BIOS 6.76.3.01

am335x PDK 1.0.17

The DMTimer1_1ms initialization is as below.

void DMTimer_init()
{
    HW_WR_REG32(CM_WKUP_TIMER1_CLKCTRL, 2); // Enable DMTimer1_1ms
    HW_WR_REG32(CM_CLKSEL_TIMER1MS_CLK, 0); // Clock source = CLK_M_OSC (25 MHz for A3-P)
    HW_WR_REG32(DMTIMER1_TIER, 2);  // Enable OVF interrupt
    HW_WR_REG32(DMTIMER1_TPIR, 0);  // No TPIR is needed for 24MHz
    HW_WR_REG32(DMTIMER1_TNIR, 0);  // No TNIR is needed for 24MHz
    HW_WR_REG32(DMTIMER1_TCRR, 0xFFFFA240);  // 24M/16K = -1500
    HW_WR_REG32(DMTIMER1_TLDR, 0xFFFFA240);  // 24M/16K = -1500
    Hwi_enableInterrupt(67);                // Enable DMTimer_1ms interrupt
    HW_WR_REG32(DMTIMER1_TCLR, 0x3);  // Enable timer and auto-load
}

The DMTimer_1ms overflow interrupt is enabled from this initialization.

The interrupt service routine is as below.

void MainLoop_1ms(UArg arg0)
{
    Isr_1ms_Routine_();
    HW_WR_REG32(0x44e31018, 2);  // Clear OVF interrupt flag
    return;
}

Now the timer works fine, and the interrupt service routine is called and works fine.

My question is that where and how the connection between MainLoop_1ms and the interrupt is.

Because I am going to use another timer to replace this 1ms timer, I know how to set the Int Number but don't how to connect to the function I create for this interrupt.

My previous experience of using 28235 is to map the funtion name to PIE Vector Table. It is like below, RoutineForTimer2 is the name I give for the interrupt service routine. From this mapping, we can know the connection between RoutineForTimer2 and the interrupt generated by timer2.

PieVectTable.TINT2   = (PINT) &RoutineForTimer2;

Come back to AMIC110, I am not able to know where and how this mapping is.

Thank you.

Kind regards,

Sandro

  • Hello Sandro,

    I'm not familiar with the code you have, but you can look at the timer example code in the PDK starterware folder: C:\ti\pdk_am335x_1_0_17\packages\ti\starterware\examples\dmtimer.

    The interrupt is set up as below:

    • INTCCommonIntrHandler() defined in starterware\soc\am335x\intc.c is the interrupt handler
    • INTCCommonIntrHandler() calls pIntrHandlers[activeIntrId]()
    • pIntrHandlers is set by INTCConfigIntr() which is called by DMTimerAppIntrConfig() of the timer example code

    You can build the timer example as below:

    C:\ti\pdk_am335x_1_0_17\packages>pdksetupenv.bat
    C:\ti\pdk_am335x_1_0_17\packages>cd ti\starterware
    C:\ti\pdk_am335x_1_0_17\packages\ti\starterware>gmake dmtimer_app_cdt PLATFORM=am335x-evm SOC=am335x PROFILE=debug

    Hope this is helpful.

    Regards,

    Jianzhong