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.

TMS320F28388D: Examplw epwm_ex3_synchronization.c

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG

Hi all!

In example epwm_ex3_synchronization.c synchronisation part is missign i gues for epwm3.

Apart from that time base counter value is also updated with same phase shifting value to initilaize phase shifting value(the code part is below). What is the purpose of that?

When I update phase shifiting value dynamically should I update the time base counter value every time?

thanks in advance.

cheers,

epwm_ex3_synchronization.c lines 136-142

    //
    // Initialize PWM2 with phase shift of 300 TBCLKs
    //
    initEPWM(myEPWM2_BASE);
    EPWM_selectPeriodLoadEvent(myEPWM2_BASE, EPWM_SHADOW_LOAD_MODE_SYNC);
    EPWM_setPhaseShift(myEPWM2_BASE, 300);
    EPWM_setTimeBaseCounter(myEPWM2_BASE, 300);

  • Hi,

    Due to US holiday, please expect response by tomorrow, Feb 22. Sincere apology for inconvenience.

  • Hi Erhan,

    When I update phase shifiting value dynamically should I update the time base counter value every time?

    No, there should not be a need for this. I have filed an internal note to remove the update to the time base counter value when the phase is updated from our example.

    In example epwm_ex3_synchronization.c synchronisation part is missign i gues for epwm3.

    Thanks for pointing that out Erhan! The code below is what should be in the initialization for epwm in this example based on the synchronization scheme F8388D has:

        SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
    
        //
        // Initialize PWM1 without phase shift as master
        //
        initEPWM(myEPWM1_BASE);
    
        //
        // Initialize PWM2 with phase shift of 300 TBCLKs
        //
        initEPWM(myEPWM2_BASE);
        EPWM_selectPeriodLoadEvent(myEPWM2_BASE, EPWM_SHADOW_LOAD_MODE_SYNC);
        EPWM_setPhaseShift(myEPWM2_BASE, 300);
    
        //
        // Initialize PWM3 with phase shift of 600 TBCLKs
        //
        initEPWM(myEPWM3_BASE);
        EPWM_selectPeriodLoadEvent(myEPWM3_BASE, EPWM_SHADOW_LOAD_MODE_SYNC);
        EPWM_setPhaseShift(myEPWM3_BASE, 600);
    
        //
        // Initialize PWM4 with phase shift of 900 TBCLKs
        //
        initEPWM(myEPWM4_BASE);
        EPWM_selectPeriodLoadEvent(myEPWM4_BASE, EPWM_SHADOW_LOAD_MODE_SYNC);
        EPWM_setPhaseShift(myEPWM4_BASE, 900);
    
        //
        // ePWM1 SYNCO is generated on CTR=0
        //
        EPWM_enableSyncOutPulseSource(EPWM1_BASE, EPWM_SYNC_OUT_PULSE_ON_CNTR_ZERO);
    
        //
        // ePWM2-4 use the ePWM 1 SYNCO as its SYNCIN.
        //
    
        EPWM_setSyncInPulseSource(myEPWM2_BASE, EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM1);
    
        EPWM_setSyncInPulseSource(myEPWM3_BASE, EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM1);
    
        EPWM_setSyncInPulseSource(myEPWM4_BASE, EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM1);
        
        //
        // Enable all phase shifts.
        //
        EPWM_enablePhaseShiftLoad(myEPWM2_BASE);
        EPWM_enablePhaseShiftLoad(myEPWM3_BASE);
        EPWM_enablePhaseShiftLoad(myEPWM4_BASE);
    
        //
        // Enable sync and clock to PWM
        //
        SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);

    Best Regards,

    Marlyn

  • Hi Marlyn!

    Thanks for the answer and the code. I just replaced it with the example in my C2000ware installation.

    Do you know is there any upcoming C200Ware release?

    cheers,

  • Hi Erhan,

    No problem! Yes, we do have a new release in March so please be on the look out. In this new release we will have EPWM support within our SysConfig tool. Essentially you can configure the module (or others) through a graphical GUI and it will auto-generate the code for you. SysConfig has a lot of capabilities, here is more information: C2000 SysConfig

    Best Regards,

    Marlyn

  • Hi Marlyn!

    Thanks for the info. 

    told me about that also but unfortunately I started to use EPWM. :s But thanks for the SysConfig tool. I used it mostly standalone for pin allocation. It saved my time. It is nice tool 

     

    But you might know that you can't run multiple instances of standalone SysConfig without a work around (editing a json file). Is it also fixed with new release?

    cheers,

  • Hi Erhan,

    I used it mostly standalone for pin allocation. It saved my time. It is nice tool 

    Glad to know you have used SysConfig and that it was useful for you and helped you save time!

    But you might know that you can't run multiple instances of standalone SysConfig without a work around (editing a json file). Is it also fixed with new release?

    , do you know if this is getting addressed in the next sysconfig version?

    Best Regards,

    Marlyn

  • I don't think the CCS team have the ability to fix that. The JSON solution is the only one I know. Also the online version (dev.ti.com) can be launched with multiple instances.

  • Why not?

    I am not expert but at first glance I can say that I can write a small python script that will increment a counter in the name section of the package.json file.

    Then connect this script with the sysconfig shorcut. At each run json file will change and will allow to run multiple instances.

    I heard about online tool but we have internet problem. :s

    cheers,

     

    package.json

    {
    	"name": "Erhan YILMAZ SysConfig Counter:xxxxxx",
    	"main": "dist/index.html",
    	"window": {
    		"width": 1281,
    		"height": 800,
    		"icon": "dist/sysconfig.png"
    	}
    }

  • can you comment on the item above on launching multiple instances of the SysConfig GUI tool on desktop?

  • It is more of a "haven't yet" vs "can't".  Note that node-webkit creates temporary files under %LOCALAPPDATA%/<name in package.json>, so be sure to clean that up if you are scripting this yourself in the mean time.