2020-11-20 10:08 AM
We would like to use an STM32G4 to (sinusoidally) control 6 high-current BLDC motors, each with 3 digital Hall effect sensors, and each using 3x PWM Mode for control (in addition to monitoring the voltage across 1 or 3 shunt resistors on each motor for current sensing - we plan to use a DRV8323S driver and 3 CSD88584Q5DC dual MOSFETs for each motor). The G4 reference manual (RM0440) section 27.3.29, Interfacing with Hall sensors, suggests the use of an “interfacing timer�? to read the 3 Hall sensors, and an additional advanced-control timer (triggered by the interfacing timer) to generate 3 PWM signals to drive each motor. Thus, 12 timers, with 3 channels each, appear to be needed to drive 6 motors using STM32G4s. We are considering 2 possible solutions for this situation:
A) We are using an STM32G474VE for a related board and are considering using the same MCU for this board if possible. In order to use a single STM32G474VE to control our 6 motors, we would need to use 6 timers [either the advanced TIM1, 8, 20, or the 4-channel general purpose TIM2, 3, 4, 5] as “interface timers�?, and then some combination of (a) one of the remaining timers from the 7 previously mentioned, (b) the other general purpose timers (TIM15, 16, 17), and (c) HRTIM1, to generate the 18 PWMs necessary to drive the 6 BLDC motors using 3x PWM Mode. The concern here is that the RM specifically suggests using the advanced-control timers (TIM1, 8, 20) to generate the output PWMs. We are wondering if there is a need to use the advanced-control timers for this purpose, or if it would be possible to use some combination of channels from various other timers, such as the following combination:
TIM1, 8, 2, 3, 4, 5 - interfacing timers (using channels 1/2/3 on each)
TIM20_CH1/2/3 - PWM outputs to motor1
TIM15_CH1/2, TIM16_CH1 - PWM outputs to motor2
HRTIM1_CHA1/2, TIM17_CH1 - PWM outputs to motor3
HRTIM1_CHB1/2, HRTIM1_CHC1 - PWM outputs to motor4
HRTIM1_CHD1/2, HRTIM1_CHF1 - PWM outputs to motor5
HRTIM1_CHE1/2, HRTIM1_CHF2 - PWM outputs to motor6
In other words, can an “interfacing timer�? trigger outputs on specific timer channels (as shown above, including timers and are not TIM1, 8, or 20), rather than using one advanced timer for each motor as the RM suggests?
B) The alternative would be to use twoSTM32G4’s with at least three advanced (TIM 1, 8, 20) and three 4-channel general purpose (TIM 2, 3, 4, 5) timers on each, following more closely the setup described in the RM to control three motors with each STM32G4.
We are pretty sure solution B would work, IAW the suggestion in the RM. Would solution A also work? Are there other options or modifications that you would recommend?
2020-11-23 11:20 PM
Before you go to far, make sure you can configure the pins to the timers you want.
You cannot mix HRTIM1_CHA1/2 and TIM17_CH1 because they use different time bases and I don't think you can synchronize them.
I think solution B will work - do three motors with each STM32G474. I don't follow the timer assignment you describe. There are half bridge drivers that take PWM and Enable and with that configuration, you only need three PWM channels per motor. So, you need nine for three motors. You can generate all of these on the HRTIM1. You can also use TIM1, 8 and 20 for this.
Again, I would check that you can bring out the signals to the pins early in your design process.