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.

TMS320F28379D: PM_bissc_startOperation terminates EPWM1-2-3

Part Number: TMS320F28379D

Hello,

We are developing a motion control system with BISS Encoder and I have started using the TI BISS-C Library.

When i use the library functions, up to 7.1 MHZ, i can read the encoder without any problems.

Unfortunately, when i try to drive the BLDC motor using the EPWM1-2-3 outputs, thats when the problem starts. When BISS reading start, it terminates the EPWM1,2,3. One cycle later, when the BISS reading is not taking place, EPWM return back to normal. (With every cycle, i am writing %50 duty cycle to PWM1-2-3 registers again)

Below is an oscilloscope picture, visualizing my problem.

How can i stop this ? Why would PM_bissc_startOperation or PM_bissc_setupNewSCDTransfer cause this ?

Best regards,

Erman

Other config info:

BISS is using SPIA.

Therefore, for inputbar:

InputXbarRegs.INPUT1SELECT = 16; // INPUTXBAR TRIP1 -> GPIO16

For configuring EPWM4, simply

EPwm4Regs.TZCTL.bit.TZA = 1;
EPwm4Regs.TZCTL.bit.TZB = 1;
EPwm4Regs.TZFRC.bit.OST = 1;

For GPIO:

//GPIO6 und GPIO7 als PWM-Modul
GPIO_setPadConfig( 6, GPIO_PIN_TYPE_STD );
GPIO_setPinConfig( GPIO_6_EPWM4A );// Configure GPIO6 as bissC Clk master
GPIO_setPadConfig( 7, GPIO_PIN_TYPE_STD );
GPIO_setPinConfig( GPIO_7_EPWM4B );// Configure GPIO7 as SPI Clk slave

// GPIO16 is MOSI pin
GPIO_setPadConfig( 16, GPIO_PIN_TYPE_STD );
GPIO_setPinConfig( GPIO_16_SPISIMOA );
GPIO_setQualificationMode( 16, GPIO_QUAL_ASYNC );
// GPIO17 is MISO pin
GPIO_setPadConfig( 17, GPIO_PIN_TYPE_PULLUP );
GPIO_setPinConfig( GPIO_17_SPISOMIA );
GPIO_setQualificationMode( 17, GPIO_QUAL_ASYNC );
// GPIO18 is SCLK pin
GPIO_setPadConfig( 18, GPIO_PIN_TYPE_STD );
GPIO_setPinConfig( GPIO_18_SPICLKA );
GPIO_setQualificationMode( 18, GPIO_QUAL_ASYNC );
// GPIO19 is /CS pin
GPIO_setPadConfig( 19, GPIO_PIN_TYPE_PULLUP );
GPIO_setPinConfig( GPIO_19_SPISTEA );
GPIO_setQualificationMode( 19, GPIO_QUAL_ASYNC );

// Configure GPIO94 as bissC Pwr Ctl
GpioDataRegs.GPCCLEAR.bit.GPIO94 = 1;
GPIO_setPadConfig( 94, GPIO_PIN_TYPE_STD );
GPIO_setDirectionMode( 94, GPIO_DIR_MODE_OUT );

  • Hi Erman,

    I am looking into this.  It may take me a day to get back to you.  I will write back before end of business Monday (US Central).

    -Lori

  • Erman Ozdemir said:
    Unfortunately, when i try to drive the BLDC motor using the EPWM1-2-3 outputs, thats when the problem starts. When BISS reading start, it terminates the EPWM1,2,3.

    To make sure I understand.  All of the following output signals are impacted:  EPWM1A, EPWM1B, EPWM2A, EPWM2B, EPWM3A, EPWM3B ?  Is that correct?

    Regards

    Lori

  • Erman,

    I've looked into the BiSS Library and also discussed with a colleague.  Right now I'm not finding anything in the library that would result in this type of behavior.  Can you check the following:

    • If the BLDC example is run without BiSS requests, does the same behavior occur or not?
    • Instead of requesting a BiSS transmission, can you try pulling the SLO line low and see if the behavior changes?  

    The goal is trying to see if the issue is truly tied to the BiSS logic or if it is only tied to the signal being used.  It may be a trip issue on the PWM.  

    Regards

    Lori

  • Hey Lori,

    • To make sure I understand.  All of the following output signals are impacted:  EPWM1A, EPWM1B, EPWM2A, EPWM2B, EPWM3A, EPWM3B ?  Is that correct?
      • I checked them again, all 6 EPWM signals are impacted.
    • If the BLDC example is run without BiSS requests, does the same behavior occur or not?
      • Without BiSS request, BLDC runs perfectly, all EPWM signals run perfectly
    • Instead of requesting a BiSS transmission, can you try pulling the SLO line low and see if the behavior changes?
      • If SLO is set to low manually by not using BiSS library and setting the following 2 lines, EPWM1-2-3 runs perfectly.

    GpioDataRegs.GPASET.bit.GPIO6= 0;
    GpioDataRegs.GPASET.bit.GPIO7= 0;

    • It may be a trip issue on the PWM.  
      • I believe so too. It seems that start of the BISS clock through EPWM4 is killing other PWMs.

    Best regards,

    Erman

  • Erman,

    Is the BLDC code from TI?  I am going to ask one of my colleagues more familiar with PWM to take a look at your issue. 

    Regards

    Lori 

  • Erman,

    Is the issue resolved?  Can you let me know what the cause was?

    Best Regards

    Lori

  • Hello Lori,

    Issue is not resolved, i am still investigating it.

    BLDC code is not from TI. Following is the initialization for the EPWM1 module. EPWM 2 & 3 are same. Then at 25kHz, i set to registers EPWM1-2-3 registers for motor control. Motor control part is not the problem, as i told you before, without BiSS it works perfectly. In any case, if i see that PWM signals are not destroyed by BiSS, that would be the solution for me.

    void InitEPwm1(void)
    {
    //Trip-Zone Submodul (Fehlererkennung)
    EALLOW;
    EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
    EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO;
    EPwm1Regs.TZSEL.bit.CBC1 = TZ_ENABLE;
    EPwm1Regs.TZCTL2.bit.ETZE = 0; //Use trip action from TZCTL (legacy EPWM compatibility)

    //PWM ausschalten mittel Tripzone
    EPwm1Regs.TZFRC.bit.OST = 1;
    EDIS;

    // Set Time-Base
    EPwm1Regs.TBPRD = EPWM_COUNTER_PERIOD - 1; // Set timer period
    EPwm1Regs.TBPHS.bit.TBPHS = 0x0000; // Phase is 0
    EPwm1Regs.TBCTR = 0x0000; // Clear counter
    EPwm1Regs.TBSTS.bit.CTRDIR = 1; //Counting up

    EPwm1Regs.TBCTL.bit.PHSEN = TB_DISABLE; // Disable phase loading
    EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1; // Clock ratio to SYSCLKOUT -> HSPCLKDIV = 1
    EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1; // Slow so we can observe on the scope

    EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW; // 0
    EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync down-stream module
    EPwm1Regs.TBCTL.bit.FREE_SOFT = 0x01; //On Breakpoint, stop when TBCTR = 0x0000 -> OUTPUT = 0 (H-Side)
    //TBCTL2 not needed

    // Set Counter-Compare
    EPwm1Regs.CMPCTL.bit.LOADASYNC = 0;
    EPwm1Regs.CMPCTL.bit.LOADBSYNC = 0;
    EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW; // Load registers every ZERO
    EPwm1Regs.CMPCTL.bit.SHDWBMODE = CC_SHADOW;
    EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
    EPwm1Regs.CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
    //CMPCTL - CompC & D - not needed

    EPwm1Regs.CMPA.bit.CMPA = 0; // maybe comment out
    EPwm1Regs.CMPB.bit.CMPB = 0; // maybe comment out

    // Set Action-Qualifier

    EPwm1Regs.AQCTL.all = 0; // Kein Shadow für AQCTLA und B
    EPwm1Regs.AQCTLA.bit.CAU = AQ_SET;
    EPwm1Regs.AQCTLA.bit.CAD = AQ_CLEAR;
    EPwm1Regs.AQCTLA.bit.CBU = AQ_NO_ACTION;
    EPwm1Regs.AQCTLA.bit.CBD = AQ_NO_ACTION;
    EPwm1Regs.AQCTLA.bit.ZRO = AQ_NO_ACTION;
    EPwm1Regs.AQCTLA.bit.PRD = AQ_NO_ACTION;

    EPwm1Regs.AQCTLB.bit.CBU = AQ_CLEAR;
    EPwm1Regs.AQCTLB.bit.CBD = AQ_SET;
    EPwm1Regs.AQCTLB.bit.CAU = AQ_NO_ACTION;
    EPwm1Regs.AQCTLB.bit.CAD = AQ_NO_ACTION;
    EPwm1Regs.AQCTLB.bit.ZRO = AQ_NO_ACTION;
    EPwm1Regs.AQCTLB.bit.PRD = AQ_NO_ACTION;

    // Set Dead-Band Generator
    EPwm1Regs.DBCTL.bit.OUT_MODE = DB_DISABLE; // Deadband disabled
    EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HI;

    //Einstellen des HRPWM-Moduls
    EALLOW;
    EPwm1Regs.HRCNFG.bit.HRLOAD = HR_CTR_ZERO; //Shadow Load at zero
    EPwm1Regs.HRCNFG.bit.HRLOADB = HR_CTR_ZERO;
    EPwm1Regs.HRCNFG.bit.CTLMODE = HR_CMP; //HRWPM works at duty control mode
    EPwm1Regs.HRCNFG.bit.CTLMODEB = HR_CMP;
    EPwm1Regs.HRCNFG.bit.EDGMODE = HR_REP; //Steigende Flanke wird beeinflusst
    EPwm1Regs.HRCNFG.bit.EDGMODEB = HR_FEP; //Fallende Flanke wird beeinflusst

    // Set Event-Trigger in Funktion StartFOC

    //Enable Counter
    EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Count up and down

    //Generate the ADS-Conv und Trig_IP über ADCSOC (SPRUG04A P.108) at GPIO10
    EPwm1Regs.ETSEL.bit.SOCBEN = 1; //Enable SOCB für EPWM2
    EPwm1Regs.ETSEL.bit.SOCBSEL = 0x2; //Generate ADC Trigger at TBCTR = TBPRD
    EPwm1Regs.ETPS.bit.SOCBPRD = 1; //Jedes mal Triggern
    EPwm1Regs.ETCLR.bit.SOCB = 1; //Event löschen

    SyncSocRegs.ADCSOCOUTSELECT.bit.PWM1SOCBEN = 1;
    EDIS;
    }

  • Erman,

    I'm just wondering how you apply the dead band. Does any circuits (gate driver, etc) on your power stage generate the dead band instead of C2000 MCU?

    As you previously mentioned that the system worked well without BISS, I guess the dead band was applied but just want to make a double check.

    Best,

    John

  • Hello John,

    We apply Deadband at the MCU. EPWM1-2-3- CMPA get (+) Deadband value, CMPB (-) Deadband vaue.

    I am unable to imagine how deadband might be the cause of it. 

    I also made a try, where the program starts applying PWM, and starts to read BiSS after some time. At the beginning, before BiSS read starts, everything is OK.

    Best regards,

    Erman

  • Hello,

    I managed to overcome the problem. Using BiSS trips the EPWM1-2-3

    Yesterday i posted that:

    EPwm1Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
    EPwm1Regs.TZCTL.bit.TZB = TZ_FORCE_LO;

    EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
    EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_LO;

    EPwm3Regs.TZCTL.bit.TZA = TZ_FORCE_LO;
    EPwm3Regs.TZCTL.bit.TZB = TZ_FORCE_LO;

    Now i changed all TZ_FORCE_LO to TZ_NO_CHANGE and PWMs are not tripping and are not set to 0.

    So motor is running and signals look good.

    I dont know why using BiSS was causing trip for EPWM1-2-3.

    Thanks for the help.