Other Parts Discussed in Thread: CONTROLSUITE
Hi, I'm currently doing a 1024 pts FFT on F28377S Launch Pad. While the main body of the function is finished and tested successful, I would like to benchmark its performance using the CPU timer. My thought is that I set two break points and use two variable to get the time difference before and after the function I want to test.
However, even though the setup and relevant files are copied from the given example (controlSUITE), it does not successfully set the CPU timer period, and my variables don't get any value from the CPU timer registers.
Here is my setup:
InitSysCtrl(); InitGpio(); GPIO_SetupPinMux(65, GPIO_MUX_CPU1, 0); GPIO_SetupPinOptions(65, GPIO_OUTPUT, GPIO_PUSHPULL); DINT; InitPieCtrl(); // Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000; InitPieVectTable(); EALLOW; // This is needed to write to EALLOW protected registers PieVectTable.TIMER0_INT = &cpu_timer0_isr; EDIS; // This is needed to disable write to EALLOW protected registers InitCpuTimers(); // 200MHz CPU Freq, 1 second Period (in uSeconds) ConfigCpuTimer(&CpuTimer0, 200, 1000000); CpuTimer0Regs.TCR.all = 0x4000; // Use write-only instruction to set TSS bit = 0 IER |= M_INT1; // Enable TINT0 in the PIE: Group 1 interrupt 7 PieCtrlRegs.PIEIER1.bit.INTx7 = 1; // Enable global Interrupts and higher priority real-time debug events: unsigned long t1 = 0; unsigned long t2 = 0; /*//////////////////DONE SETUP//////////////////////*/
In my main function, I use the following to get time (which somehow doesn't work at all):
float delta = 0; t1 = CpuTimer0Regs.TIM.all; CFFT(&cfft); //my function t2 = CpuTimer0Regs.TIM.all; delta = ((float)t1-(float)t2)/200000000 ;
Before main function I also have:
__interrupt void cpu_timer0_isr(void)
{
CpuTimer0.InterruptCount++;
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
It turns out that the CPU timer period are not set correctly, and the value of t1, t2 and delta are always 0. Could anyone help me with it? Greatly appreciated!