Showing results for 
Search instead for 
Did you mean: 

Getting started with Design for stm32 Motor Control based solution

Amrit Singh
Associate II
Posted on June 11, 2018 at 11:32


I have recently moved from Cypress to ST, and might need help getting up and running here. 

My end goal is to build a sensorless (not necessarily FOC) motor controller for a 250W Motor for a high volume application.

My software setup is:  st4stm32, Xcube MC SDK, ST32 cube MX

My issue is with the hardware setup required for the sensorless control to work. The MCU, gate drivers and 6x FET setup is in place, but I cant figure out the feedback topology that is required for the MCSDK to work, i.e. does it need external OPamps to amplify the current shunt or does it need comparators that work with the virtual neutral & backemf lines to give a High/Low signal similar to hall sensors with a phase shift or something else ?

If someone can point me in the correct direction that would be of great help!

Kind note: My previous experiences have been with sensored applications, so I understand the commutation principles.

cedric H
ST Employee
Posted on June 11, 2018 at 17:05


Do you already have some hardware or are you in the process of designing a custom board ? 

If you do not have HW yet, I would suggest you to have a look in ST control boards and power boards.

Basically, for FOC we do not need Bemf sampling (we need it for 6 steps). We read current that need to be amplified. We support 1 shunt or 3 shunts or ICS topology. Amplification can be done externally or internally if you use a STM32F303 for instance, the same for comparators used for over current protection.

Our tool configuration ST Motorcontrol Workbench will allow you to configure this. Of course it will be much easier if you start from ST offer, as parameters are already known from the tool.

A good starting point could be the download of our 5.1.1 library here :


it contains the configuration tool ST Motorcontrol workbench.



Posted on June 12, 2018 at 13:40

I have some hardware, it includes:

- Gate drivers

- 6 MOSFET setup

- PSOC4 - hall sensor based control

I am trying to move to sensorless control for which I shall make a new board.

This is what I have concluded from your comment:

- BEMF is sampling is needed when I run the motor in 6 step - sensor less mode (which I am not planning to)

- For FOC I will have to go with a 1/3 shunt profile or insulated current sensors.

Q:When I go to setup the shunt, I get this, should I stick to default values - making sure it covers my current range or do I need to adjust the gain settings or something else ? I am missing the objective of configuring this.


Posted on June 14, 2018 at 10:55


I really advise you to look at our power boards solution. All our schematics are available for free.  

I do not know what is your VBUS, but perhaps you can start with this reference :


the schematic is here :


This board can do both, 3 Shunts 1 shunt FOC , or Six steps. keep the parts that make sense for you .

As you choose a Cypress PSOC4 controller, our workbench tool will be useless for you ... 



If you agree with my answer, please accept it by clicking on 'Accept as solution'."
Laurent Ca...
Lead II

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

Best regards