2017-03-08 04:20 AM
hi
i dont get this pic on cmnt 3 and 4 . why the hell ((9-8)*4)
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 #usart2017-03-08 04:49 AM
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.
2017-03-08 05:53 AM
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]