Hello everyone!
I'm using ePWM SOC trigger to start ADC convertion on CTR = PRD. I'm using TMS320F28035.
EPwm2Regs.ETSEL.bit.SOCAEN = 1; // Enable SOC on A group
EPwm2Regs.ETSEL.bit.SOCASEL = 4; // Select SOC from CTR=PRD
EPwm2Regs.ETPS.bit.SOCAPRD = 1; // Generate pulse on 1st event
It used to work well, but now sometimes PWM counter stops running and as a result it stops triggering SOC. I tried to find out the reason and first I thought that it happens because of the SWFSYNC impulse, 'cause according to the algorithm I use SWFSYNC either in Timer0 isr or in external interrupt isr. Which of those isr will generate the SWFSYNC depends on external signal switch. I have a signal that goes to the comparator and output of the comparator is connected to the external interrupt input pin. So, if I have a signal on the comparator greater than the reference from internal DAC, once during the signal period I have an external interrupt and this isr generates SWFSYNC. If this interrupt doesn't fire for some defined period of time, I have a Timer0 interrupt, which also calls SWFSYNC. So, when I'm switching ON or OFF the signal on the comparator input, the ePWM module stops working. I use SWFSYNC the same way in both isr so it doesn't explain the problem. This signal switching can be followed by some EMI. But as I know the PWM counter can be stopped only by changing the value of CTRMODE register, which is EALLOW protected...
Can anyone give any advice?