cancel
Showing results for 
Search instead for 
Did you mean: 

Need to understand USART3 GPIOB programming.

chriskuku
Senior II

I need to understand the procedure to program Port B (PB10/PB11) on GPIOB port to USART3 (UART3).

I don't understand the RM0090 manual in chapter 8.4.1 nor TABLE 39.

2 REPLIES 2

The DATA SHEET is the thing to look for with respect to pin mapping.

There is a 4-bit mux on each pin that selects 1 of 16 alternate-function connectivity options, the peripheral controls the pin when in AF mode

Not all 16 AF connections are always implemented, but the subset provides all the options for a specific pin.

Table 39 describes the reset defaults for the pins/GPIO registers, because it is more complicated than simply zeroing the registers.

You need to put the PB10/PB11 in PP AF MODE, and then set the AFR for each pin to AF7

https://www.st.com/resource/en/datasheet/dm00037051.pdf

0693W000004JWcaQAG.jpg

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

Thanks. I believe I got it 🙂

So setting PB10/PB11 to AF7 requires the folloing steps:

GPIOB_BASE = 0x40020400

Offset of GPIOB_MODER_OFFSET = 0x00

Address of GPIOB_MODER = GPIOB_BASE +GPIOB_OFFSET

PB10 + PB11 must be set to AFMode (10: Alternate function mode)

Resulting word to write:

0000 0000 1010 0000 0000 0000 0000 0000

=>hex 0x00 A0 00 00

and

AFRH = 0x00007700

Is this correct?