cancel
Showing results for 
Search instead for 
Did you mean: 

Examples of sensored X-CUBE-SPN8 motor control with Hall sensor?

eBirdman
Senior
Posted on March 21, 2018 at 20:50

I found only more requests of the same in this forum and no answers. Using Hall sensors for motor control is most typical today. 6-step BLDC code example provided in X-CUBE-SPN8 is sensorless only. There are driver files in X-CUBE-SPN8 package specifically made for Hall sensored control (stm32f4xx_hal_tim_ex.c andstm32f4xx_hal_tim_ex.h) but no examples of usage found. Please somebody point to any example. I will keep posting this until somebody who knows will reply.

Thanks in advance.

#x-cube-spn8 #x-nucleo-ihm08m1 #sensored #motor-control #bldc #sensor #hall

Note: this post was migrated and contained many threaded conversations, some content may be missing.
24 REPLIES 24
Posted on April 23, 2018 at 14:06

Hello,

the X-NUCLEO-IHM08M1 embeds the Hall/Encoder connector but no code is available inside 6Step control (SPN8).

The hall sensor code is supported instead for FOC control, in case of change of control strategy we have the solution already available for BLDC/PMSM motor.

Best regards,

Giuseppe Scuderi

Posted on April 23, 2018 at 21:19

Hi Giuseppe,

I am also looking for a sensored solution for my BLDC. I came across this

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-library-expansion/stsw-stm32100.html

, which seems to be migrated to the  

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mcsdk.html

 V5.0.2. Is there a video or a document showing how to set it up?

Thanks,

Abdul

Posted on April 24, 2018 at 03:52

Giuseppe, please clarify: what do you mean by

'

The hall sensor code is supported instead for FOC control

field-oriented control is sensorless...  also what is

'we have the solution already available for BLDC/PMSM motor'

do you mean you have a solution/code example for Hall sensored motor control ? Where can we find it?

Regards

Vlad

Posted on April 24, 2018 at 12:22

Hi Abdul,

in case you are using the

/external-link.jspa?url=http%3A%2F%2Fwww.st.com%2Fcontent%2Fst_com%2Fen%2Fproducts%2Fembedded-software%2Fmcus-embedded-software%2Fstm32-embedded-software%2Fstm32-standard-peripheral-library-expansion%2Fstsw-stm32html

version, the UM1052 document contains the right info about it, for instance for Hall sensor take a look at ''8.3.3 Setting up the system when using Hall-effect sensors''. Consider that the parameters calculated must be filled in the ST Workbench tool (see image attached) in the section ''motor'' and select the settings in ''drive management->speed position....'' section.

Best regards,

Giuseppe Scuderi

0690X0000060AkSQAU.png

Posted on April 24, 2018 at 12:29

The FOC library supports both sensorless and sensored motor, you can use the ST Workbench tool to configure the IHM08M1 for Hall or Encoder mode.

Please take a look at the user manual

UM1052 for further info. The

/external-link.jspa?url=http%3A%2F%2Fwww.st.com%2Fcontent%2Fst_com%2Fen%2Fproducts%2Fembedded-software%2Fmcus-embedded-software%2Fstm32-embedded-software%2Fstm32-standard-peripheral-library-expansion%2Fstsw-stm32html

version or later contains the source code.

Best regards,

Giuseppe

Posted on April 25, 2018 at 01:26

Thank you Giuseppe for this info. Indeed it has everything for the Hall sensored implementation of motor control. I saw this software before but I did not check it out because of this note from STM     Migrate to STM32-CUBE-MCSDK     I searched for this new library and I found 

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mcsdk.html

just as Abdul found. Looks like this migration to a new library was already done by STM. This means that Hall sensor examples and library should be available in STM32-CUBE-MCSDK. Is it so?  Can we use this library with our  Nucleo-F401RE + X-NUCLEO-IHM08M1  ? Why does STM provide limiting package X-CUBE-SPN8 for those boards without Hall example?

Sincerely

Vladimir

Posted on April 25, 2018 at 01:35

Hello Giuseppe,

Thank you for your reply. I have looked into that document, it seems that it's written for the 

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-library-expansion/stsw-stm32100.html

, which is not available as far as I am aware. I only have the free version of the  

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-packages/x-cube-mcsdk.html

. The full version seems to be locked behind an NDA.

Please let me know if I got this wrong.

Regards,

Abdul

Posted on April 25, 2018 at 02:10

Hey Vlad,

This what I think the reason is. It seems like these code samples are prepared for high speed BLDC like the ones you find in UAVs

(more than 2000 rpm)

. In that speed range, the BEMF is enough to sense the rotor position from what I understand.

Anyways, I have the F401RE and IHM08M1, and I plan to try it out with the MCSDK. I do not know about your application, but mine is for high-torque low-speed BLDC hub motor for a mobile robot (250W, 300rpm, 40V), which why I want the sensored solution. I can update you with my progress if you would like.

The Motor Profiler doesn't support the F401RE, so I ordered the F302R8. I am going to use the Motor Profile to characterize my motor. until I get the new board, I will just use arbitrary values just to try to get it working.

Regards,

Abdul

Edgar Marx
Associate
Posted on April 26, 2018 at 10:24

Hi Vlad Blanshey,

On

https://www.youtube.com/watch?v=7vDJ9sWQqOk

you can watch a video and the side has a link to a

pdf-file for all the details in software and hardware.

Best regards

Posted on April 26, 2018 at 20:28

Thank you Edgar - good example of using STM32CubeMX  and generation of the phase switching from the Hall-driven interrupts.  I think the same could be done by using X-CUBE-SPN8 software from STM and only replace zero crossing BEMF event with Hall sensor switching event driving the phase switching interrupts. Doing this way allows more convenient code for fine tuning of synchronization which I need for my research. I am developing a new kind of motor and I need a convenient library for the fine tuning of switching and also of duty cycles.

Even more promising to me would be X-CUBE-MCSDK  if the code is clean and works as advertised. I and Abdul Fourteia will go this path.

Thanks again - neat work you've done and good presentation too!

Vlad.