F28335 100kHz ePWM control with ADC interrupt

28 views (last 30 days)
I am trying to control a converter with four switches at a switching frequency of 100 kHz with a F28335 Experimenter Kit, but I am having some trouble to execute the control algorithm at this speed.
I have synchronized the PWMs and the ADC following the steps mentioned in this link . As in this example, my control is executed every time there is an interruption of the ADC. In addition, I toggle a GPIO inside the subsystem interrupted by the ADC in order to observe the execution time of the control subsystem. I have noticed that even though I am synchronizing the PWMs and the ADC (switching at a 100 kHz frequency), the interrupted subsystem is slower than 100 kHz. Depending on the complexity of my control, the execution of the control slows down significantly (for example when I use HRPWMs instead of normal ones).
I guess my problem is that the board is not capable of executing my control algorithm at 100 kHz, but how can I improve this behaviour?
If I cannot avoid this problem, how can I configure the synchronization so that the ADC for example interrupts every 3 or 5 PWM cycles (i.e. reducing the frequency of the control algorithm)?
I would like to know the approximate execution time of my control because some functions depend on the sampling time.
Many thanks in advance!
By the way, I am using Matlab 2015a and CCS V6 to compile and build the Simulink control.

Answers (3)

Antonin
Antonin on 1 Mar 2017
Hi Eneko,
1) On the F28335, flash is much slower than RAM. You want the code running at 100kHz to execute from RAM, I explain how to take advantage of the ramfuncs section which loads in Flash but runs from RAM in this video at 8:10 https://www.youtube.com/watch?v=wxYTLbYfBP0&t=8m10s, I strongly encourage you to use this technique. Make sure to load the tic2000demospkg memory package on the configuration parameters before acting at the subsystem level.
2) Use standard optimization techniques in the 100kHz loop.
  • Prefer fixed-point and IQmath over floating point
  • Check inline parameters in the configuration parameters and mark constants with sample time "Inf".
  • Avoid divisions when possible
  • etc.
3) On the ADC block, make sure your ADC trigger is PWM and not "software" to avoid waiting for the conversion time
4) On the PWM block, on the "Event Trigger" tab, you can select "Number of events for start of conversion...". Firt event will trigger your ADC on every PWM event, second will do every other event, third will trigger the ADC conversion once every 3 events. This is an easy way to reduce the frequency at which you launch the ADC conversion without changing the PWM frequency.
5) Here are examples of models running at 200kHz:
I hope it helps, good luck!
Antonin.

Antonin
Antonin on 3 Mar 2017
Hi Eneko,
You are in control of the ADC conversion time. On the configuration parameters of your model, in the ADC parameters, notice that you can change the ADC clock and acquisition window size. This will determine how much time it takes to do the conversion and therefore how often you can trigger your ADC for a new conversion. Here are pages that will help you configure the best acquisition window size for your application:
I hope it helps,
Good luck,
Antonin.

Eneko Unamuno
Eneko Unamuno on 1 Mar 2017
Many thanks for your answer Antonin, I'll try to modify the program according to your comments. I have just one question, is there any way I can measure the frequency at which my ADC conversion is executing?
Best regards,
Eneko

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!