cancel
Showing results for 
Search instead for 
Did you mean: 

What is RCC_APB2Periph_AFIO clock signal?

sholojda
Associate III
Posted on March 20, 2012 at 06:20

Hi. Could You help me to understand somethink. In STM32 like STM32F103c8... there is a clock signal called RCC_APB2Periph_AFIO. When should be turned on this signal, always when I use peripherial, like Timmer, AD, USART or I2C or maybe when I used pins attached to this peripherial?

Why we turn on this clock and also we give clock to the peripherial like ADC, SPI, USART? Why not only to ADC, SPI, USART but also to AFIO?
7 REPLIES 7
Posted on March 20, 2012 at 06:32

According to the manuals AFIO deals with Pin Remapping and EXTI

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 20, 2012 at 07:17

You've already asked exactly the same question on the Keil forum:

http://www.keil.com/forum/20579/

There, you have been pointed to the Reference Manual for the STM32F103c8.

Have you studied that Reference Manual yet?

You really need to take time to get familiar with that document!

In particular, look at the System Architecture and Clock Tree descriptions - including the diagrams...

sholojda
Associate III
Posted on March 20, 2012 at 08:03

Yes, I wrote there but they told me write on this forum.

Answering to next question, I read RM but I could not find nothing about clock signal called AFIO. If you could, please show me where I can find something about it? I do not know if this clock (to AFIO) should be turned on if I used remapped pins (I mean, instead of using dedicated pin for TIM3_CH1 like PA6 I used full remappig on PC6) or AFIO should be used if instead of GPIO I use I2S?

Posted on March 20, 2012 at 19:58

The RM is a PDF document; it has a 'Search' facility - so just put ''AFIO'' into the 'Search' facility to find out about it...

From RM0008 - pag. 175/1132

"9.3 Alternate function I/O and debug configuration (AFIO)

To optimize the number of peripherals available for the 64-pin or the 100-pin or the 144-pin

package, it is possible to remap some alternate functions to some other pins. This is

achieved by software, by programming the AF remap and debug I/O configuration register

(AFIO_MAPR). In this case, the alternate functions are no longer mapped to their original

assignations."

other info:

7.3.7 APB2 peripheral clock enable register (RCC_APB2ENR)

on page 114/1132 you can see "AFIOEN: Alternate function IO clock enable".

From these info you should be understand what this means.

Best regards

Fabio

Elektraglide
Associate III

I understand the need for AF in order to share pins etc. But like the OP, is there a simple explanation as to why I have to call:

RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); 

as in why would I need to call a clock enable function?

Synchronous logic likes its clock to be ticking, CMOS consumes little when its not.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..