嗨,
我正在使用带有
STM32F303RB和霍尔传感器的ST PMSM FOC 4.0。霍尔传感器位于PORTC引脚6,7和8上。用作
tiM3通道1-3输入。代码从MC工作台生成。
症状是 - MCU将霍尔传感器信号拉低。所以我用调试器挖掘外设寄存器,发现PC6,PC7和PC7具有EVENTOUT的备用功能1。他们应该使用AF2,它是TIM3_CHx。
在名为SystemNDriveParams.h的库头文件中,有一个用霍尔传感器备用函数初始化的结构。还有一个默认的AF分配:
由于工作台不生成H1 / H2 / H3_GPIO_AF,因此它们获得默认值(AF1)。也许Workbench可以更新,因此它也可以生成正确的备用功能?
#霍尔复用功能
以上来自于谷歌翻译
以下为原文
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 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 */
- &sharpif !defined(H1_GPIO_AF)
- &sharpdefine H1_GPIO_AF GPIO_AF_1
- &sharpif !defined(H2_GPIO_AF)
- &sharpdefine H2_GPIO_AF GPIO_AF_1
- &sharpif !defined(H3_GPIO_AF)
- &sharpdefine 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?
#hall-alternate-function