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();
}
}