How to modify an existing Simulink TI C2000 ePWM block?

9 views (last 30 days)
I would like to change the ePWM up-down counting direction (PHSDIR) online on a synchronization signal and set the TBPHS parameter to the last TBCTR+1 value before synchronization. This apprach was suggested by TI support when I asked how to implement a different PWM algorithm.
Currently, in the ePWM block, a PHSDIR is hard-coded, i.e. I am not able to change direction (count-up or count-down) online and there is no TBCTR output.
#1
Is it possible, and how, to modify an existing Simulink TI C2000 ePWM block to get those two signals?
Thank you in advance.
Edit:
#2 (another approach)
After reading through a few more threads, one of the solutions could be using the Memory Copy block. The idea is to trigger the sequence to read ( from source):
EPwm1Regs.TBCTR // read the value
and then update (to destination):
EPwm1Regs.TBCTL.bit.PHSDIR // change direction
EPwm1Regs.TBPHS.half.TBPHS // update with TBCTR + 1
for ePWM1, etc.
In the block help, it says the address input expects either the decimal address or the address as a hexadecimal character vector.
How to know the address of EPwm1Regs.TBPHS.half.TBPHS? Is there a list of registers and memory addresses available?

Answers (0)

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by