Hello everyone
I am currently trying to implement a control loop on a F28069. It is peak current mode control of a smps.
Basically, i am running the epwm with a specific frequency. I have then hooked up the comparator to pull the epwm low, whenever the current ramp from the current sense resistor is higher than the output of the DAC. The DAC is controlled by a compensator(PI), which is based on the output voltage of the converter. The pwm sends a SOC interrupt to the ADC whnever it is pulled down, in order to start the ADC sampling, and the ADC will also send an interrupt when it is done sampling(EOC).
The main question is about implementing the control loop. I am using the IQmath to do the calculations, and i need to do 5 multiplications. I am running the five multiplications in the main loop, and whenever the ADC SOC interrupts come on, move all samples one down the line(e[n] becomes e[n-1] and so on].
However, i feel that this solution is a bit strange and not optimal, in fact i cant get it working. I fear that the MCU is too slow to run those 5 multiplications before the interrupt comes on. How would i go about optimizing it, so i have the time for the control loop and other tasks? For instance, there is no sense in running the comparator calculations all the time. It should only be necessary to run it once, whenever the interrupt has been triggered. But placing the heavy multiplication code in the interrupt seems like a bad idea.
And how about the multiplication? I understand that IQmath is pretty fast, but i am stil concerned about the speed. Would there be a better way to implement the multiplications? I could ofcause implement the control loop in the CLA, but i would like to keep away from assembly if at all possible.
What are your thoughts on this? I have read an application note(SPRABE7), but there is really no actual example code.
What are your suggestions and ideas for making this run smooth?
Best regards Peter