cancel
Showing results for 
Search instead for 
Did you mean: 

Reading HALL Sensors values from HALL interface

Zek_De
Senior

Hi dear members,

I am trying to understand complete how to drive bldc motor.And I would like to use hall interface in stm32.how can I manage to read commutation using hall sensors which registers I couldn't find it in reference manuel.And also how can I configure prescaler if motor is low speed because datasheet say "Program the time base: write the TIMx_ARR to the max value (the counter must be cleared by the TI1 change. Set the prescaler to get a maximum counter period longer than the time between 2 changes on the sensors" set the prescaler is hard like that

6 REPLIES 6
Eleon BORLINI
ST Employee

Hi @Community member​ , which is the name / part number of the device (hall sensor) you are using? Regards

jerry2
Senior

There are several ways to read a Hall sensor. One way is to simply poll three I/O ports connected to the Hall sensor on a periodic basis, for example, in a timer interrupt handler.

You can also use one of the timers in input capture mode to read the sensor. Some of the STM32 timers have a way of XORing three inputs into a single signal that transitions on all rising and falling edges of the Hall inputs. These transitions also capture the value of the timer's counter in a register that you use to determine the rotational speed of the motor.

With regards to low motor speed, you will run into cases where the motor is turning so slowly that the timer overflows before a Hall transition occurs. You can mitigate this by increasing the timer prescaler to a larger value. Increasing the prescaler value will result in lower precision of the timing of the Hall transitions, so beware of increasing it more than necessary.

Zek_De
Senior

hi guys, sorry to late answer, thank you for information and how can I read hall values without using gpıo read.I have read the datasheet but I couldnt see the point.Are these TI1,TI2,TI3 ?

Zek_De
Senior

Also I can use gpıo interrupt to read sensors,why should I use hall sensors interface, so that I dont have to take care about timer overflow?

Zek_De
Senior

Furthermore , as much as I get it, overflow is not important during the slow rotation,because it is gonna be overflow and go into interrupt and I m gonna check it and still no commutation and continue to same pins energy and again start to count from 0 ?

Zek_De
Senior

" Also I can use gpıo interrupt to read sensors,why should I use hall sensors interface, so that I dont have to take care about timer overflow? "

Okay, This way seems clearly wrong because of interference.Sorry for noobie words.