Electronic – Dealing with coupling of PWM noise into Hall-Sensors as spikes in BLDC driver circuit

analogbrushless-dc-motornoisepcbpwm

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

Best Answer

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.

Related Topic