[ ST32L152RE ] [periph_conf.h]

Hi everybody,

I have few questions about the PWM configuration pin on the periph_config.h [1] on STM32L152RE. The pwm.c file is already done, we were based on pwm.c stm32f3 discovery file. We also used this two manuals [2] [3].

What is the link between PWM_0_PIN_CH0 and PWM_0_PIN_AF ? Does PWM_0_PIN_AF refer to the GPIO_AFRL_AFRLX (X € [0…7] ) or the GPIO_AFRH_AFRHX (X € [8…15] ) in stm32l1xx.h ?

[1] : http://pastebin.com/bthJXJFP [2] : http://www.st.com/web/en/resource/technical/document/reference_manual/CD00240193.pdf [3] : http://www.st.com/web/en/resource/technical/document/datasheet/CD00277537.pdf

Kind regards

Tara.

Hi Tara,

the alternate function definition (PWM_x_PIN_x_AF) is meant for defining which alternate function the referneced pin is using. You can find the correct values for your configuration in the devices data sheet [1] on page 43ff, Table 9.

If you for example want to use PWM_0 with timer TIM2 and you want to map the PWM channel 0 to pin PA3, the value of AF is 1.

Let me know if anything is unclear!

Cheers, Hauke

[1]