Warm tip: This article is reproduced from stackoverflow.com, please click
embedded stm32 cortex-m cubemx stm32cubemx

STM32F302 PWM Input CubeMX Settings

发布于 2020-04-11 22:16:59

I am trying to set up PWM input on the STM32F302R8 to calculate frequency and duty cycle. In the STM32F302x8 reference manual, it says that we need to map IC1 to TI1 (CC1S = 01) and to map IC2 to TI1.

enter image description here

enter image description here

enter image description here

To match what the STM32F302x8 reference manual suggests, I need IC Selection to be Direct for Channel 1 and Indirect for Channel 2. I hardcoded the settings and the PWM inputs worked.

I wanted to set this up in CubeMX, but it only allows IC Selection = Direct. And having both channels as Direct does not work because the counter of IC channel 1 always returns 0.

enter image description here

enter image description here

What am I doing wrong here? I am unsure how to set up PWM input correctly in STM32CubeMX.

Questioner
Ken Lin
Viewed
47
Tagli 2020-02-02 18:26

I have almost no experience with CubeMX, but it seems you need to choose it from Channel2 drop-down menu in Mode window.

enter image description here