cancel
Showing results for 
Search instead for 
Did you mean: 

How the UART works ?

mohamed-amine
Associate II
Posted on August 18, 2014 at 16:20

Hello,

I'm discovering the STM32F407 with an STM32F4Discovery, in the past, I worked with a PIC32, and I see that there is many differences between those two microcontrollers.

I want to understand how the UART peripheral recognizes the TX and RX pins, in the example, I saw that the initialization of TX and RX pins is the same, only the pin number is different, so how can the UART module recognizes the pin that's used for TX and for RX ??

Is the order of executing HAL_GPIO_Init will decide which pin will be TX and wich pin will be RX ???

In the PIC32MX795, the UART pins are fixed, so there is no problem, but here, I see that the peripheral can drive any mcu's pins.

thank you to enlighten me.
4 REPLIES 4
Andrew Neil
Evangelist III
Posted on August 18, 2014 at 16:41

''how the UART peripheral recognizes the TX and RX pins''

It doesn't!

You  choose which of the available ''Alternate Function'' pins you  wish to use in your application.

Look at Table 9, ''Alternate function mapping'' in the datasheet:

http://www.st.com/web/en/resource/technical/document/datasheet/DM00037051.pdf

Andrew Neil
Evangelist III
Posted on August 18, 2014 at 16:45

''In the PIC32MX795, the UART pins are fixed''

How very inflexible!

Most chips these days seem to have some facility to map peripheral functions (eg, UART Tx, Rx) to a choice of physical pins...
mohamed-amine
Associate II
Posted on August 18, 2014 at 16:53

Okay, understood !!!!! thank you very much !

mohamed-amine
Associate II
Posted on August 18, 2014 at 17:07

Yes, but the PIC32MX795F512L is old, Micochip provided PPS (peripheral pin select, it's like the AF feature) in the PIC32MX mcu's that don't have many pins, like the PIC32MX220/230/250 family.

As the PIC32MX795 has many pins, they thought it's useless to add that feature to it.

sorry for bad english ^^