embeddedstm32cortex-mcubemxstm32cubemx

STM32F302 PWM Input CubeMX Settings


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.


Solution

  • 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