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.

TMDSDOCK28069: Creating precise output switching signals with dynamically controlled delays

Part Number: TMDSDOCK28069
Other Parts Discussed in Thread: C2000WARE
I am in need of a system that where I can provide multiple switching signals as a result of a single switching command. For example, if I have a switching command, I need three switching outputs, where output 2 is delayed from output 1 with D2 delay, and output 3 is delayed from output 1 with D3 delay. The delays should preferably be in the nanosecond range (the more precise the better). Also, the amount of delay (in terms of time or a counter of multiples of the clock highest precision) should be taken from the C code / Matlab and used for the upcoming switching actions, and these delays must be variables that can be changed online. The initial switching command in is not generated by a PWM, and there is no sinusoidal reference either. It's just a 0 or 1 signal generated by a specific code or from an external command. So the question is:
1. What is the best way to do this?
2. Wat is the best precision I could have?
3. Is there an example that does this or something similar to this?
BR,
Mohsen 
  • Hi Mohsen,

    1. What is the best way to do this?

    See responses below for the individual parts you mentioned

    For example, if I have a switching command, I need three switching outputs, where output 2 is delayed from output 1 with D2 delay, and output 3 is delayed from output 1 with D3 delay.

    You could achieve this through phase shifting. You can apply a phase shift value to EPWM2 and another phase shift to EPWM3 so that they get phase shifted from EPWM1. You can setup the synchronization scheme so that the sync signal goes from EPWM1 to EPWM2 to EPWM3

    2. Wat is the best precision I could have?

    The phase register (TBPHS) is 16-bits (you have to write an integer value to this). You are limited by the time base clock frequency (which is dependent on the epwm clock and the clock dividers - CLKDIV and HSPCLKDIV, as well as the count direction). The Technical Reference Manual (TRM) has some good examples show casing what happens when a phase is applied to an EPWM output. 

    The initial switching command in is not generated by a PWM, and there is no sinusoidal reference either. It's just a 0 or 1 signal generated by a specific code or from an external command

    You can change the value of the phase register at any point in your program. You'll need to figure out how the Matlab/c code that is generating these delay values can update this phase register. 

    3. Is there an example that does this or something similar to this?

    There is no example that does what you are describing but we do have EPWM examples that can serve as a starting point for you within C2000Ware.

    C:\ti\c2000\C2000Ware_version\device_support\f2806x\examples\c28

    Best Regards,

    Marlyn

  • Hi Marlyn,

    As the name implies, the EPWM creates a pulse width modulated signal. That is, it modulates a reference signal using a carrier waveform. That is not what I want. In my system, I need to define the instant when the main switching signal is given (think about for example a model predictive control algorithm). So it cannot come from a PWM carrier.  When that switching instant is given, then 3 switching signals (from 0 to 1) that are shifted in time (with a predefined shift) must be generated. The 3 signlas should remain high until I generate the falling command myself (not the PWM). The EPWM is carrier based (as shown in Fig.3-22 to Fig.3-25 of the TM) and does not allow this kind of controllability. How should I implement what I described?

    BR,

    Mohsen  

  • By external command you mean through SCI/SPI/CAN or some other module?

    You want to change the phase shift across your EPWM module when a new command comes in?

  • The main switching command can be generated internally (from the main code). But the three generated switching instances at the output ports must be accurately delayed with respect to each other. 

    The newly calculated delay must be applied in the next switching instance. The delay may be updated any time in-between switching instances.

  • Hi Mohsen,

    Using the trip zone submodule you can do a software force to put the epwm outputs into a certain specified state (into a high state for example). Whenever you choose to, you can do remove the software force on the epwms so that they resume normal operation.

    The newly calculated delay must be applied in the next switching instance. The delay may be updated any time in-between switching instances.

    You can choose the synchronization output event of EPWM1 to be fed to the rest of the EPWM modules, for example when the TBCTR of EPWM1=ZRO. Thus, every time EPWM1's TBCTR=0, the phase value written in the TBPHS register will be loaded to the time-base counter of EPWM2 and EPWM3 respectfully.

    Any configuration done with the trip zone submodule will override the time-base submodule, so the software force you set in the trip zone submodule will take precedence. 

    Best Regards,

    Marlyn