Showing results for 
Search instead for 
Did you mean: 

Manual to configure hall/quadrature sensors in CubeMX

Senior II

I am quite a bit dissapointed, that it is not enough to have the following things:

- datasheet

- reference manual

- application note 4013 "cross-series timer overview"

- cubeMX configuration tool

and not beeing able to use them together, to set up the hall or quadrature sensor feature.

Maybe there are more datasheets and/or software tools needed?

From the reference manual alone, i could probably do it, but then, what is the cubeMX software for anyway?

It should take only a few clicks and few seconds to set this up. Or is this only in a commercial version?

Or does the problem sit in front of the screen?


cedric H
ST Employee

Hello @Tobe,

Could you describe what do you try to achieve?

What kind of motor do you want to drive? PMSM, ACIM, STEPPER ?

What kind of algorith do you want to use ? FOC, 6-STEPS ?

CubeMX allows you to initialize your peripherals according to the graphical configuration. It cannot create a full application. STM32 Timers have dedicated mode for doing Hall sensors measurement or making use of encoder - cubeMX allows you to configure the timers you want to use into the right mode. Once your timer is properly configured, you need the right software to take benefits from the hardware.

I do not know if you are aware of our MCSDK, but if you want to drive a PMSM motor with 6 steps or FOC algo, I encourage you to download it and give it a try.




Perhaps add some more details on what you're trying to do exactly. In particular, what hall sensor or quadrature part number are you working with?

If you feel a post has answered your question, please click "Accept as Solution".

As the title says: "configure hall/quadrature sensors in CubeMX".

I just found the "combined channels" option, which was to far down to be noticed by me...

I tried the MCSDK, but at the moment its useless for me. I cant export generated code, nor can i easily add a custom board.

Hello @Tobe,

If your point is to configure the timer to use Hall sensors, or encoder, then why don't you generate a project with the MCSDK and open the generated IOC with cubeMX ?

If your project selects Hall sensors or Encoder as primary or auxiliary speed sensors, then the IOC generated will contain the selected Timer properly configured. Up to you to duplicate this configuration into your own project.

Just out of curiosity, what do you mean by "I cant export generated code" ? and what is missing to allow you to add a custom board?

Best Regards



Hi Cedric,

I could not export the ioc with MCSDK. It said, no cubeMX installed. It is installed, but in another directory. And why cant it just beeing exported as a file, that so many programs can do?

The timer might be properly configured, but still it is not working, untill you enable it. I did not know.


Could you describe your configuration? It is weird that cubeMX is not found. Which version of cubeMX and MCSDK do you use?

What do you mean by " And why cant it just beeing exported as a file, that so many programs can do?"

Your IOC file is generated inside your motor control project folder, even if cubeMX is not found. The issue I can anticipate is that if cubeMX is not found the MotorControl package will not be deployed in the cubeMX repository and chances are high that cubeMX will not allow you to open the IOC because of missing package...

Regarding your last comment, be aware that cubeMX is only in charge of static configuration. Enabling or disabling the timer is the task of the application. 



IDE is 1.12.0

MX is 6.8.0


I mean why cant just the ioc file be generated without cubeMX?


> From the reference manual alone, i could probably do it

Then you should consider doing it that way.

> but then, what is the cubeMX software for anyway?

For rapid clicking of a selection of applications. If it does not work for you, maybe you should not push it.

Timers (including quadrature sensor readout) are relatively simple. Motor control may be challenging, though. Your choice.