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.

TMS570LC4357: Strange behavior of the RTI timebase interrupt(TBINT)

Part Number: TMS570LC4357


I am trying to use periodic interrupts with RTI.
TMS570 receives the clock edge via EXTCLKIN1 every 10ms.
I want the timebase interrupts to be occurred synchronously with the clock edge.
The initialization code is as follows.

RTICAPCTRL = 0U | 0U;

/* COMPSEL2 = RTIFRC1 */
rtiREG1->COMPCTRL = (1 << 8);

/* initialize counter */
RTIUC0 = 0x00000000U;
RTIFRC0 = 0x00000000U;
RTITBCTRL = 0x00000000U;

/* NTU source (NTU3:EXTCLIKIN1) */
RTIGCTRL = (u32_t)0xFU << 16U;

/* setup TB compare register */
RTICPUC0 = NTU_CLK_CNT; /* 10ms */
RTITBLCOMP = NTU_CLK_CNT - WINDOW_WIDTH / 2;
RTITBHCOMP = WINDOW_WIDTH / 2;

RTITBCTRL = 0x00000003U;

It did not work. No interrupt was occurred.
I try to change RTITBLCOMP and RTITBHCOMP as follows.

RTITBLCOMP = NTU_CLK_CNT / 2; /* 5ms */
RTITBHCOMP = NTU_CLK_CNT / 2;

Then timebase interrupt is delayed by 5ms with respect to the clock edge.
In another case:

RTITBLCOMP = 1;
RTITBHCOMP = 1;

It seems work correctly.
(I haven't tested the case of missing clock.)

It does not work with the settings according to the datasheet(spnu499c.pdf).
Is this the right behavior?