Skip to main content
sanju
Associate III
April 23, 2018
Solved

i am working on stm32f030c6t6 microcontroller.

  • April 23, 2018
  • 6 replies
  • 1364 views
Posted on April 23, 2018 at 10:35

Hi all,

I am working on stm32f030c6t6 microcontroller. I want to use tim3_ch1 as pwm output. datasheet says that tim3_ch1 alternate function is available at two pins PA6 and PB4.

I am not able to find that which pin default for this tim3_ch1 function and if want to remap another pin then how to do it.

I have googled it. I found that in stm32f1 user manual there is a register AFIO_MAPR for remapping of pin for a alternate function.

But stm32f0 documents are silent on this.

so how I can do it this remapping of pin for a alternate function in stm32f0.

    This topic has been closed for replies.
    Best answer by waclawek.jan
    Posted on April 23, 2018 at 23:39

    suppose that if I configure both PA6 and PB4 in alternate function mode tim3_ch1 at same time.  and  tim3_ch1 as pwm then what will happen. will I get pwm at both pins?

    Good question, but ST apparently does not want to commit themselves by answering this question, otherwise it would have been already answered in the manuals.

    Read: if you set two pins to the same function, anything may happen - it may work as you expect in one chip, or not at all in other, and it even may depend on settings of other pins or something else.

    So, it's better to stay at the safe side, and never do this, even if this would make life a bit more complicated.

    JW

    6 replies

    Nesrine M_O
    Associate
    April 23, 2018
    Posted on April 23, 2018 at 11:00

    Hi

    sanjaykumawat8

    ,

    1. I recommend you to have a look to Timer example under the STM32F0 firmware package:STM32Cube_FW_F0_V1.9.0\Projects\STM32F0308-Discovery\Examples\TIM\TIM_PWMOutput:This example shows how to configure the TIM peripheral in PWM mode (Configure PB.04 (TIM3_Channel1), PB.05 (TIM3_Channel2), PB.00 (TIM3_Channel3),PB.01 (TIM3_Channel4))
    2. Please refer to8.3.2 I/O pin alternate function multiplexer and mapping section in the

      http://www.st.com/content/ccc/resource/technical/document/reference_manual/cf/10/a8/c4/29/fb/4c/42/DM00091pdf/files/DM00091pdf/jcr:content/translations/en.DM00091pdf

    -Nesrine-

    sanju
    sanjuAuthor
    Associate III
    April 23, 2018
    Posted on April 23, 2018 at 11:25

    I have read the section 8.3.2 I/O pin alternate function multiplexer and mapping .

    It simply says to select a alternate function of your interest available on that particular pin by using AFRL and AFRH register.

    that I understood. this is 'selecting a alternate function for a pin'.

    but I want to 'select a pin for a alternate function'.

    I also gone through the example it just configure PB4 in alternate function mode tim3_ch1 and tim3_ch1 as pwm.

    I am not going use cube mx and any standard library. I just want to do it by accessing SFR.

    suppose that if I configure PA6 and PB4 in alternate function mode tim3_ch1  and  tim3_ch1 as pwm then what will happen. will I get pwm at both pins?

    Nesrine M_O
    Associate
    April 23, 2018
    Posted on April 23, 2018 at 11:49

    Hi

    sanjaykumawat8

    ,

    The STM32F0 GPIO peripheral embeds new features compared to STM32F1 series:

    I/O pin multiplexer and mapping: pins are connected to on-chip peripherals/modules through a multiplexer that allows only one peripheral alternate function (AF) connected to an I/O pin at a time. In this way, there can be no conflict between peripherals sharing the same I/O pin.

    0690X0000060AcUQAU.png

    -Nesrine-