Would appreciate some feedback on a DRV8317 + STM32G431 schematic

I’ve been through most of the schematic review topics here, which have been very helpful. Before proceeding to the PCB design, I’d appreciate if someone could review my schematic. The main components are an STM32G431CBUx, TI DRV8317H, and AS5047D magnetic encoder. The motor itself is a 12V, max 1.3A (stall current) BLDC motor with hall sensor feedback.

This is the STM32CubeMX layout:

Thank you!

2 Likes

Hi Daan87423,

I’ve had a quick look at your schematic, and I cannot see any major issues. I have a few suggestions which may improve your design.

If you think the buck converter is overkill, you can use the DRV8316 which is very similar to the DRV8317, supports more voltage and current, and has an integrated buck converter up to 200mA. Alternatively, if you don’t mind lower efficiency, you can use the integrated 3.3V LDO (on AVDD) to power the microcontroller, which supports up to 80mA. STM32 uses 65mA under worst case scenario with all peripherals enabled, and encoder uses 15mA worse case, so you have just enough power.

Consider connecting the incremental encoder interface (ABI) to your microcontroller as well, the incremental encoder interface is much lower latency and it will perform much better than reading the angles from SPI. The datasheet says the latency of SPI readings is around 100us, while it is 2us on the ABI interface after angle error correction.

Consider changing the ADC pins used on the microcontroller to favor lower ADC channel numbers. This is because the lower channel numbers are “fast channels” and have slightly better performance. I suggest pins PA0, PA1, PA2.

Hope this helps,
Andrew

1 Like

Great feedback Andrew, thank you. You convinced me to switch to the DRV8316C, it’s a bit more expensive but the integrated buck makes up for it. Do you recommend placing an LDO after the buck to reduce ripple? I see the buck voltage can be set to 4V for this. I’m mostly concerned about the STM VREF stability which is used for the current sensing. In STM’s AN5690 they mention that VREF is “is based on a low‑drop output regulator design”, so maybe another LDO is overkill.

The encoder is tracking a very slow rotating pulley (<100rpm), so the 100 µs is more than enough. Thank you for the suggesting though. I’ll be changing the ADC pins to your suggested pins. Thanks again

I agree strongly with this, especially as you have lots of spare pins… connect A and B to channels 1 & 2 of a general purpose time to use the encoder mode.

Otherwise it looks good to me :slight_smile:

2 Likes

Updated schematic with DRV8316C. Due to the integrated buck requiring nSLEEP to be pulled high, it is always driven high by the voltage divider. Should there be a small 0.1uF capacitor here to stabilize the voltage?

Meanwhile I’ll look more into the ABI interface of the AS5047 and if it benefits the application

Your design looks fine as is, I wouldn’t recommend an additional LDO after the buck as digital circuitry is not noise sensitive, and you already have a filter for the analog supply, which is going to be good enough.

In my design using the DRV8316, I used the internal AVDD LDO directly as analog supply voltage and reference voltage, as I wanted a 3.3V reference voltage, however I think your approach is better as it is higher efficiency.

You can consider replacing R3 with a 3.3V zener diode, so you can get a wider range of operating voltages. A capacitor is unnecessary here.

1 Like

Finished the layout, it’s a 4 layer board with SIG/PWR, GND, GND, SIG/PWR. Doubting about the current sensing part and the PWM traces.

The A/B/C current sense traces go through a 1k resistor and 30pF capacitor close to the STM32. The layer below is fully poured with GND. Bottom right are the inductor and capacitor of the buck.

Here are the 6x PWM traces.


Since the timer pins of the STM32 don’t match the order of the DRV8316C I had to route them to the 4th layer and back. Will this cause any issues?

The current sensing traces are probably fine, although the component values are slightly off from datasheet recommendations.

You might want to check your schematic for the PWM pins as I think the order of some of them might be swapped. Also there is no need to put GND between the PWM traces, just route them next to each other to save space.

1 Like

Thanks Andrew, I just checked the component values and maybe they changed them from DRV8316 to DRV8316C. They should be 1k/30pF.

Also I double checked the PWM pins of the DRV8316C, I’m pretty sure they are correct. Are you referring to the STM32 TIM1 PWM pins?


I’m assuming that CH1 should be connected to INHA, and CH1N to INLA. Is that correct?

I see 330 ohm and 22pf as the recommended values for the filter, from page 73 of the drv8316c datasheet.


Your PWM pins configuration in STM32CUBEMX looks fine, and when using 6x PWM you have to make sure the CHx needs to be connected to INHy and CHxN needs to be connected to INLy. Currently you have them swapped on the STM32 side. Connecting CH1 to INHA, and CH1N to INLA is one way to do it.

1 Like

Wow good catch on both! I did not see the PWM pins were swapped. Thanks a lot