Skip to main content
Mikk Leini
Senior
Apr 6, 2015 12:55 PM UTC
Question

Wrong Hall sensors alternate function

Posted on April 06, 2015 at 14:55

Hi,

I'm using ST PMSM FOC 4.0 with STM32F303RB and Hall sensor. Hall sensors are on PORTC pins 6, 7 and 8. Used as TIM3 channel 1-3 inputs. Code is generated from the MC workbench. Symptom is - hall sensor signals are pulled low by the MCU. So i digged into peripheral registers with debugger and found that PC6, PC7 and PC7 have alternate function 1 which is EVENTOUT. They shoulduse AF2 which is TIM3_CHx. In library header file called SystemNDriveParams.h there's a struct which is initialized with Hall sensor alternate functions. There's also a default AF assignment:

/* TBR after final test with WB */
#if !defined(H1_GPIO_AF) 
#define H1_GPIO_AF GPIO_AF_1 
#endif 
#if !defined(H2_GPIO_AF) 
#define H2_GPIO_AF GPIO_AF_1 
#endif 
#if !defined(H3_GPIO_AF) 
#define H3_GPIO_AF GPIO_AF_1 
#endif

As the H1/H2/H3_GPIO_AF are not generated by workbench then they get the default values (AF1). Maybe the Workbench can be updated so it also generates correct alternate functions? #hall-alternate-function
This topic has been closed for replies.

2 replies

Gigi
ST Employee
Apr 7, 2015 7:23 AM UTC
Posted on April 07, 2015 at 09:23

Yes, it is someting that we already discovered in

/38f0550c

thread.

We will fix in next version.

Ciao

Gigi

Laurent Ca...
Senior III
Jun 28, 2021 5:53 AM UTC

The question has been moved from the "Motor Control Hardware" section to the "STM32 Motor Control" section (the question is about the STM32 MC SDK). 

Best regards