cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to send word(2 byte) data through UART when we set data wordlength of 8 bits???

TH.16.336
Associate III

Hi,

I am using STM32F446ZE NUCLEo board. This board has many uarts and the Data Register is of 32 bit wide but maximum can be used is 9 bits, others are reserved.

I have configured one UART channel UART5 and I am able to send series of byte data from my terminal to this channel. Like below,

0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28

What I want to know is, is it possible to send word (2 byte) data from my terminal and handle the data in the controller? Like 0x5354 0x5455 0x5556

I have a requirement for this kind of data but I am stuck as I know it's not possible atleast for my knowledge.

Please help.

3 REPLIES 3

UART word length are traditionally limited to 8 or 9 bits, as increasing bit length increases requirements for clock precision on both ends.

For longer datan words, you simply transfer them as individual bytes and then join them together in software.

JW

Pavel A.
Evangelist III

To explain a little more on Jan's reply - you are probably confused by the UART driver from the ST "HAL" library.

It uses 16-bit words if the UART is in 9-bit *data* mode, simply because otherwise 9 bits of data don't fit in a byte.

The UART sends data character by character. Length of the character can be 8 or 9 bits (+ framing), never 16-bits.

Just send as many bytes as you need, one by one, in any order that you want.

-- pa

dbgarasiya
Senior II

you can not send same time, you can send character by charater and manage at receiver side