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.

Piccolo EPWM on-off problems

Other Parts Discussed in Thread: TMS320F2812

Hi All

I have a Piccolo 28035 running and want to use it to control a BLDC motor. The problem I am having is that I cannot turn one channel of the PWM (say epwm1a and pwm1b) off within one cycle. I want both epwm1a and epwm1b to go low when the motor commutates, but so far I cannot get it to turn off within one pwm cycle.

I have my DBCTL set as active high complemetary:

EPwm1Regs.DBCTL.bit.OUT_MODE = DB_FULL_ENABLE; // enable Dead-band module
EPwm1Regs.DBCTL.bit.IN_MODE = 0; //DB_FULL_ENABLE;
EPwm1Regs.DBCTL.bit.POLSEL = DB_ACTV_HIC; // Active Hi complementary

Now if I use the commands:

            EPwm1Regs.AQCSFRC.bit.CSFA=1;
            EPwm1Regs.AQCSFRC.bit.CSFB=1;

to force both low, then only one goes low and the other stays high. I assume this is because of the DBCTL settings. However, if I change the DBCTL settings, the dsp takes about 50ms to change from one setting to another, during which time pwm1a is high and pwm1b low (or vice versa depending on how I change it).

I have the same probem when using this command:

    EPwm1Regs.AQCSFRC.bit.CSFA=1;     and

EPwm1Regs.AQCSFRC.bit.CSFB=1;

Then I still need to change the DBCTL register which again gives me a slow response.

Using the GPioMUX gives similarly slow response.

 

Does anyone know how to switch a EPwm module off/on within one cycle?

  • I was not able to get a clear idea about your system - I am assuming you are trying to implement a traditional BLDC drive (also known as trapezoidal drive) and going through various switching combinations depending on your sectors. If that is the case then did you get a chance to go through the example system avaialable from TI site? If not I suggest you go through

    F280x BLDC3_1: Sensored Trapezoidal Control of BLDC Motor Using Hall Sensors SPRC213

    I don't know if Piccolo version of this system is currently available or not but 280x version will offer you almost same information about PWM switching as Piccolo and 280x utilizes same PWM modules.

    I was also not sure what kind of speed range and power you are looking for but the example system was utilized to implement smaller drives operating up to several thousand RPM.  Good luck with your project.

  • Hi thanks for the quick reply. Yes, my system is a sensored trapezoidal system, which require that I turn one of the 3 phase bridges off every 60 degree.

    Yes, I did have a look at TI's BLDC3_1 example. In fact I found one specifically for the Piccolo 280x in which it uses the EPwm modules. To switch off both epwm1a and epwm1b it uses the following commands:

          EPwm1Regs.AQCSFRC.bit.CSFA = 1;       // Forcing a continuous Low on output A of EPWM3  
          EPwm1Regs.AQCSFRC.bit.CSFB = 1;       // Forcing a continuous Low on output B of EPWM3

    However, this works for them because they do not use Dead Band (i.e. DBCTL.all = 0 in the example's settings).  Using no dead band works for their example because they set their their one pwm pin, say epwm1b to be low continuously, and then only modulate (pwm) the other channel (epwm1a.) For my application however, I would like to use unipolar switching since my motor's stator inductance is very low, and for this I have to put in a dead band. I would prefer to set the deadband in software and not add unnecessary hardware if the controller can do it.

    Using dead band in the controller however, I need to switch the deadband off before the CSFA=1 and CSFB=1 commands will work, but switching dead band on/off brings me back to my original problem whcih is: the dead band does not switch on/off within one cycle, and infact takes about 50ms in which time one channel (epwm1a) is high and one (epwm1b) low.

    Does anyone know how to get around this dead band problem?

  • Christoff,

    in your first mail you said that you set IN_MODE to 0. (EPwm1Regs.DBCTL.bit.IN_MODE = 0; //DB_FULL_ENABLE;). This setup however will never use the pulse width, which you would like to be generated from ePWM1B_IN - see the slide in the appendix. IN-Mode = 0 will use only ePMW1A_IN as the source for the deadband unit.  In such a case it will be sufficient to block output line A from the Action Qualifier Module   (EPwm1Regs.AQCSFRC.bit.CSFA=1; ).  Please note that the last command will set the line ePWM1A _IN  to low. Now, due to the setup of POLSEL to be active complementary high you will end up that ePWM1A is low and ePWM1B is high.

    Unfortunately I don't have time to make some time measurements right now, I will see if I can do something over the weekend.

     

     

    Deadband.pdf
  • I will think about it little bit more but would you please provide additonal information on your switching scheme - in a common case for first 60 degree segment upper phase A and lower Phase B switches are controlled (controlled means various switching pattens can be implemented depending on current control scheme, motor inductance, motor response requirement etc.). In next 60 degree segment, upper Phase A and lower Phase C switch is modulated so a deadband is not required in that system. Your system is different and what will be your switching scheme for first 60 degrees and in second 60 degrees? I am confident a C2000 device will be able to generate your swtching pattern if your requirement is correctly understood.

  • Hi Frank

    You're right. I must have a closer look at the various ways of setting up the DBCTL register. Currently I simply set it up and play with different values in the watch window and look at the response on a scope. Maybe if I use the correct settings, then I can switch both off without adjusting DBCTL everytime? (However I doubt this will work as I have tried a couple of combination- but I'll try again).

  • Hi Arefeen

    My switching scheme is almost like controlling a normal (brushed) DC motor. Everytime the motor commutates, I switch the one phase off completely, and control the two remaining phases like a full bridge brushed DC motor drive. All four remaining switches are then continually switching. If pwm1a is on, then pwm1b is off, and vice versa. At the same time pwm2a and pwm2b switches alternately as well. Now, to get them to work together, I use center mode modulation.

    Sorry, but I am having difficulty explaining Unipolar switching clearly. I think check out any good power electronics handbook for unipolar switching. It will explain it a lot clearer than if I try to do it here.

    I can see 2 disadvantages of using the common case that TI uses. Firstly, the frequency of the switch is what the motor sees. Secondly, during freewheeling, the current goes through one on switch, and then through one reverse diode (in the switch normally). This diode is normally less efficient than going though an on switch (even though it is going from Source to Drain). For unipolar, when freewheeling, both upper (or both lower) switches are on creating a more efficient path for the current to flow.

    I have used unipolar switching before in a TMS320f2812. This had the standard pwm, and not the new EPWM which is more modular and powerful. I used the following command to control the commutation there:

       EvaRegs.ACTRA.all = 0x0066;

    I must admit however that I never checked how long the controller took to update after a command like this, but I had no problems, so I assume it was within a cycle or two. I didn't have to change the dead band registers in the 2812.

  • Hello Christoff

    Your explanation is very much appreciated - thanks. So, you will implement H-bridge type operation based on your sector as AB - AC - BC - BA - CA- CB - AB and so on .. if that is the case I am not sure why deadband needs to be adjusted or turned off. When you are operating phases A & B - is it not okay to keep phase C off using trip zone with software forcing? In next sector when control changes from phases AB to phases AC - code can turn off phase B using software forcing of tripzone and clear trip of phase C to bring it online. We are looking at one instruction to turn off a phase and another instruction to turn on the next phase. You set your deadband once during initialization. - will this work?  Or have I missed your concern .......

  • Hi Arefeen

    Yes, I would love to use the trip zones to turn off the phase I am not using. Turning the phase off works well, but then turning a phase on again gives me my initial problem, where pwm1a is high and pwm1b is low for a couple of milliseconds before the pwm operates normally again. I tested it with the following registers:

    off:      EPwm1Regs.TZFRC.OST =1;           // works fine

    on:      EPwm1Regs.TZCLR.OST=1;          // takes about 30ms during which time pwm1a is high and pwm1b is low

    So using trip zones allow me not to adjust the dbctl register, but gives me the same problem. I don't think TI worried too much about the turn on time of the trip zone, since the trip zone is normally for fault protection so only turn off time is important?

    Any thoughts on this?

  • Hello Christoff

    I am not sure why it would take 30mS - what is your PWM frequency? Shouldn't this be tied with PWM frequency. I think I am missing some key specification here. Anyway, I would have approached this way - when operating phases A & B, I would have kept phase C off using TZ but would have kept updating C compare regsiters. Now, when sector changes from phases AB to phases AC, I would have simply turned off phase B and turned on phase C. The transitional effect should be minimum if any because compare registers were getting updating properly. By the way, are you regulating current and speed both or are you regulating speed and watching current for fault conditions only? The implementation should be simpler if you are regulating speed only with current monitoring.

  • Hi Arefeen

    My frequency is fast- 100kHz. I'm just keeping the duty cycle constant for the time being (about 30%).  The program that I have working of the F2812 uses current control with a position loop closed around it (no speed loop in between). I first want to get all the peripherals working on the new dsp F28035 before I start migrating my old code.

    I doubt its the compare registers giving me problems. It shouldn't be.

    I found a work around however, which I could use but would prefer not to use. My non working settings as previously is as follows:

    CMPA sets my duty cycle

    CMPB is at zero and not used

    DBCTL.bit.POLSEL = 10;

    DBCTL.bit.OUT_MODE = 11;

    For these settings I only have to adjust the CMPA value to change the duty ratio and the dead band controller controls the dead band and sets the complementary channel (pwm1b).

    However, the work around is to disable deadband completely, ie:

    DBCTL.bit.POLSEL=0;

    DBCTL.bit.OUT_MODE = 00;

    In order to get complenetary signals, I must then make CMPBequal to (period-CMPA), and set the AQCTLB registers appropriately. In order to get a dead time in this setup, I must add the deadband to the CMPB value.

    With this workaround, the TZFRC and TZCLR works instantly, and the CMPA=0 and CMPB=0 also works instantly for both on and off.

     

    Thus it seems to me that the deadband sub-module is the guilty party here. I would love to know how I could still use the dead band without it giving me my original problems. Any ideas anyone?

  • hi me facing with the same problem of creating dead band. 

    Is dead band necessary in the soft switching inverters for the BLDC drive or it depends on the inductance of the drive??

  • Hi Christoff,

    For BLDC machine I found it was much more simpler to disable Dead-time module, and use both CMPA for ePwm1a and CMPB for ePwm1b.Thus you can have SW control over each output independently.

    You might also want to check the history of the forum as I remember somebody has also stumbled upon 50ms transient bug/feature. I'd like to hear what TI has to say about it

     

    Regards, Mitja

     

  • Wow, long time ago? I almost forgot about this thread.

    The problem was solved long ago, I just forgot to reply the solution. Good news is that the dead band module does work! What gave me a problem is that the real time debugging messes up the timings. So long as you don't change variables in the watch window, the dead band module will work fine.If you try to set events using the watch window, the dead band will do strange things that one won't expect.

    Another thing that had me confused is that the dead band module overrides a lot of the other settings, so if you use dead band and then set other settings, they might not respond. The dead band does make it easy, so I will suggest to anyone to use the module for a half-bridge/full bridge topology. Just don't trigger PWM events in the watch window when checking if everything works correctly.

    Hope you all come right.