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.

LAUNCHXL-TMS57004: CCS/LAUNCHXL-TMS57004: TWO RTI TIMER for TMS570

Part Number: LAUNCHXL-TMS57004
Other Parts Discussed in Thread: TMS570LS3134

Tool/software:

Hello,

I am using TMS570LS3134 as hardware.

I use Compare0 as a counter with 1ms intervals.

I want to use Compare1 for Watchdog NMI. (DwwdInit(GENERATE_NMI, preloadValue, SIZE_100_PERCENT);)
For this, I first tried to use Compare0 as a 1ms and Compare1 as a 5ms counter.
Compare0 occurs every 1ms, but Compare1 does not.
In other words, my taskComp0 function repeats every 1ms, but I cannot reach my taskComp1 function under any circumstances.
I think I have a similar problem with this title, but I cannot see the solution.
My codes are below.
I would be very happy if you could help me.

// in TMS_RTI.c file


void RtiInit(void)
{
RTIGCTL.All = 0U;
RTI->GCTRL = RTIGCTL.All;

RTITBCTRL.All = 0U;
RTI->TBCTRL = RTITBCTRL.All;

RTICAPCRTL.All = 0U;
RTI->CAPCTRL = RTICAPCRTL.All;

RTICOMPCTRL.Bits.COMPSEL3 = 1U;
RTICOMPCTRL.Bits.COMPSEL2 = 1U;
RTICOMPCTRL.Bits.COMPSEL1 = 0U;
RTICOMPCTRL.Bits.COMPSEL0 = 0U;
RTI->COMPCTRL = RTICOMPCTRL.All;

RTIUC0.All = 0U;
RTI->CNT[0].UCx = RTIUC0.All;

RTIFRC0.All = 0U;
RTI->CNT[0].FRCx = RTIFRC0.All;

RTICPUC0.All = 7U;
RTI->CNT[0].CPUCx = RTICPUC0.All;

RTIUC1.All = 0U;
RTI->CNT[1].UCx = RTIUC1.All;

RTIFRC1.All = 0U;
RTI->CNT[1].FRCx = RTIFRC1.All;

RTICPUC1.All = 7U;
RTI->CNT[1].CPUCx = RTICPUC1.All;

RTICOMP0.Bits.COMP0 = 10000U;
RTI->CMP[0].COMPx = RTICOMP0.All;

RTIUDCP0.Bits.UDCP0 = 10000U;
RTI->CMP[0].UDCPx = RTIUDCP0.All;

RTICOMP1.Bits.COMP1 = 50000U;
RTI->CMP[1].COMPx = RTICOMP1.All;

RTIUDCP1.Bits.UDCP1 = 50000U;
RTI->CMP[1].UDCPx = RTIUDCP1.All;

RTICOMP2.Bits.COMP2 = 80000U;
RTI->CMP[2].COMPx = RTICOMP2.All;

RTIUDCP2.Bits.UDCP2 = 80000U;
RTI->CMP[2].UDCPx = RTIUDCP2.All;

RTICOMP3.Bits.COMP3 = 100000U;
RTI->CMP[3].COMPx = RTICOMP3.All;

RTIUDCP3.Bits.UDCP3 = 100000U;
RTI->CMP[3].UDCPx = RTIUDCP3.All;

RTIINTFLAG.All = 0x0007000FU;
RTI->INTFLAG = RTIINTFLAG.All;

RTICLEARINTENA.All = 0x00070F0FU;
RTI->CLEARINTENA = RTICLEARINTENA.All;

}


#pragma CODE_STATE(rtiCompare0Interrupt, 32)
#pragma INTERRUPT(rtiCompare0Interrupt, IRQ)

void rtiCompare0Interrupt(void)
{
RTI->INTFLAG = 1U;
rtiNotification(RTI_NOTIFICATION_COMP0);
}


#pragma CODE_STATE(rtiCompare1Interrupt, 32)
#pragma INTERRUPT(rtiCompare1Interrupt, IRQ)

void rtiCompare1Interrupt(void)
{
RTI->INTFLAG = 2U; // TODO 1U; ?
rtiNotification(RTI_NOTIFICATION_COMP1);
}

// in TMS_VIM.c file

static const t_isrFuncPTR s_vim_init[96U] =
{
&phantomInterrupt,
&esmHighInterrupt, /* Channel 0 */
&phantomInterrupt, /* Channel 1 */
&rtiCompare0Interrupt, /* Channel 2 */
&rtiCompare1Interrupt, /* Channel 3 */
&phantomInterrupt, /* Channel 4 */
&phantomInterrupt, /* Channel 5 */
.
.
.
}

// in TMS_RTI_Init.c file

RtiEnableNotification(RTI_NOTIFICATION_COMP0);
RtiEnableNotification(RTI_NOTIFICATION_COMP1);
_enable_IRQ();
RtiStartCounter(RTI_COMPARE0);
RtiStartCounter(RTI_COMPARE1);

// in main.c file

void rtiNotification(NotificationCompare notification)
{
if(notification == RTI_NOTIFICATION_COMP0)
{
taskComp0();
}

if(notification == RTI_NOTIFICATION_COMP1)
{
taskComp1();
}
}

  • Hi ,

    Apologies for the late response.

    Can you please refer below attached project once:

    4237.SCI_AND_LED_Blink_TEST_LS3137.zip

    Here i enabled both compare-0 and compare-1 interrupts and i am getting both the interrupts. So please refer this project configurations and code and do the modifications in according to it.

    --
    Thanks & regards,
    Jagadish.

  • Hi Jagadish,
    Thank you for your answer and sorry for taking your time. Actually I realized my mistake the day after I wrote the question but I didn't get a chance to write the answer here.

    // in TMS_VIM.c file
    VIM->REQMASKSET0 = (u32)((u32)1U << 0U)
    | (u32)((u32)1U << 1U)
    | (u32)((u32)1U << 2U)
    | (u32)((u32)0U << 3U)
    .
    .
    .
    | (u32)((u32)0U << 31U);

    Although I defined an interrupt for compare1 in channel 3 in TMS_VIM.c file, I forgot to enable this interrupt in VIM->REQMASKSET0.

    My problem was solved when I corrected the above code as follows.

    // in TMS_VIM.c file
    VIM->REQMASKSET0 = (u32)((u32)1U << 0U)
    | (u32)((u32)1U << 1U)
    | (u32)((u32)1U << 2U)
    | (u32)((u32)1U << 3U)
    .
    .
    .
    | (u32)((u32)0U << 31U);

    Thanks for your time and your answer.