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.

F28069M GPIO Toggle Doesn't Generate Even Waveform

I'm testing my code on DRV8312EVM with F28069M controlCard.

In device initialization, GPIO12 is configured as GPIO output. In a 10 kHz ISR, I toggle GPIO12 once by executing the line below

GpioDataRegs.GPATOGGLE.bit.GPIO12 = 1;

and nowhere else GPIO12 is touched. Surprisingly, the waveform on GPIO12 was not a 50% duty cycle waveform, instead, about 10% duty cycle waveform, see screenshot attached.

Please advise why.

toggle GPIO12.tif
  • Hi Louis,

    I would like you to provide us a rough structure of your code with ISR you're talking about.

    Regards,

    Gautam

  • Hi Gautam,

    I use ePWM1 CNT_PERIOD to generate SOC for ADC, ePWM1 frequency is 20 kHz, but SOC is generated on 2nd event, and use EOC10 from ADC for interrupt source.

    The uneven waveform was shown when INTSEL1N2.INT1CONT = 1, although I cleared ADCINT flag in ADCINT1_ISR.

    ADCINTFLAGCLR.ADCINT1 = 1;

    After changing to INTSEL1N2.INT1CONT = 0, the toggling waveform shows 50% duty ratio, however, the frequency of the toggling waveform is half of previous one.

    I'd appreciate if you have an idea while I'm going to analyze it too.

  • I figured out what was the cause. I had EPWM1 AQCTLA initialized with 0x0060. Then, because CMPA was 0, the eWPM1 output was forced to high when CTR = ZERO, then at CTR = PERIOD, it toggles, that's why the  waveform shows 20 kHz. If AQCTLA is set to 0, the waveform shows 10 kHz.

    Thanks!

  • Sorry Louis, somehow this post of yours got missed.

    I figured out what was the cause.

    That's great! Verify your answer and close this thread.

    Goodluck & Regards,

    Gautam