cancel
Showing results for 
Search instead for 
Did you mean: 

i am working on stm32f030c6t6 microcontroller.

sanju
Senior
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.

1 ACCEPTED SOLUTION

Accepted Solutions
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

View solution in original post

6 REPLIES 6
Nesrine M_O
Lead II
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-

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?

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-

Posted on April 23, 2018 at 12:08

I am getting your point. I am very clear that two alternate function can not conflict same pin because multiplexer will choose any one function not two or more, so how they can conflict. it is cleared to me.

lets see this:

Bits 11:10

TIM3_REMAP[1:0]:

TIM3 remapping

These bits are set and cleared by software. They control the mapping of TIM3 channels 1 to

4 on the GPIO ports.

00: No remap (CH1/PA6, CH2/PA7, CH3/PB0, CH4/PB1)

01: Not used

10: Partial remap (CH1/PB4, CH2/PB5, CH3/PB0, CH4/PB1)

11: Full remap (CH1/PC6, CH2/PC7, CH3/PC8, CH4/PC9)

Note: TIM3_ETR on PE0 is not re-mapped.

this is mentioned in stm32f1 reference manual that using AFIO_MAPR[11:10], you can remap tim3_ch to your pin of your choice.

but this thing is not mentioned in stm32f0 documents.  

I want to select 'a pin of my choice for a alternate function'. not 'a alternate function of my choice for a pin'.

I repeat my question

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?

here I am not using two alternate function on single pin. I am using single alternate function on two pins.

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

Posted on April 24, 2018 at 05:32

Thank you so much dear,

you are really very helping person. thanks again for help and  being here.