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.

TMS570LS3137: TMS570LS3137: Synchronizing HET timing on two devices

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Hello everybody,

I'm running a 3 phase symmetrical PWM with 16kHz on a TMS570LS3137.
The HET code is based on TI's example which was posted in several revisions in this forum.

My main additions were another few timers to generated ISR and ADC triggering (at 32kHz) as well a resolver excitation (at 8kHz).

Here is a code snip:

;----- program entry point
   
    ; Sit in loop initializing all pins to output low, and clearing counter & state (NXTxLOON)
          ; until software enables the PWM program by writing non-zero data to START
START     SUB   {src1 = IMM, src2 = ZERO, dest=NONE, data=0, hr_data=0}
    BR    {event=NZ, cond_addr= TBASEINT}
    ADD   {src1 = IMM, src2=ZERO, dest=T, rdest=REM, remote=TBASE1, data=1FFFFFFh, hr_data=0}
    MOV64 {en_pin_action=ON,  reg=T, pin=PEROUT, action=CLEAR, data=0, hr_data=0, cond_addr=PERSET, remote=PERPIN, comp_mode=ECMP}
    ADD   {src1 = ZERO, src2=ZERO, dest=NONE, rdest=REM, data=0, hr_data=0, remote=PERCLR}
    ADD   {src1 = ZERO, src2=ZERO, dest=NONE, rdest=REM, data=0, hr_data=0, remote=NXTALOON}
    ADD   {src1 = ZERO, src2=ZERO, dest=NONE, rdest=REM, data=0, hr_data=0, remote=NXTBLOON}
    ADD   {src1 = ZERO, src2=ZERO, dest=NONE, rdest=REM, data=0, hr_data=0, remote=NXTCLOON, next=AHIONINIT}

;interrupt: main counter for application timing
TBASEINT  CNT   {reg = A, max = defperint, data = defdladc}
;ADC: falling edge will trigger ADC sampling (see HALCoGen ADC event group settings) and important: enable this line to generate interrupts in HALCoGen HET settings!!!
ADCCTRL   ECMP  {reg = A, irq = ON, en_pin_action = ON, hr_lr = HIGH, pin = defpinadc, action = PULSELO, data = defdcadclr, hr_data = defdcadchr}
;ADC: same compare as ADC trigger but without IRQ and on different pin falling to support commissioning
ADCTEST   ECMP  {reg = A, en_pin_action = ON, hr_lr = HIGH, pin = defpintest, action = PULSELO, data = defdcadclr, hr_data = defdcadchr}
;resolver: important: we use a different timer!!!
TBASERES  CNT  {reg = B, max = defperres, data = defdlres}
RESCTRL   ECMP {reg = B, en_pin_action = ON, hr_lr=HIGH, pin = defpinres, action = PULSELO, data = defdcreslr, hr_data = defdcreshr}

TBASE1    CNT   { comp=GE, reg=T, max=cntmax_lr, data=1FFFFFFh};
...

New project requirement is to synchronize the PWMs of two identical inverters (each using its own TMS570).

The overall algorithm to do this is still in development, but what I need to do in the end is to change all period and phase shift registers of my timers online!

HETGCR.CMS[16] looked promising but seems to help onchip only...


Any ideas or hints on getting the HET program tuned?

Regards,
Ralph

  • Hello Ralph,

    You are right. The synchronization mechanism is only for N2HET1 and N2HET2 of the same chip. A N2HET in master mode provides a signal to synchronize the prescalers of the slave N2HET. The slave N2HET synchronizes its loop resolution to the loop resolution signal sent by the master. The sync signal is not routed out to any signal pin.

    There is no way to sync two N2HET modules on different chip. The ePWM on LS12x/LC43x devices do support external synchronization signals.

  • Hello QJ Wang,

    your answer confirms my fear. So I have to go the long way which goes something like this: Name one of the inverts master and the other slave, use a sync pulse from the master to capture timer in the slave and use a closed loop control to minimze the gap between Timing. As written in the original post, this leads to the problem of changing all CNT timers (periode and phase shift) while the HET program is running. This is the Point where I' struggeling at the moment… any ideas on that?

    Regards,

    Ralph

  • Hello Ralph,

    Is it possible to use an external signal to trigger one N2HET instruction at the same time?

    1. After startup, the NHET code execute 1 or 2 instructions and waits for the trigger to start counter and generate PWMs

    2. Both MCUs output a pulse on GIO or NHET pins. For example MCU0--GIOA[0], MCU1--GIOA[1]

    3. GIOA[0] and GIOA[1] are connected to a logic gate as input, the Gate output feeds to one NHET pin (for example N2HET1[0]) of MCU0 and MCI1

    4. The rising edge or falling of N2HET1[0] triggers one instruction to start the counter. For example to trigger a BR instruction

  • Hello QJ Wang,

    my requirement inculdes the synchronization while the program is running, i.e. to compensate quartz frequency deviations.
    Do you think your described procedure could work on this, too?

    Regards,
    Ralph

  • Hi Ralph,

    This approach is not able to compensate quartz frequency deviations, and may not work well for running program (whole loop) in NHET.

  • Ralph,

    If I understand correctly, you are looking for being able to measure frequency deviations on an input signal and then use this measurement to make adjustments to counters within the HET program used for output compare functions. Is this correct?

    This is certainly possible using the instructions supported by the N2HET. Unfortunately we do not have an example that I can readily provide. We do have some application notes based on the HET IDE that you can use as reference.

    Regards, Sunil

  • Hello Sunil,

    yes, you completely described what I'm trying to do.

    I was hopeing this task was solved already with the HET and I can take a shortcut.

    I know the public HET app notes but still find the HET programming complex.

    But okay, I then have to take the long way. I will come back with more detailed questions around that topic for sure :-)

    Regards,

    Ralph