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.

TMS320F28035: ePWM Duty cycle

Part Number: TMS320F28035
Other Parts Discussed in Thread: DRV8301

Hello,

I am using the PWM peripherals on the F28035 and was wondering what is the best way to turn off a particular PWM signal.  The way I am turning off the PWM is by setting the CMPA value equal to the period value on the up-down counter.  I was told by one of my team members for this project that a 0% duty cycle is not good for the MCU.  I am using the PWM signals to drive a three phase H-bridge and have used the ePWMxA lines to feed the signals to the motor driver (the board was accidentally designed without taking advantage of the ePWMxA-ePWMxB module configuration).  My fear is that I will damage the MCU if I run the PWM at 0%.  Any help or suggestions would be greatly appreciated.  Also, I don't plan to run at 100% duty cycle, if that matters.

Thank You,

-Brandon

  • Just one more question:
    Since I am using a three phase H-bridge do I need to use PWM for the high and low side FETs? Can't I just use PWM signals on the high side FETs to control the duty cycle and then just set the needed low side FET high without PWM according to the commutation cycle? Wouldn't this have the same effect as using PWM on the High and Low side FETs? Sorry if this question seems elementary, but this is my first time designing a BLDC motor controller.
    Also, I know I said just one more question, but I do have another question because I can't find a definite answer by researching online. When using Hall Sensors, is it better to set the FETs on/off based upon the current rotor position based on the Halls or to set the FETs on/off based upon the anticipated rotor position (one commutation step past the current rotor position)? I have no information about the motor other than it is a 48V BLDC with a max current rating of +/- 26A and has 22 poles. Thank you so much. You guys have helped out a lot in all my other post thus far.

    -Brandon
  • Hi, Brandon
    First, let me answer your second question:
    TI developed ePWM modules in such way, that they can generate two complementary signal with deadband. This means, that you can connect hi side FET to, for example, ePWM1A channel, and the low side FET to ePWM1B channel. Than you calc duty cycle and apply it to CMPA register of ePWM1. As a result you get Hi-side switch dutycycle equal to CMPA/TBPRD, and lowside duty-cycle = (TBPRD - CMPA)/TBPRD. And also you get dead time for free!

    Second, how to turn off. It's obvious, that in's no good to set CMPA = 0 if you have low side switch working complementary to hi side. So there are two ways to turn off. a) You can use ePWM registers to Force swtiches to low state with AQCSFRC register. b) Set up TZ action to put pwm channels to Hi-Z state and then set/clear TZ with TZFRC/TZCLR registers.
    I prefer the second method, but my co-workers prefer the first one.

    Thirds, your question about hall sensor is too difficult to answer. It depends on the quality of the sensor, quality of the motor, your targets. There are plenty control strategies. I don't think anyone can help you with it - only your own experience/experiments/drive examination may help. And engineering articles of course.
  • Thanks for the quick response.  The three phase H-bridge connection on my board did not take advantage of the PWM module setup (did not realize the modules were setup this way until after boards were made and can't afford to have more boards made; this is for a senior design project and time and money are scarce).  However, can I still use the AQCSFRC register with my setup?  Also, I would like to know your thoughts on not using PWM on the low side FETs (i.e. use GPIOs) but only use PWM on the High side FETs to control duty cycle.  My MCU-to-Three phase connections are as follows (of course the PWM are fed to DRV8301 and then to the FETs):

    ePWM1A-------->A_High

    ePWM2A-------->A_Low

    ePWM3A-------->B_High

    ePWM4A-------->B_Low

    ePWM5A-------->C_High

    ePWM6A-------->C_Low

    Please don't condemn my connections LOL.  It just comes down to poor research and a lesson learned :).  Thanks again.

    -Brandon

  • Disona,

    I had one more question (again LOL) that you may be able to answer since you have more experience with BLDC and Hall sensors. When researching my project, I found out that usually when a BLDC motor has three Hall sensors they are likely to be placed 120 degrees apart from each other. And when I drove the motor using the motor controller that came with it (it only allowed clockwise rotation but we are designing a new bi-directional controller for the motor for senior design), I measured the Hall signals and noticed that it has six logic steps that repeat (this also why I assume the Halls are 120 degrees apart). When I rotate the motor by hand, however, the Halls switch states every few degrees. Is this due to having 22 poles? And when using interrupts to determine the rotor position, won't some commutations be missed while the ISR is in progress sense the interrupts happen so quickly? I know you might not have given you enough information to determine an exact answer, but a general answer or suggestion should suffice. Thanks so much.

    -Brandon
  • Hm, i don't think it's a good idea to control low side fets without ePWMs, because you have to turn them on precisely after Hi-side turns off; and turn off just before hi-side turns on. And also don't forger about deadband. I don't know a way to synchronize gpio toggling with ePWM switching.

    To my mind, the best way in you case is to use all 6 ePWMs with this rules:
    1) ePWM counters of each half-bridge must be perfectly synchronized. If TBCTR of ePWM1 is 350 at the moment, then TBCTR of ePWM2 must be 350 too.
    2) Set up low-side ePWM to change output inverted (in compare to ePWM of the hi-side). I mean, if ePWM1 is ON when CTR1 < CMPA1, then ePWM2 must be on when CTR2 > CMPA2
    3) Calculate CMPAs for ePWM1 and ePWM2 simultaneously: CMPA1 must be calculated according to desired duty cycle and CMPA2 must be calculated as CMPA2 = CMPA1 + DeadBandCycles.

    For example, ePWM1 and ePWM2 counters are synchronized and they are counting in UP-DOWN mode (like triangle). ePWM1 is on when CTR1 < CMPA1, ePWM2 is on when CTR2 > CMPA2. TBPRD is 1000. You want to get dutycycle equal to 80%.
    In this case your CMPA1 would be 800, and CMPA2 900(100 cycles are for deadband). So what you get: let's assume you are in the beginning of PWM period. CTR1 and CTR2 are 0. Hi-side is on (0 < 800) and low side is off (0 < 900). The counter counts up and gets to 801. You have hiside of (801>800) and low side off (801 < 900) - this is dead band. After 100 cycles you have CTR = 901. Hiside is off (901 > 800) and low side turns on (901>900). Well... you can guess what will happen, when the counters will start counting down.

    The explanation is complicated, sorry =) But all of this is for case, when you want your switches to work in complementary mode.
    I hope this helps, ask more if you need.

    And well, there is no problem for the MCU to work with 0% duty cycle =) There maybe be problems with your fet-drivers, for example, if you use bootstrap power for low-side fets.
  • Hall sensors do not measure mechanical position, but they measure absolute electrical position of the drive - so yes, if you have 22 poles you will get 6*22 = 132 pulses per 1 mechanical revolution. 360/132 = 2.3 mechanical degrees. That's for three sensors. But If you are examining only one hall sensor, than you will see, that it changes it's output every 2.3*3=6.9 mechanical degrees.

    "won't some commutations be missed while the ISR is in progress" that depends on the way you measure speed/position, and on the drive speed. I know that eCAP module is used for hall-sensor processing, but I don't know details. This module can automatically count time between hall pulses (in CPU cycles) and you don't need ISR to calculate the drive speed. You just take the measured cycles and convert it into rotor speed like "Speed = CountedCPUCycles / CPUfrequency * polePairs" (or smth. like that). What about position... well, maybe yes, maybe you need ISR on every pulse to get position and re-calculate DutyCycles. But you can also "interpolate" position between some seldom pulses if you know drive speed. Once again, there are plenty of strategies... you should try them by your own and choose the one that is suitable for you project, i think =]
  • Disona,

    Your explanation makes perfect sense. I am puzzled about one thing though. If the High side and low side are complementary, how do you account for need to turn high and low FETs off completely (I'm guessing AQCSFRC register)? Also, how does the complimentary mode of operation work when all three phases are being used? Wouldn't the complimentary mode still allow current to flow through the low side of one phase when the intention is to have the current flow through the low side of a different phase? Or does this work because one phase is turned completely off first? Hope my confusing question makes sense. Thanks.

    -Brandon
  • I'm not sure I have understood you correctly: "how do you account for need to turn high and low FETs off completely". Do you mean "WHAT FOR do we need to turn them off completely"? If that is your question - well, if you don't turn them off then how would you turn off your drive? If you want to turn off only hi-side and leave low-side turned on - that's not correct. That means, that your drive's phases will be shorten (all phases are connected to one point - negative DC-link bus). If the drive is spinning (BLDC) and you short the phases - you will have currents flowing through the phases due to EMF caused by spinning magnet. So you should use AQCFRC anyway for all 6 ePWMs.

    "how does the complimentary mode of operation work when all three phases are being used" - it works ok =) I'm not a prof in that physics area, but when you set up current controllers - they will do all of the current-flow work for you. Anyway, in a three phase drive current is always flowing through all phases at any moment: Ic = -Ia - Ib.

    But i have doubts now - maybe you are not going to use space-vector PWM? Maybe you really don't need complementary switching... I'm not sure about it. It (again) depends on your purposes.
  • Disona,

    I will try to explain what I'm thinking by an example. Say that you need to have A_High and B_Low on and use complimentary PWM (where A_High complements A_Low and so forth), and you also have C_High and C_Low set Low using the AQCFRC, wouldn't the complimentary setting result in Phase A and B toggling back and forth (A_High and B_Low are on while A_Low and B_High are off, and then A_High and B_Low are off and A_Low and B_High are on and then repeated). Sorry if I am making this hard. I'm still learning. Thanks.

    -Brandon
  • Hmm... well, if you need a such way of switching - you don't want complementary switching. But how are you going to modulate voltage over time? Why don't you use usual space-vector PWM?
  • Disona,

    Sorry it took so long to reply. I had to go to class. I am not familiar with the space-vector PWM. Could you elaborate or provide me with some reference material? Also, when you asked how will I modulate the voltage over time, do you mean how will I be applying power to the gates or to the three phase h-bridges? I am using a 48V battery that has built in protection circuitry and will be using current sensors on the low side of each phase to measure current. I am using the DRV8301 to drive the gates. If I am not understanding your question about modulating the voltage, could you please elaborate. Thanks.

    -Brandon
  • Brandon Dyer77 said:
    Disona,

    Also, when you asked how will I modulate the voltage over time, do you mean how will I be applying power to the gates or to the three phase h-bridges?

    No, i meant that if you want your motor to spin, you have to change your voltage. For example if you want to spin a three-phase motor with a constant speed you would apply three sinusoidal voltages to its phases. So "voltage modulation" is sine wave. (BTW "voltage modulation" is not a common termin, i just used it because of lack of my english skills. Not sure how to call it properly =\ )

    Are you going to use built-in current sensors of DRV8301 or external op-amps for your shunts? In case of built-in sensors you can turn off switches with AQCFRC. But if you use external opamps, you can turn off switches by setting EN_GATE signal low.

    Furthermore, if you finally choose to use complementary control, you can set DRV8301 to be controlled only by three signals for hi-side FETs, and DRV8301 will automatically generate complementary lo-side signals and add deadband.

    Space-Vector Pulse-Width Modulation (SVPWM) is a common and widely-used technique to create voltages. In that terms total voltage applied to a motor is described in terms of vector amplitude and angle. Than you take projections of this vector to phases A, B and C and get three phase voltages for the motor. Then you convert voltages into CMPAs for ePWMs and... well, that's all.

    It's not difficult to calculate all this stuff, but it's difficult enough to understand it without some experience. I don't even now, where to start. SVPWM short theory is described in the TI pdf (link below). And it's mandatory to watch video about Field-Oriented Control. It's long enough (1 hour) but it really makes everything quite simple.

     

     

  • Disona,

    I have actually spent the last hour or so watching videos and researching about SVPWM and it wasn't too hard to understand. It actually seems like it would be pretty simple to implement. After researching SVPWM I wanted so bad to change my board layout to take advantage of the F28035's ePWMx A-B module's complimentary capabilities. I even talked to my project sponsor about revising the pcb layout so I could use the modules in complimentary mode. You can't believe how excited I was to find out that the DRV8301 has this capability :). Thanks so much for your help. I will definitely let you know how it goes in the next few days or so what results I get from trying the DRV8301's three PWM input mode. Do I need to keep this post open so I can give an update?

    Thanks!
    -Brandon
  • That's great that you have understood the theory so fast. I think it's better to close this thread, in order to make it easier for users finding answers for particular questions (about ePWM like here), and then start new threads if any problems. If that questions don't have answers on this forum of course =)
    Good luck with your project.