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.

Control Duty Cycle of PWM7B in Motorware lab

Other Parts Discussed in Thread: MOTORWARE, TMDSHVMTRINSPIN, CONTROLSUITE

Hi,

I would like to control the duty cycle of PWM7B within one of the Motorware labs (lab 4 for example).

Could you please point me in the right direction? Not sure how to start.

I am using the High Voltage Motor Control Kit (TMDSHVMTRINSPIN), with the F28069 card, with the ACIM motor.

(PWM7B is used for external control of a load (shunt regulator circuit type) hooked to a motor ran in generator mode.)

Thank you very much,

Adela

  • Also, can it be added to the watch window and modified from there?

    Thanks, I would very much appreciate some help.

    Adela

  • Similarly, how do you set the duty cycle of PWM7 in ControlSuite?

    I am running torque mode using both Motorware and ControlSuite Code, trying to achieve the same goal.

  • For MotorWare,

    you should start by looking in the hal.c / . h files to understand how the other PWMs are setup and used.

    C:\ti\motorware\motorware_1_01_00_12\sw\modules\hal\boards\hvkit_rev1p1\f28x\f2806x\src\

    I recommend using the MotorWare.exe documentation to get the big picture view of hal (Hardware Abstraction Layer), the file that interfaces everything in software to peripherals.

     

    Look at the Functions and note anything with Pwm in the naming:

    HAL_acqPwmInt 

     HAL_disablePwm

    HAL_enablePwm

    HAL_enablePwmInt

    HAL_setupPwms

    HAL_writePwmData (this is for the InstaSPIN motor control, but if your PWM 7 is running in the same control loop you could potentially append your duty cycle into this data....I'm not exactly sure what you are trying to do)

    HAL_readPwmCmpA

    HAL_readPwmCmpB

    etc.

     

    For controlSUITE it is much simpler to set-up (IMO). For example

    C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\HVPM_Enhanced_Sensorless_2803x

    HVPM_Enhanced_Sensorless-DevInit_F2803x.c = enable and set-up PWMs

    HVPM_Enhanced_Sensorless.h = includes the PWM related header files

    HVPM_Enhanced_Sensorless.c = main project where PWM modules are instanced and used

     

     

  • Thanks for the help Chris!

    Ok, basically I am using the signal DAC-4 from MAIN-J14 on the TMDSHVMTRINSPIN:

    I removed the capacitor C18 (so that I get PWM7B without the DAC conversion).

    PWM7B controls the gate driver to a power mosfet that switches to a load on the "generator" side of a motor-generator set (both ACIM motors coupled at the shaft). The load is a shunt resistor (1000W capacity).

    I have to make a pWM duty cycle otherwise the load just sucks all the power out and just stops the generator.

    As of now I am using ControlSuite, and even with your suggestions I am still confused and struggling to find the right spot in the code to change the PWM7B/ PWMDAC4 signal.

    I would very much appreciate some further help please, thanks.

    Adela

  • Attached is a picture of the modifications:

    grey circle: taking PWM7B/ PWMDAC4 signal

    purple circle: removed capacitor C18.

    Thank you,

    Adela

  • Hello Adela,

    Do you use specific ControlSuite project for your project?

    Actually, you can use C:\ti\controlSUITE\development_kits\HVMotorCtrl+PfcKit_v2.1\HVACI_Sensorless as your template.

    This example is for F2803x but you can migrate it to F28069.

    About PWM initialization, you can see example from PWM_INIT_MACRO() that available in C:\ti\controlSUITE\libs\app_libs\motor_control\drivers\f2803x_v2.1\f2803xpwm.h

    Similarly, you can refer to ControlSuite example for F28069 to know how to set PWM, for example:

    C:\ti\controlSUITE\device_support\f2806x\v136\F2806x_examples_ccsv5\epwm_up_aq

    or

    C:\ti\controlSUITE\device_support\f2806x\v136\F2806x_examples_ccsv5\epwm_updown_aq

    Hope this helps.


    Best regards,

    Maria

  • Maria,

    Thank you for the tips.

    I am using ControlSuite HVACI_Sensorless with F28035 for now, it runs fine.

    I went through all the tips from both Chris and you, and being able to specify a duty cycle for PWM7B within the HVACI Sensorless code seems much more complicated than anticipated.

    I spent a couple hours already on this with no luck for now.

    Thanks

  • Hello Adela,

    Did you solve your problem?

    In ControlSuite example that I gave you, you can see the PWM periods have defined, for example like this:

    // Configure the period for each timer
    #define EPWM1_TIMER_TBPRD  2000  // Period register
    #define EPWM1_MAX_CMPA     1950
    #define EPWM1_MIN_CMPA       50
    #define EPWM1_MAX_CMPB     1950
    #define EPWM1_MIN_CMPB       50

    And then use for example like this:

     // Set Compare values
        PWM_setCmpA(myPwm1, EPWM1_MIN_CMPA);    // Set compare A value
        PWM_setCmpB(myPwm1, EPWM1_MIN_CMPB);    // Set Compare B value

    In this example, the direction and PWM CMP values are changed on interrupt (that maybe will make you confused).

    You can disable the interrupt and get only one comparation OR you can check using oscilloscope and check the duty cycle of this PWM to make this code clear to you.

    Best regards,

    Maria

  • Maria,

    Thanks for the tips. Thanks to those, combined with the documentation i found about PWM, it makes much more sense now

    I found out yesterday that for my application (induction generator control), I need code that works for 4-quadrant operation. See this forum thread: http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/337405.aspx

    Since Chris Clearman said that ControlSUITE does not support 4-quadrant operation but Motorware does, I am going to get back to working with Motorware.

    Besides I was told that Motorware support DC bus voltage level compensation and it is definitely a feature I need.

    Thanks a lot,

    Adela

  • OK, hope you can continue working well on your project.

    Good luck!

    Best regards,

    Maria