cancel
Showing results for 
Search instead for 
Did you mean: 

Motor commutation using Hall feedback and the Timer input XOR gate

Kmax18
Senior

0693W00000FCA84QAH.pngI am planning to us the STM32F103 MCU for BLDC motor control. No encoder, only the usual three Hall sensors. I am attempting to use the XOR gate in Timer channel 1 that combines the rising and falling edges of all three Halls (Ref. Manual RM0008, page 332). See the enclosed diagram, where the red lines indicate the signal flow used for this feature (Ref. Manual RM0008, p. 382, Fig. 125).

Question: how is the Timer's Edge Detector configured to detect both rising and falling edges? I cannot find a reference for timers. (only for external triggers - ETR).

Thank you for your feedback!

4 REPLIES 4

> Question: how is the Timer's Edge Detector configured to detect both rising and falling edges?

You mean, for input capture within the same timer? In 'F103, there's no such option, but in newer STM32 (probably all except 'F1xx) there is.

The description in subchapter Interfacing with Hall sensors of RM0008 provides the intended usage mode: the 3 inputs are connected to an "interfacing" timer, e.g. TIM3, which is free running and where the "both edge" TI1F_ED signal is used as input to Slave-mode Controller in Reset mode; then one of the channels set to output mode provides a delay, after which the OCxREF from that channel is used as TRGO, which in turn is input as TRGI to the timer which actually controls the motor (TIM1).

You can use something similar as a workaround, if you want to capture both edges of incoming signal (xored or not); you don't need to actually have the "interfacing" timer running, you can set TRGO directly to Reset in TIMx_CR2.MMS.

JW

cedric H
ST Employee

Hello @Kmax18​ ,

I invite you to download the MCSDK-5.4.7 here

In this version, the STM32F1 is still supported, and you will be able to generate a project with the support of the Hall sensors.

Once the IOC is generated, you can open it with cubeMX and analyze how it is configured.

Please note that the STM32F1 is not recommended for new designs and its support ends with version 5.4.7

Hope it helps.

Cedric

Hello Cedric H, thank you for your reply. I will download the package.
What STM32 series is recommended for replacing the STM32F103? This is good timing. I plan to control two BLDC motors using one MCU and the discussed timer XOR feature.
cedric H
ST Employee

Hello,

If you want to control two BLDC motors with one MCU, I would recommend you a STM32G4 MCU.

All the MCUs that are supported by the MCSDK have the required hardware to support the Hall sensors.

Cedric.