2015-04-06 05:55 AM
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
2015-04-07 12:23 AM
Yes, it is someting that we already discovered in
/38f0550c
thread. We will fix in next version. Ciao Gigi2021-06-27 10:53 PM
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