2017-11-12 11:30 AM - edited 2023-11-20 09:37 AM
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:
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 #usart2017-11-12 11:26 PM
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.