Skip to main content
nmamore
Associate II
July 24, 2020
Solved

Hall Sensor Control w/ STEVAL-SPIN3202

  • July 24, 2020
  • 6 replies
  • 1779 views

I am using the MC Workbench tool to drive a 3-Phase BLDC Motor with Hall Sensors. I have enabled the hall sensors in the workbench, downloaded the code and flashed my board. How do I actually use the Hall sensor to control the speed? No matter what speed I set, the motor will always go to its max.

This topic has been closed for replies.
Best answer by Enrico Poli

By default the board is configured for the sensorless driving.

Before using the Hall sensors you have to close JP5-JP6-JP7 solder bridges and open the JP9-JP10-JP11 ones.

If you are using the 6STEP algorithm, check the configuration of JP8, J11 and J12 jumpers too:

  • JP8 closed 1-2 position
  • J11 open
  • J12 closed

6 replies

Enrico Poli
ST Employee
July 27, 2020

By default the board is configured for the sensorless driving.

Before using the Hall sensors you have to close JP5-JP6-JP7 solder bridges and open the JP9-JP10-JP11 ones.

If you are using the 6STEP algorithm, check the configuration of JP8, J11 and J12 jumpers too:

  • JP8 closed 1-2 position
  • J11 open
  • J12 closed

nmamore
nmamoreAuthor
Associate II
July 27, 2020

Hello Enrico,

Thank you for assisting me again. I have configured all the jumpers for FOC with Hall Sensor. I also have close the necessary solder bridges and opened the other ones like you mentioned. I can tell in code that the Hall Sensor is being read, and it is being read correctly! When I run the motor it doesn't seem to actually do anything with that values it gets from the Hall Sensor. Is there any example code for Hall Sensor that I can use for reference?

Enrico Poli
ST Employee
July 28, 2020

I attached a project based on the SDK5.4.4

In this project I also enabled the virtual DAC feature that could be very useful for real time monitoring internal variables.

The virtual DAC generates a 20kHz PWM on PA7 with a duty-cycle proportional to the value of the monitored variable (e.g. electrical angle). Low-pass filtering it you can plot on your oscilloscope any FOC variable ant put it in relation with other electrical signals.

The monitored variablke can be selected through the MC Workbench Monitor in the "Advances" tab

In order to use it you must make some minor change on the board:

  • Remove R9
  • Connect a low pass filter on TP12 (connected to PA7)

nmamore
nmamoreAuthor
Associate II
July 31, 2020

Enrico,

My issue ended up not being quite what I thought it was. My electrical angle was in motor parameters was incorrect. Your solution made me realize this, and I adjusted it to match your value and now I can control it! When adjusting the motor to low speeds I find that it oscillates, is this something I should adjust with the parameters for PID?

Thanks for the help,

Nick

Enrico Poli
ST Employee
July 31, 2020

Glad to know you found the issue Nick :)

The oscillation issue could be caused by PID instability as you said, but when you run the motor at very low speed you have two other issues:

  • speed feedback update is "slow" because the algorithm updates the value at each Hall sensor commutation.
  • Voltage required to run the motor at low speed is small, so you could have some resolution issue. Basically the right voltage for your target speed is in-between two "steps" of the PWM generator.

If you are in the second case, try adding some direct current to the control (Id in the advanced tab of the monitor). In this way you slightly reduce the efficiency, but the system returns working with higher output voltages.

Laurent Ca...
Senior III
June 22, 2021

The question has been moved from the section "Motor Control Hardware" to the "STM32 Motor Control" section (the question is about the STM32 MC SDK). 

Best regards