DRV8353 and STM32G474 schematic review

Hi Everyone
Been learning a lot about Stm32 and ti Bldc drivers and finally decided to go ahead and build one. I’ve based my board from the moetus controller and the amulet controller, the amulet_controller schematic document was the best one i’ve ever seen.

i have attached the schematic i drew and need review any remarks or suggestion would be appreciated.

Thank you,
Kavin.




I can see a few mistakes in your schematic:

You forgot to connect the GND (VSS and VSSA) of the STM32. Your VDD is shorted to VDDA, when I think you intended for it to go through the ferrite bead. You also haven’t shown how you are generating the 3.3V for the microcontroller. I recommend using a buck converter, either buy the DRV8353RS which has it integrated or use an external one like the LMR36506. I do not recommend using the LDO as it is inefficient and will cause excessive heat generation.

You need to increase the value of your shunt resistors, with 0.2 milliohms, 40V/V amplification, and 3.3V VREF the linear current range will be (3.3-0.25)/2/40/0.0002 = 190 amps. This is way more than your MOSFETs can handle and it means the resulting signal going into the ADC will be small and your current sense accuracy will be poor. I suggest using 1 milliohm resistors, which can sense up to 38 amps.

You have also mixed up the order of SNA, SPA, SNB, SPB, SNC, SPC. You need to swap the SNx with SPx. Also SLA, SLB, SLC are from another variant of the chip (DRV8350). Make sure to read the datasheet carefully, the mixing of different variants is not always obvious.

The DRV8353 series of drivers are “smart” gate drivers, and they regulate the gate current of the MOSFETs, therefore the gate resistors are unnecessary and should be removed.

It is not recommended to add a lowpass filter to the CSA output, the datasheet rates the CSA slew rate at 10V/us for a 60pF load, if you add 1nF of capacitance it might slow down the CSA and you could get inaccurate current readings. Instead I suggest removing the low pass filter and setting your ADC sampling time to 2000ns (CSA settling time to 1% with 40V/V gain), during this time the CSA will charge the internal ADC capacitor.

You also need to add more capacitance to the motor supply, I suggest at least 1000uF. Look for electrolytic or polymer capacitors with low ESR and high ripple current rating. Using multiple capacitors in parallel is OK.

You have chosen TIM2 pins for the PWM signals, TIM2 is a general purpose 32bit timer. For motor control 32 bit timers are not necessary, with a 16 bit timer and 170MHz clock the minimum frequency is 2.6KHz. Usually motor PWM frequency is around 20-100KHz, so there is no need for a 32bit timer to achieve a lower frequency. I suggest moving the PWM pins to TIM1 or TIM8 which are advanced 16bit timers with more features than basic timers, and connecting the INL pins (to the N channels of the timer) as well. Alternatively you can use HRTIM (you chose a microcontroller with HRTIM as its main selling point), it allows complex waveform generation not possible with the other timers, but software support is not as good.

You should consider adding some communication interfaces so your motor driver can communicate with other electronics, such as exposing i2c, spi, canbus, etc. Also consider using the internal pullup resistor in the STM32 for the NFAULT pin, keep the external pullup for SDO if you want fast SPI speed.

I hope these suggestions help you improve your design.

2 Likes

That’s so detailed thanks a lot for your suggestion @Andrew . To be honest this is my first every Pcb design

I totally forgot this i corrected this.


This is my power setup and didn’t share it i have separate LDO for analog reference and buck converter for power.

Noted should i also remove the resistors???

I should divide that into three and place them near the mosfets right? I had a doubt of where to place them so i didn’t do that yet!

image
Is this your suggestion ?

I have a can bus communication.

EDIT:
i done the changes. As for the gate resistor do driver regulate the current automatically or we need net to set some config in the software?

Thanks again for your time
Kavin.

You need to increase the value of your current sense resistors, not decrease them. Your new current sense resistors are 0.1 milliohms which is even smaller than the original 0.2 milliohms. I suggest 1 milliohm for the sense resistors as it will provide allow sensing up to 38 amps, and the MOSFETs you picked can do 29 amps continuously.

Regarding your power setup, it is uncommon to put ferrite beads on the input of your buck converters, they usually go on the output. Putting them on the input will not have any significant effect because the biggest contributor to noise on the power rails will be the motor MOSFETs, not the buck converter. Unless you are trying to reduce EMI ferrite beads are probably unnecessary on anything except analog supply rails.

L3 is 22uH from your image, the TPS629206 recommends a 2.2uH inductor, and it won’t work well with a 22uH inductor.

You should also remove the resistors on the output of the CSA, just connect them directly to the ADC.

The capacitors should be places close to the MOSFETs, but they do not need to be that close, usually within 3cm is optimal. If they get in the way of routing other signals you can move them further away. If space and routing allows using 3 capacitors is better than one large capacitor.

Your PWM pins are configured correctly from the screenshot.

You use the SPI interface to communicate with the DRV8353 to set the drive current for the MOSFETs, after that the drivers will regulate the current to the value you set. When tuning it just set the highest current which does not cause any ringing or overshoot on the gate voltage, use an oscilloscope to measure this.

1 Like

So the value of the shunt resistor should be 0.3 milliohms okay can you tell me how do come up with value of the sense resistor is there can calculation for it?

As for the 22uH that’s my mistake it should be 2.2uH

Noted

You want to match the sense resistor with your sense amplifier gain and the input range of the ADC in order to maximize your “sensitivity” / resolution. Imagine your ADC has reference voltage of 3.3V (VDDA or Vref), and you are using an amplifier with gain of 50, and you know that your maximum current is 10A, then you can calculate the sense value like this: 3.3V / 50 => 0.066V before the amplifier to saturate the ADC, then you can use ohms law: R = V/I => R = 0.066V/10A = 0.006 ohms, or 6milliohm.

Use the formula (for bidirectional current sensing):

(vref - non linear region) / 2 / gain / resistance = max current.

In your case, vref = 3.3V, non linear region = 0.25V (from datasheet), gain = 40 (maximum value from datasheet), resistance = 0.0002 ohms

So the max current will be (3.3-0.25)/2/40/0.0002 = 190A. You want the maximum current calculated from this formula to be higher than the maximum motor current, but as close as possible to maximize the sensitivity.

With a 1 milliohm resistor the calculation becomes: vref = 3.3V, non linear region = 0.25V, gain = 40, resistance = 0.001 ohms. (3.3-0.25)/2/40/0.001 = 38A. 38A is more than your MOSFET continuous current rating, so it should be a big enough range for you.

1 Like

That’s so clear thanks. Now I’m trying to do the routing of the board I’ll share it once I’m done.

yes, this is a better formula, I forgot it is a bit different for bidirectional :smiley:
but the same idea applies in both cases, really

after some considerations i’ve decided to ditch the stm32g474 and going with stm32g431cb8t6 i’ve chosen all the pins for the mcu but can’t decide how to select the adc for the SOA SOB SOC can you suggest how to chose those three pins and their modes
My current config is like this

See Choosing ADC pins | Arduino-FOC for the way to do it if you are going to use SimpleFOC.

Also the reference manual if you are interested: https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

It is recommended to use the smaller channel numbers, regardless of whether you use 1 ADC or 2 ADCs, because the smaller channel numbers (lower than 5, see reference manual page 598) correspond to “Fast channels” and have slightly better performance.

Unfortunately the best way to do current sense is not currently supported by SimpleFOC, and it would be to have one of the outputs connected to ADC1, one of them connected to ADC2, and one of them connected to a shared ADC1 or ADC2 channel. This way software can choose on the fly which of the 2 phase currents to measure each PWM cycle, and the phase currents will be measured simultaneously. Other advantages of this are that you get to increase sampling time to increase measurement accuracy. Your max PWM duty cycle and max PWM frequency is also increased because the ADC sampling time is halved compared to using a single ADC, so the low side FET minimum on time is reduced. Increased PWM frequency also means your motor top speed will be increased as well.

okay i’m planning on using the simplefoc librabry only mabe later try to develop my own firmware so if i understood correctly for the three ADC oins i can choose any of the IN1 IN2 … of ADC1 for SOA and any of the IN1 IN2 … of ADC1 for SOB and other one shared what is mean by shared?

If you choose PA0, PA1, PA2 as the three pins you get the best of both worlds: SimpleFOC compatibility with ADC1 and PA0 and PA1 also have ADC2, so it will be possible to use both ADCs simultaneously with custom firmware.

I am working on a way to use multiple adcs with simplefoc. It works but it needs more testing.

So the PAO corresponds to SOA, PA1->SOB and PA2->SOC right?

The order does not matter. Choose whatever is easiest to route when you design the PCB.

The modes for the drv Fault is GPIO input right?

Yes. But its an open drain output, so it needs a pull-up resistor, and I would also include a series resistor to limit current.

can i use the internal pullup?

Yeah, it should be enough. On the other hand designing in a footprint for an external pull up has no cost (even placing the resistor costs next to nothing) so I’d generally design it in, even if I later don’t place if