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.

UCD3138 External SYNC between multiple DPWM modules

Other Parts Discussed in Thread: UCD3138

I'm having a problem with external sync.  I'm using DPWM modules 0, 1, and 3, and they are all used to control various parts of the same converter.  They are all synced to the external sync on pin 21 (UCD3138RMH).  The problem is this: there seems to be an internal race from pin 21 to each of the individual modules that causes uncertainty in their relative timing.


Let me explain.  Say, for example, that the rising edges of DPWM0A and DPWM1A are set to be 16ns apart, with 1 following 0, shortly after the sync signal.  Most of the time, there is no problem.  Occasionally, however, the SYNC signal will reset DPWM0 close enough to the internal clock's increment that it's still propagating to DPWM1 while that increments.  This means that DPWM1 isn't reset by sync with DPWM0, but that it's reset 1 cycle (4 ns) later.  It will run 1 PWM cycle this way and then (usually) become synced with DPWM0 again on the next rising edge of pin 21.


The observed effect is much simpler than the explanation: If I set two edges in two different DPWM modules to be (e.g.) 16 ns apart, then they will be 16 ns apart most of the time, and 20 ns apart occasionally.


Initially, I thought I might fix this by syncing DPWM1 and 3 from DPWM0 and syncing DPWM0 externally.  I'm not sure this was a good idea, but, regardless, I've not been able to get it working.

  • This doesn't surprise me.  If you really need to have synchronization with a precision of 4 nanoseconds, you are going to have to sync up all the signals internally. 

    Do you really need precision of 4 nanoseconds? 

  • Thanks, Ian.

    I'm unsure if I need this precision, but wanted to resolve the issue before I tried anything too fancy with the timings. When you say that the signals would need to be synced internally, you aren't referring to some hybrid solution in which DPWM1 and 3 are synced to DPWM0, which is synced externally, are you? That would be wonderful, but I've had no success with it thus far, and I must have external sync in this system.
  • Yes, you will need to sync one to the external input, and the rest internally.  The UCD3138 has so many features and so many bits to control them, it's easy to get lost.  I would suggest just taking it one stage at a time.  Since you already seem to have sync for the internal stuff, start there, and then try to get the master DPWM synced to the outside.

    If that doesn't work, just try to get the master DPWM synced to the external input and then go from there.

    Or you could just try it with the little bit of jitter. 

    My rule of thumb is that it takes a week to figure it out sometimes, and then the end result is that there is one bit you either clear or set differently. 

  • Thanks, Ian.

    My understanding is this: I should sync DPWM0 (for example) externally. All other DPWM modules should be synced internally to DPWM0. This is acceptable to me.

    In testing, I can sync all to DPWM 0. I've confirmed that they are synced by changing their periods and removing sync (to confirm that they have no fixed relative timing) and then reapplying sync.

    I can also sync all externally.

    Unfortunately, I'm unable to sync DPWM1,2,3 to DPWM0 when DPWM0 is synced externally. Is there something in the chip that stops DPWM0 from acting as a master if it's acting as a slave to external sync?

    Nathan