I want to enable fast interrupt of dpwm period interrupt. The initialize code is as follow:
Dpwm3Regs.DPWMINT.bit.PRD_INT_SCALE = 0x04;/* generate an interrupt on each 16 switching cycles(used to reset the integrator) */
Dpwm3Regs.DPWMINT.bit.PRD_INT_EN = 1;
LoopMuxRegs.GLBEN.all|= 0x008; /* enable dpwm3 */
Dpwm3Regs.DPWMCTRL0.bit.PWM_EN = 1;disable_interrupt();
disable_fast_interrupt(); /* make sure fast interrupt is disabled */
write_reqmask(CIMINT_ALL_PWM2_COMP|CIMINT_ALL_FAULT_MUX|CIMINT_ALL_DPWM3); /* enable pwm2cmp and DPWM0 interrupt(End of 16th period)(int-priority29) */
write_firqpr (CIMINT_ALL_FAULT_MUX|CIMINT_ALL_DPWM3); /* DPWM0 interrupt(End of 16th period) is mapped to FIQ */
enable_fast_interrupt();
enable_interrupt();
I set debug pin toggle in the fast interrupt. The code is as follow:
fir_index = CimRegs.FIQIVEC.all;
if(fir_index == 27) // Index = N-1 = 26 DPWM
{
MiscAnalogRegs.GLBIOVAL.bit.ADC_EXT_TRIG_IO_VALUE ^= 1;
Dpwm3Regs.DPWMINT.bit.PRD_INT_EN = 1; //clear interrupt flag
}
But I found that the debug pin toggle time is not 6.25*4 = 25us and it is about 4us. The switch frequency is 160KHz. why? In detasheet, the switching cycles is not the switch frequency?