Skip to content

[ENHANCEMENT] (STM32) BLDCDriver3PWM driver can't use negated PWM outputs #220

Open
@hp1210cl

Description

@hp1210cl

I am working with stm32f303cbt6 mcu under STM32duino. I created BLDCDriver3PWM driver in arduino code. The phA is PB13, phB is PB14, phC is PB15. When I used DEBUG mode, I got the following infos:

TIM1-CH1N TIM1-CH2N TIM1-CH3N score: -3
TIM1-CH1N TIM1-CH2N TIM15-CH1N score: -3
TIM1-CH1N TIM1-CH2N TIM15-CH2 score: -3
TIM1-CH1N TIM15-CH1 TIM1-CH3N score: -3
TIM1-CH1N TIM15-CH1 TIM15-CH1N score: -3
TIM1-CH1N TIM15-CH1 TIM15-CH2 score: -3
STM32-DRV: no workable combination found on these pins
STM32-DRV: ERR: not find Best Timer Combination
MOT: Init not possible, driver not initialized

It seems that the library cann't find the best timer combination. According to the STM32F303CBT6 datasheet, TIM1_CHIN TIM1_CH2N TIM1_CH3N should be found and used as pwm output.
When I change the phA phB phC to PA4 PB0 PB1, I got the follwing debug infos. And the motor worked fine.

TIM3-CH2 TIM1-CH2N TIM1-CH3N score: -3
TIM3-CH2 TIM1-CH2N TIM3-CH4 score: -3
TIM3-CH2 TIM1-CH2N TIM8-CH3N score: -3
TIM3-CH2 TIM3-CH3 TIM1-CH3N score: -3
TIM3-CH2 TIM3-CH3 TIM3-CH4 score: 1
TIM3-CH2 TIM3-CH3 TIM8-CH3N score: -3
TIM3-CH2 TIM8-CH2N TIM1-CH3N score: -3
TIM3-CH2 TIM8-CH2N TIM3-CH4 score: -3
TIM3-CH2 TIM8-CH2N TIM8-CH3N score: -3
STM32-DRV: best: TIM3-CH2 TIM3-CH3 TIM3-CH4 score: 1
STM32-DRV: Configuring high timer 3
STM32-DRV: Configuring high channel 2
STM32-DRV: Configuring high timer 3
STM32-DRV: Configuring high channel 3
STM32-DRV: Configuring high timer 3
STM32-DRV: Configuring high channel 4
STM32-DRV: Restarting timer 3
MOT: Init
MOT: Enable driver.

I think some bugs is hiding in the stm32_mcu.cpp, but I don't know where are they.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions