This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TBPHS question

Can TBPHS be assigned a negative value and work properly? If TBPHS is higher than TBPRD in a up-down mode, what would happen?

And when the synchronization event initiated by the input synchronization signal (EPWMxSYNCI) happens? It happens once when I start the program or it happens every cycle?

Thank you!

  • Tao,

    A PWM can by synchronized, for PWM1, by the SYNCI pin or by upstream PWMs for the other PWM modules.  When the PWM receives the synch pulse it will load TBPHS into the TBPRD register and continue counting from there.  The direction of counting after a synch is determined by a register bit.

    Therefore:

    1) If you load TBPHS with a negative value I would expect that TBPHS will actually be treated as a very high positive number.  As with most things, this will only cause issues if you expect the PWM to do the something other than what you think :) .

    2) If TBPHS is higher than TBPRD, TBPRD will be loaded with TBPHS and continue counting from there.  At some point, the TBPRD will wraparound and after some time the PWM will again work by counting between 0 and TBPRD (assuming you get no more synch pulses).

    3) Synchronization happens each time a synch pulse goes to the PWM module.  (note that there is a register where you can choose to ignore every-other synch pulse, etc though)

    The EPwm User Guide for the specific device that you are using will have many more details on this.


    Thank you,
    Brett

  • First thank you, Brett!

    I was also encountering with another problem. The project is a converter of 20kHz frequency.The CCS sometimes show "power failure on target CPU" error when the output voltage of the converter gets higher than about 40V. However, the DSP is still working since the PWM are normal and close loop operation is fine. Only thing is the computer seemed having lost the communication with DSP. I was using Win7 x86 and tried both CCS 4 and the lastest CCS5.3. What is the possible cause of this problem and how can I solve it? Thanks a lot!

  • Tao,

    What are you using as your emulator? 

    One common issue that we see is one regarding isolation.  Often having the noisy ground of the converter and the ground of your computer tied together can cause issues (the potential for a large ground loop).  If your computer is a laptop I would try running the laptop from battery and see if you still lose connection.  Ideally, instead you'd use an isolated emulator or an emulator+isolation_adapter.

    If that isn't the problem, I would see if you have a pull-down resistor (~2.2kOhm) on the TRSTn pin.


    Thank you,
    Brett