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.

UCD3138: Fast interrupt about DPWM period interrupt

Part Number: UCD3138

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?

  • I agree that it doesn't make any sense.  I've certainly never seen any issue with this hardware function in my many years of working with the UCD.  The most likely cause is that some other DPWM3 interrupt is enabled, like a fault, for instance.  

    If you have multiple things enable on the DPWM3, you should look at the individual bits in the interrupt register to decide which is causing the interrupt.  If you're testing on an open loop board, it's easy for the inputs to float to a fault condtion.  

  • this has been waiting for more than a week,. I'm going to assume that the question was answered.