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.

TMS320F28335: TMS320F28335 interrupts

Part Number: TMS320F28335

Hello All,

I am using  F28335 for firing pulses of an inverter. The inverter switching frequency is 100khz. I have some control computation that takes around 60-70 us and the ewpm interrupt comes at every 10 us. I asked something regarding that in an earlier post. Two solutions were given. I have some questions regarding them.

1)I was told to do handshaking between these two parts of code.i was told to set a flag when the computation completes, and then wrap my ePWM ISR in an "if" statement that checks if your flag is set, otherwise it just returns to your application code.

But i found  that once the pwm interrupt is enabled, the interrupt is executed even it is within an if statement and the condition given is not true. 

2) Also i was told to use two separate timers. One for CPU (60us) and one for epwm (10us). The cpu timer has higher priority than the epwm timer. So, how to sync the clocks of both the timers together ? Also what  when the 6th epwm interrupt arrives with the 1st CPU interrupt,will the control code get executed?

3) Also if I write my control code in an infinite ''for'' loop, then set set EPwm1Regs.CMPA.half.CMPA=duty ( duty is calculated from the control code) without using the epwm interrupt, will that work?

Regards



  • Hi,

    First of all, if a thread you create gets responses, it is best to continue the conversation in the same thread.  This is generally what we prefer.

    ===

    While it is possible to make things work without having synchronization between your PWM generator and your controller update, it isn't too difficult to make them synchronized in your situation - and therefore I'd recommend it.  Options 1-3 don't necessarily force this synchronization.  Options I'd consider:
    A) Instead of using a PWM and a CPUTimer, you could use two ePWMs.  The faster one would then be in charge of generating your PWM and the slower one can do your control loop & do your PWM update.  It is easy to synchronize two ePWMs together.  Also remember that you can use shadow loads to CMPA/CMPB registers.
    B) Use one PWM interrupt like you normally do.  You'd then split the control loop into 6-7 logical blocks and only run a portion of the control loop every PWM cycle.  After 6-7 interrupts, you'd write to the PWM registers.


    Thank you,
    Brett