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.

SYNCI & SYNCO between different boards

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I need to synchronize ePWM modules between two C2000 custom boards. I´ll use SYNCI and SINCO signals.

I have fear with noise, and don´t know how long the connection cable can be (even if shielded).

Another option is to use optic fiber.

Anyone can give me any recommendations or experience?

Thanks,

  • I´m testing the synchronization.

    After not getting the synchronization in my code, i modified the  Lab 7.1 example. 

    My setup is a Experimenter KIT and Peripheral Board with F28335 dscs 

    I see EPWMSYNC0 pulse at Peripheral Board, and is connected to GPIO32 at Experimenter KIT with joined GNDs, but PWM signals are not synchronized.

    Also i try to feed synchronization pulse to Experimenter KIT from function gen and don´t synchronize neither.

    I checked control boards, periheral and experimenters schematics, and i think the SYNCO & SYNCI are correctly connected.

    I don´t know anything to try. Any help?

    Here are the two main configurations:

    void Gpio_select(void)
    {
    EALLOW;

    GpioCtrlRegs.GPADIR.all = 0;
    GpioCtrlRegs.GPBDIR.all = 0; // GPIO63-32 as inputs
    GpioCtrlRegs.GPCDIR.all = 0; // GPIO87-64 as inputs
    GpioCtrlRegs.GPAMUX1.all = 0; // GPIO15 ... GPIO0 = General Puropse I/O


    /* Configure EPWMSYNCI */

    /* Enable internal pull-up for the selected pins */
    GpioCtrlRegs.GPBPUD.bit.GPIO32 = 0; // Enable pull-up on GPIO32 (EPWMSYNCI)

    /* Set qualification for selected pins to asynch only */
    GpioCtrlRegs.GPBQSEL1.bit.GPIO32 = 0; // Synch to SYSCLKOUT GPIO32 (EPWMSYNCI)

    /* Configure EPwmSync pins using GPIO regs*/
    GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 2; // Configures GPIO32 for EPWMSYNCI operation.

    /* Configure EPWMSYNC0 */

    /* Disable internal pull-up for the selected output pins
    for reduced power consumption */
    GpioCtrlRegs.GPBPUD.bit.GPIO33 = 1; // Disable pull-up on GPIO33 (EPWMSYNCO)

    GpioCtrlRegs.GPBMUX1.bit.GPIO33 = 2; // Configures GPIO33 for EPWMSYNCO

    GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 1; // ePWM1A active

    GpioCtrlRegs.GPADIR.bit.GPIO9 = 1; // peripheral explorer: LED LD1 at GPIO9
    GpioCtrlRegs.GPADIR.bit.GPIO11 = 1; // peripheral explorer: LED LD2 at GPIO11

    GpioCtrlRegs.GPBDIR.bit.GPIO34 = 1; // peripheral explorer: LED LD3 at GPIO34
    GpioCtrlRegs.GPBDIR.bit.GPIO49 = 1; // peripheral explorer: LED LD4 at GPIO49

    EDIS;
    }

    void Setup_ePWM1A(void)
    {
    EPwm1Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = 1
    EPwm1Regs.TBCTL.bit.HSPCLKDIV = 1; // HSPCLKDIV = 2
    EPwm1Regs.TBCTL.bit.CTRMODE = 2; // up - down mode

    EPwm1Regs.AQCTLA.all = 0x0006; // ZRO = set, PRD = clear
    EPwm1Regs.AQCTLB.all = 0x0006;
    EPwm1Regs.TBPRD = 37500; // 1KHz - PWM signal
    EPwm1Regs.TBCTL.bit.SYNCOSEL = 1; // Pass through
    }

  • Code is the same for the two dscs

  • TCRobo,

    Some thoughts:
    1) Can you see the SYNCO pulse generated by the kit you're using as the 'master' on an oscilloscope?
    2) I think you have understood and configured your SYNCI and SYNCO settings correctly.  However, I believe your TBCTL register settings may be a bit off.  Specifically, I believe you want the PHSEN and SYNCOSEL bits to be different between the master and slave.  The attached file may help you some.  Granted this file is not for the F28335 specifically but it should be a good reference.  Within controlSUITE this file can be found at:
    \controlSUITE\libs\app_libs\digital_power\f2803x_v3.3\C\


    Thank you,
    Brett

  • Hi Brett,

    1) I see SYNCO pulse at scope.

    2) I need two boards sending identical and synchroniced PWM signals. I know how to chain PWM modules at dsc, and configured only one PWM module at each board for testing.

    The problem is that although the SYNCO signal is generated correctly from GPIO33 pin at master board and connected to slave´s SYNCI pin at GPIO32 ,  they don´t synchronize.

    Seems as if SYNCI pin is incorrectly configured, i see high level at that pin when disconnected.

    I don´t know what is happening :S

  • TCRobo,

    Then it seems that the issue lies in how SYNCI is dealt with. 

    What does 'they don't synchronize mean'?  Is it that you see some amount of offset between the master and slave PWMs?  Or do they not synchronize as all (ie one device's PWM period is longer than the other).

    The one thing I see is that the slave PWM should have PHSEN as 1 (whereas the master should have it as 0) .  I don't see this in your code (but perhaps it is elsewhere)


    Thank you,
    Brett

  • Hi Brett,

    It´s solved!

    Before, they were not synchronized at all.

    I thought i didn´t need to offset signals, and therefore did not activate the PHSEN.

    But an offset is needed, an 0 degrees offset;) If you don´t activate the phase it don´t "phase" with anything.

    I think that ePWM documentation must point this thing;) 

    PWM slave code is changed to:

    void Setup_ePWM1A(void)
    {
    EPwm1Regs.TBCTL.bit.CLKDIV = 0; // CLKDIV = 1
    EPwm1Regs.TBCTL.bit.HSPCLKDIV = 1; // HSPCLKDIV = 2
    EPwm1Regs.TBCTL.bit.CTRMODE = 2; // up - down mode

    EPwm1Regs.AQCTLA.all = 0x0006; // ZRO = set, PRD = clear
    EPwm1Regs.AQCTLB.all = 0x0006;
    EPwm1Regs.TBPRD = 37500; // 1KHz - PWM signal
    EPwm1Regs.TBCTL.bit.SYNCOSEL = 1; // Pass through
    EPwm1Regs.TBPHS.all=0;
    EPwm1Regs.TBCTL.bit.PHSEN=1;
    }

    Thanks a lot for your help!

    Now i´m seeing only a 70ns offset between signals :)

  • TCRobo,

    Great! It's good to see that things are working pretty well now.

    FYI: If you look at the code I attached previously you can see that for 0degrees phase (in up-down count mode) it should actually be:

    // config as a Slave (Note: Phase+2 value used to compensate for logic delay)
    if ((0 <= phase)&&(phase <= 2))
    {
                (*ePWM[n]).TBPHS.half.TBPHS = (2-phase);
                (*ePWM[n]).TBCTL.bit.PHSDIR = TB_UP;    // set to count up after sync
    }


    (ie TBPHS = 2 and PHSDIR = TB_UP)

    This should reduce the amount of offset you will see between the MCUs.


    Thank you,
    Brett

  • True!

    I get near 0 offset with TBPHS = 4.

    Thanks!