AnsweredAssumed Answered

Wrong Hall sensors alternate function

Question asked by Mikk Leini on Apr 6, 2015
Latest reply on Apr 7, 2015 by Gigi

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 should use 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
#if !defined(H2_GPIO_AF)
  #define H2_GPIO_AF GPIO_AF_1
#if !defined(H3_GPIO_AF)
  #define H3_GPIO_AF GPIO_AF_1

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?