1
\$\begingroup\$

I have designed the first revision of a BLDC driver board (based on STM32 and DRV8323 chips). Right out of the bath (after writing the firmware of course) I noticed that the coupling of PWM into the hall signals is very terrible!

The motors that I have designed this circuit for are rated at ~20Watts. Their hall sensor only works at 5V or higher. I use the XOR mode of the STM32 timer to capture and generate commutation event...the STM32 is 3.3V...but I assume it can tolerate 5V input but I do not know what is the hysteresis for detecting a low or high signal when the GPIO pins are configured in XOR mode:

hall to xor

At below 100% PWM, I get a lot of noise. The yellow trace is one of the hall sensors (the blue is commutation event). I only have 2 probes so I could not capture all 3 sensors and the commutation event (pulling an gpio high and low before and after updating timer output). As you can see, the noise over the hall sensor is quite bad:

hall sensor noise in scope

I blame 2 things:

1.The layout: As I did not have prior experience, and because there are 2 motor connectors, I routed the hall sensors very close to the phase signals (greens are phases and yellow are halls). enter image description here enter image description here

2. Motor Cable: The motor cables are just 8 wires next to eachother (no twisting) for almost 50cm...so even if I did the best layout in the PCB the cable itself would cause the coupling issue.

I have tested the driver with 100% PWM (meaning no switching) and everything looks much better (the noise is very small and limited to when the half bridges switch at hall sensor update). So I really need to take care of this noise. I know that I can mitigate this effect in the software (e.g. by inserting timeout and other filtering methods...) but nothing can beat having a nice clean signal anyways.

So to make it short here is my questions:

1) What can I improve in the layout? separation of hall sensors and phase signals into different connectors?**

2) I will tear apart the motor cable and separate halls from phases and make them twisted pair...before I commit this, do you think it makes sense?

3) Should/Can I use a level-shifter and perhaps a Schmidt trigger to remove the noise and convert 5V to 3.3V before feeding it into the STM32 controller? If so, what chips do you suggest?

UPDATE:

Here is the RC filter for hall sensors, placed near MCU input. enter image description here

\$\endgroup\$
13
  • \$\begingroup\$ Where is the ground of hall sensors? Sure the power section is usally is separated from analog/digital input with separated grounds. Makes no sense to put everything so close. \$\endgroup\$ – Marko Buršič Sep 2 '18 at 15:07
  • \$\begingroup\$ @MarkoBuršič every thing is connected to the same ground \$\endgroup\$ – Sean87 Sep 2 '18 at 15:56
  • \$\begingroup\$ One simple practical solution is to just apply an RC filter to the hall sensor output before feeding it to the processor. \$\endgroup\$ – mkeith Sep 2 '18 at 19:22
  • \$\begingroup\$ If you are doing an RC anyway, you can also level shift the 5V down to 3.3 with a voltage divider. I am not at all sure that the STM32 is designed to accept 5V. The datasheet will certainly say. \$\endgroup\$ – mkeith Sep 2 '18 at 19:26
  • \$\begingroup\$ @mkeith I indeed have the RC filter in place...but it does not help with the amplitude of the noise spikes...it only reduce them by a bit...also it increases the rise time by a bit... \$\endgroup\$ – Sean87 Sep 2 '18 at 20:32
2
\$\begingroup\$

Here is basically what I have (I also have a ferrite bead in series right at the connector, but that is for EMI, not part of the low-pass filter):

schematic

simulate this circuit – Schematic created using CircuitLab

Here is what I would suggest for you, since you also want to reduce the voltage from 5V to 3.3V. The RC time constant (ignoring the 1k) is the product of R2 and R3 in parallel and 56pF. R2 and R3 in parallel is 10k, so, it is pretty close to the same time constant as my circuit. You can experiment with different values of capacitor to change the time constant, but I suspect you will see a large benefit from this. The rise time is around 500 or 600 ns, which should be OK.

schematic

simulate this circuit

Put the cap close to the processor. Resistor can be close, also, but that is less critical than making sure the capacitor GND connection is close to processor GND connection.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks! I will try this out. Just one question... Isn't using a dedicated level shifter IC a better choice than a divider network? \$\endgroup\$ – Sean87 Sep 3 '18 at 9:41
  • \$\begingroup\$ @Sean87, from what I can see now, the resistor divider will work well. It is cheap, simple, and (I believe) will work, so I don't feel like a level-shifter IC is any better. But, I suppose my opinion could change with new information. \$\endgroup\$ – mkeith Sep 3 '18 at 16:48
1
\$\begingroup\$

I think you might find that it isn't a routing problem but that the Hall sensors are picking up the actual magnetic field from the motor windings. I've got the same problem and my signal routings are well separated.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for sharing :) any updates on your side? \$\endgroup\$ – Sean87 Mar 16 '19 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.