Using Hall Sensor Interface of STM32F3/F4

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Post Reply
daniel_s
Posts: 9
Joined: Tue Dec 08, 2015 1:45 pm

Using Hall Sensor Interface of STM32F3/F4

Post by daniel_s »

Hi Giovanni,
I intend to use the Hall Sensor Interface, provided by e.g. STM32F3 or F4.
To do so, an interfacing timer is needed to be configured, to capture any Hall sensor change (a Special XOR-functionality allows, to use only one channel for this purpose). This can be seen as an ICU functionality.

Furthermore, the same interfacing timer shall be used to generate a positive pulse after a programmed delay (in Output compare or PWM mode).

To implement this functions with ChibiHAL, I have to add specific low-level functions of course.
But, I generally don't know which driver (PWM, ICU, TIM) shall be used for the described interfacing timer?
Do you have any suggestions, how to deal with this problem?

Regards,
Daniel
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Using Hall Sensor Interface of STM32F3/F4

Post by Giovanni »

Hi,

The solution could also be a custom driver written following the HAL templates. Could you provide some documentation about the protocol? Using the timer for capture and also pulse generation is something I never did.

Giovanni
daniel_s
Posts: 9
Joined: Tue Dec 08, 2015 1:45 pm

Re: Using Hall Sensor Interface of STM32F3/F4

Post by daniel_s »

Hi,
how to interface with Hall sensors is described e.g. in ST Reference Manual RM0316 for STM32F303... in chapter 20.3.23:

Link to Manual:
http://www.st.com/web/en/resource/technical/document/reference_manual/DM00043574.pdf

Daniel
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Using Hall Sensor Interface of STM32F3/F4

Post by Giovanni »

I missed that.

It is two timers not one. I think you should create a custom driver for the interfacing timer, it just does setup because there is no API required except start(). The second timer could use the PWM driver but I am not sure about the required changes. The manual mentions some bit manipulation in an ISR, not sure if that could go into an existing callback.

Giovanni
Post Reply