The power consumption of the motor drivers may be higher than you think.
I was working on the DC motor control for my mouse and with the motors disconnected, noticed that the power consumption was much higher than I expected. It was easy to tell the power consumption was high because I was using a bench top power supply with a built in current meter.
Instinctively, I put my finger tips on the two drivers and the H-bridge FETs and the drivers were very warm – almost too hot to touch. So, I checked the schematics, the data sheet and couldn’t find anything wrong. I checked the waveforms and things looked “fine”.
Unfortunately, when I checked the waveforms, I didn’t check the time base. An hour or so later, when I did finally check the time base, I found that the PWMs were running at 2x the freq.!
I’m using timer 2 on the STM32 and in the clock diagram, it says that if the APB1 prescaler = 1, then the timer clock is x1 otherwise the timer clock is x2. Since I’m running the processor at 64MHz, I have the APB1 prescaler set to 2 to give me an APB1 clock freq. of 32MHz (max. APB1 clock freq. is 36MHz) but this automatically gives me a timer clock freq. of 64MHz and I had assumed it would be 32MHz.
After changing the constants, I verified that the PWM freq. was now what I expected (31.25KHz), the power consumption dropped (power supply current at 2x PWM was 290mA and at 1x PWM is 150mA) and also the MOSFET drivers were no longer uncomfortable to touch.
Dropping the PWM freq. reduced the power dissipation in the MOSFET driver by 1W (= 7V * (290mA – 150mA). This seems like a very large number – I need to check my calculations that it makes sense. So, I turned the PWMs off, and the power consumption drops to 50mA, so there is a non-linear affect here.
In thinking about this, every time I switch the H-bridge off/on, I get shoot through between the power supply and ground – from looking at the datasheet, this time period is in the order of 30ns. So, for 30ns, we are shorting the power supply to ground and for my design, I’m drawing a total of around 2A for the 30ns.
Microchip has a good app. note (AN799) that goes through the power dissipation calculation.