2018-04-23 01:35 AM
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.
Solved! Go to Solution.
2018-04-23 04:39 PM
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
2018-04-23 02:00 AM
Hi
sanjaykumawat8
,-Nesrine-
2018-04-23 04:25 AM
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?
2018-04-23 04:49 AM
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.
-Nesrine-
2018-04-23 05:08 AM
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.
2018-04-23 04:39 PM
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
2018-04-23 10:32 PM
Thank you so much dear,
you are really very helping person. thanks again for help and being here.