cancel
Showing results for 
Search instead for 
Did you mean: 

USART transmitting problem

Khetag Goiaev
Associate II
Posted on November 12, 2017 at 20:30

Hello there.

I'm trying to use USART Interface with STM32F3Discovery board.

I'm coding using HAL libraries.

Transmitting data from board proceeds with no errors.

The problem is when I transmit data to board from computer something goes wrong.

There are examples of transfers:


_legacyfs_online_stmicro_images_0690X0000060MxWQAU.png

In case of single number messages I have next table:

1 - 0x67

2 - 0x33

3 - 0x66

4 - 0x19

5 - 0x65

In case of multiple number messages:

12 - 0x67, 0x33

123 - 0x67, 0xB3, 0x06

1234 - 0x67, 0xB3, 0x76, 0x06

12345 -  0x67, 0xB3, 0x76, 0x56, 0x06

What do you think the problem could be?

Thank you for your answers!

#stm32f3 #hal #stm32f3discovery #usart
1 REPLY 1
S.Ma
Principal
Posted on November 13, 2017 at 08:26

There are many ways to use the UART by HAL, and here we got no clue.

Format your block of bytes. (how the receiver know the transfer is complete?), for example with '/n' character.

Use Interrupt Callback function for RX mode, fill a buffer or a SW fifo to pass the incoming data to the main loop.

Proper handling in theory would require that the interrupt can come at any (wrong) time respective to the main loop, so manage your buffer properly.