I have a problem when using PWM on SHARC core 1.
I have to control AC/DC converter (by appling switching duty cycle previously calculated from a simple PI) and there is point that I can't explain :
The program sequence in closed loop is simple :
-> Measure of output signal
-> Compute of controller
-> Applying duty cycle
The point is when I applying duty cycle, there a delay time for about 150us (4 sample in my case, the sampling frequency is 20kHz) between the first duty cycle and the first PWM output signal.
I am using AH AL BH and BL of the PWM1 with a breakout board, my switching frequency is 15kHz and the alpha is refresh by TIMER0 callback with this lines :
"adi_pwm_SetOutputDutyCycle(PWMnoPhaseShift, ADI_PWM_CHANNEL_A, ADI_PWM_HIGH_SIDE, DutyHmax, alphaH);
adi_pwm_SetOutputDutyCycle(PWMnoPhaseShift, ADI_PWM_CHANNEL_A, ADI_PWM_LOW_SIDE, DutyLmin , alphaL);
adi_pwm_SetOutputDutyCycle(PWMnoPhaseShift, ADI_PWM_CHANNEL_B, ADI_PWM_HIGH_SIDE, DutyHmax, alphaH);
adi_pwm_SetOutputDutyCycle(PWMnoPhaseShift, ADI_PWM_CHANNEL_B, ADI_PWM_LOW_SIDE, DutyLmin , alphaL);"
I have also instrumented my program and I can confirm that the problem doesn't come from calculation time (about 6us for measure, PI calculation and applying duty cycle).
Moreover this 150us delay seams to be fixed : I've tryed to change switching and sampling frequencies and the phenomenon is the same.
I think that I am far away of the processor maximum capabilities so there is probably something which I've missed.
Have you an idea help me please ? I think is the source of my controller dysfunctionalities.
Thank you very much.