cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F100RBT6 TIM15_CH1 and TIM15_CH1N complementary pwm mode does not generate the complementary output

FAleg.1
Associate II

STM32F100RBT6 TIM15_CH1 and TIM15_CH1N complementary pwm mode does not generate the complementary output

I have a problem with my complementary output generation at Timer 15 Channel 1. I have set all parameters at CubeMX and have set

HAL_TIM_PWM_Start(&htim15,TIM_CHANNEL_1);

HAL_TIMEx_PWMN_Start(&htim15,TIM_CHANNEL_1);

inside USER CODE BEGIN 2.

The output for PB14 (TIM15_CH1) works very well but PB15 (TIM15_CH1N) is always set to 0 and nothing actually takes place. I don't know what is wrong since I have set all parameters the way I always do when dealing with for instance TIM1 for complementary output.

Below there is an image with further details regarding the pins and features I am using in the microcontroller.

Thank you in advance.

0693W000003PPEjQAO.png

11 REPLIES 11

Read out and check/post content of TIM and relevant GPIO/AFIO registers.

JW

prain
Senior III

Did the ST standard example work?

​https://github.com/STMicroelectronics/STM32CubeF1/tree/master/Projects/STM3210E_EVAL/Examples/TIM/TIM_ComplementarySignals

When I use TIM1 it works fine, but as soon as I try TIM15 the system only enables the non-complementary output, whereas the complementary remains inactive I don't know why.

I have read and I could enable the TIM15 non-complementary output (PB14). The complementary (PB15) has not been enabled though, and that makes no sense since I have enabled all things properly (I guess so) on CubeMX and the complementary is working the way I have set it.

> The complementary (PB15) has not been enabled though,

You mean TIM15_CCER.CC1NE = 0? Then you either find the bug in Cube which prevents it from being set, or simply don;'t use Cube.

JW

I tried setting TIM15_CCER.CC1NE=1 at the start up functions before while(1) yet it didn't work and only the non-complementary output is working. I'm struggling in order to find what is causing this failure.

Read out and post content of TIM and relevant GPIO/AFIO registers.

JW

KKrag.1
Associate II

See an old post about a missing setup of the complementary output:

https://community.st.com/s/question/0D50X00009XkZaBSAV/hal-bug-report-f4xx-timer-complimentary-outputs?t=1604270842087

It seems the MX cube has a bug so it wont create complementary output (CH1N)

I had a simelar example where I needed to add this to the code:

HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);

Cheers

Klaus

> HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);

Isn't the same line mentioned in the opening post?

JW