cancel
Showing results for 
Search instead for 
Did you mean: 

how Alternate function selection work on this document and this pic?

navid ansari
Associate III
Posted on March 08, 2017 at 13:20

hi 

i dont get this pic on cmnt 3 and 4 . why the hell ((9-8)*4)

0690X00000606ViQAI.png

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjLmZmT8sbSAhVDvBoKHZ8fAVwQFggbMAA&url=http%3A%2F%2Fwww.st.com%2Fresource%2Fen%2Freference_manual%2Fdm00091010.pdf&usg=AFQjCNFRP02JYv7w3rzfw6ZCm1WYIlM6ww&sig2=dHsIf-AGPzViRpfYalxhnQ

i use keil and stm32f030k6t6 . there is no driver for usart in cmsis thats why i need to config registor to work with it

#keil #stm32f030k6t #usart
2 REPLIES 2
Posted on March 08, 2017 at 13:49

AFR is split into two 32-bit registers, each pin uses a 4-bit mux index, there are 16 pins in the GPIO bank.

4 * 16 = 64 bits

The first 8 GPIO (0..7) are in AFR[0], the second 8 GPIO (8..15) in AFR[1], the -8 rebases the shift for upper bank.

The Reference Manual describes the bits in the AFR register, review.

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 08, 2017 at 13:53

The bits for PA5 are 20 bits into AFR[0], ie 5 * 4, the 0x02 is the AF index (0..15), which is 4-bits wide

PA8 is 32 bits into AFR (8 * 4), so 0 bits into AFR[1], PA9 is ((9 * 4) - 32) bits into AFR[1]

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