Part Number: TMS320C6678
Other Parts Discussed in Thread: SYSBIOS
Tool/software: Code Composer Studio
Hello,
I'm using for my development a control board with a C2000 and a C6000 connected together. The trouble I have today is about a jitter I observed between the time the interruption should fire and the time it really fires.
To explain a bit my configuration:
The C2000 trigs the C6000 gpio via a supply translating transceiver, which is connected to GPIO12 on my C6000. In the C6000 code, there are currently 2 IT initialized, one for this GPIO, and one for a timer at 500µs.
These are initialized as follow, for the Interrupt vector table:
.ref _c_int00
.ref OS_Tick
.ref COMMCU_FastTrig
.ref _nmi_isr
.ref CANXCP_HandlerMCU
;------------------------------------------------------------------------------
; Fonctions
;------------------------------------------------------------------------------
.sect "IntTbl"
.align 1024
; Prevent assembler from using 16-bit compact instructions
.nocmp
RESET_RST:
MVKL .S2 _c_int00, B0
MVKH .S2 _c_int00, B0
B .S2 B0
NOP
NOP
NOP
NOP
NOP
NMI_RST:
MVKL .S2 _nmi_isr, B0
MVKH .S2 _nmi_isr, B0
B .S2 B0
NOP
NOP
NOP
NOP
NOP
RESV1:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
RESV2:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT4:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT5:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT6:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT7:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT8:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT9:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT10:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT11:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT12:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
INT13:
STW .D2 B0,*b15--[2] ; temp save b0 on stack
MVKL .S2 COMMCU_FastTrig,B0 ; load destination address to b0
MVKH .S2 COMMCU_FastTrig,B0
B .S2 B0 ; start branch to destination
LDW .D2 *++b15[2],B0 ; restore b0 register
NOP 2 ; fill 2 of b0 restore delay slots
NOP ; fill delay slot, pad packet
NOP ; fill delay slot, pad packet
INT14:
STW .D2 B0,*b15--[2] ; temp save b0 on stack
MVKL .S2 OS_Tick,B0 ; load destination address to b0
MVKH .S2 OS_Tick,B0
B .S2 B0 ; start branch to destination
LDW .D2 *++b15[2],B0 ; restore b0 register
NOP 2 ; fill 2 of b0 restore delay slots
NOP ; fill delay slot, pad packet
NOP ; fill delay slot, pad packet
INT15:
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
For the code itself:
//! Event related to the timer0
#define INT_kEVT_TIMER0 (64)
//! Event related to GPIO12
#define INT_kEVT_GPIO12 (86)
extern far unsigned int ISTP_START;
#pragma DATA_SECTION(INT_stCorePacRegs,"IntCorePacRegsFile");
volatile struct INT_tstCorePacRegs INT_stCorePacRegs;
extern __cregister volatile U16 TSR;
void INT_Init (void)
{
// Interrupt mux : Timer0 event to CPU INT14
INT_stCorePacRegs.INTMUX3.bit.INTSEL14 = INT_kEVT_TIMER0;
// Interrupt mux : GPIO12 event to CPU INT13
INT_stCorePacRegs.INTMUX3.bit.INTSEL13 = INT_kEVT_GPIO12;
// set Interrupt Service Table Pointer
ISTP = (unsigned int)(&ISTP_START);
IER |= (1<<1); // set NMIE
TSR |= (1) + (1 << 2); // set GEE + GIE
}
According to the datasheet, the IT13 should have a higher priority than the IT14, thus the GPIO IT should have a higher priority than the timer IT.
But when I observe the timing on an oscilloscope:
In yellow: the rise is the trig from the C2000 (set of GPIO), and the fall correspond to the end a calculation after the return data from C6000
In blue: the rise is the 1st thing done in the interrupt function, and the fall correspond to the end of calculation in the C6000.
As you can see, the jitter to up to 2.8µs, when you work at 40kHz, 2.8µs is a big deal.
I measured the timing of the timer interrupt function, it is about 100ns. Moreover, when I remove my timer IT, I have a correct behavior for the GPIO IT and the jitter disappears.
I also tried to placed the GPIO IT on INT15, I have the same behavior.
If the problem comes from the timer IT, why do I have a delay of 2.8µs with a timer interrupt function of 100ns ?
Any ideas how to remove this jitter ?
Regards,
Clément Leyssene