cancel
Showing results for 
Search instead for 
Did you mean: 

PWM for Tim15.2 on STM32L476 not working

Paul1
Lead

I have 4 PWM out working fine on Tim3.Channel1,2,3,4

But the fifth PWM isn't working Tim15Chan2 (PB15=LQFP64pin36)

The pin works fine as GPIO so I know it is wired fine.

I even tried it as PWM Tim1.Chan3N and PWM Tim8.Chan3N but neither of those work either.

I don't see anything in L476 Errata.

Any idea what I'm doing wrong? What is difference between Tim15.2 PWM versus Tim3.2 PWM that would give me trouble?

Using latest STM32Cube MX, IDE, and Compiler.

Paul

1 ACCEPTED SOLUTION

Accepted Solutions

All TIM15 registers read as 0, that means that you either don't program TIM15, or, more likely, you don't enable the TIM15 clock in RCC. Have a look at content of RCC_APB2ENR, TIM15EN is bit 16 in it.

GPIOB registers also doesn't seem right, the bitfield in GPIOB_MODER corresponding to PB15 is set to 0b11 which is Analog (you also wrote in that picture PB14, was that intentional?)

After you solve all that, make also sure TIM15_BDTR.MOE is set.

I don't use Cube/CubeMX so don't know how to fix it in that environment, sorry.

JW

View solution in original post

5 REPLIES 5

Read out and check/post TIM15 and relevant GPIO registers content.

JW

Hope attached has clues to my problem (Runtime SFR, Code, MX Settings, Tool Versions):

  • PWM_TIM15.2_STM32L476_PR2.docx

Paul

All TIM15 registers read as 0, that means that you either don't program TIM15, or, more likely, you don't enable the TIM15 clock in RCC. Have a look at content of RCC_APB2ENR, TIM15EN is bit 16 in it.

GPIOB registers also doesn't seem right, the bitfield in GPIOB_MODER corresponding to PB15 is set to 0b11 which is Analog (you also wrote in that picture PB14, was that intentional?)

After you solve all that, make also sure TIM15_BDTR.MOE is set.

I don't use Cube/CubeMX so don't know how to fix it in that environment, sorry.

JW

Paul1
Lead

JW,

Thank you, I will try your advice today

(My Typo, should have been PB15, I'll fix my doc)

I'll post solution here when it works.

Paul

Paul1
Lead

JW,

It worked, your points led me to a bug in my own coding.

Thank you

Paul