I am a beginner with PLECS, but I saw that it is possible to use the graphical blocks from TI to generate C code.
My goal is to obtain the waveform on EPWMA (like in the figure), using only the Action Qualifier features of the PWM block (dual output or single output if possible).
I would like to use CMPA to set the output and CMPB to reset it. However, I noticed that the AQ value is given as a scale.
Could someone explain how I should configure this properly?
Hi Issa, currently the waveform for ePWMA that you are talking about is not supported unfortunately. I’ve let the developers know about your request for a future TSP development effort.
From the documentation:
“When an AQ-based sequence is enabled, the sequence value directly defines the PWM actions at specific timebase and compare events. The AQ value provided as a parameter, or at the AQport, is written to both the AQCTLA and AQCTLB registers, with the distinction that CMPB related actions are masked from AQCTLA and, similarly, CMPA actions are masked from AQCTLB”
Couple of notes:
I’ve bolded the section in the help menu that talks about using the action qualifier to set the output. Currently there is no way to write the AQCTL A & B registers independently.
Additionally, the CMPB related actions are masked from AQCTLA (and vice versa) meaning that CMPB does not impact the waveform generated for ePWMA (and vice versa).
Hi Munadir, Thank you very much for your detailed response.
It seems I’ll have to implement part of my project in Code Composer Studio (CCS) and another part in PLECS to achieve the desired PWM behavior.
To avoid switching back and forth between CCS and PLECS, do you know if there is any solution or workflow that would allow me to import or create a custom library/block in PLECS so I can generate a single unified code for the full project.
Actually, you can use only half of the ePWM functionality.
If you use the Variable PWM block and then go to the Output tab, you can select either Fixed AQ or Variable AQ for the Sequence option (see the screenshot).
However, you can only configure the register for Comparator A (that is, CMPA or AQCTLA). Unfortunately, I also couldn’t find a way to configure the corresponding registers for Comparator B.
I also had to manually modify the C code generated by Plecs.