Why I could not receive the data properly in the UART ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 1:56 AM
Hi Team,
I am using stm32h753 controller, While receiveing data in the UART. Rx buffer index is not always Rxbuff[0]. Data is received randomly in the different index.
Here i am attaching the reference.
Solved! Go to Solution.
- Labels:
-
STM32H7 Series
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 3:58 AM
Hi Clive,
Please find the code..
buffer size in 250 .
I am receiving 16 byte data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 1:59 AM
Can you post the code how you receive data? It is unclear from your print screen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 2:50 AM
Hi, Tilen MAJERLE,
Please find the code...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 3:06 AM
Can't you just paste more complete code?
How large is the buffer?
You ignore error status from the function.
You ignore the fact data reception may be of different sizes, or shift in alignment/synchronization.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 3:58 AM
Hi Clive,
Please find the code..
buffer size in 250 .
I am receiving 16 byte data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 4:09 AM
HAL_UART_Receive length parameter accepts number of bytes to receive. You put size of buffer, put 16 instead and function will terminate after it receives 16 bytes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 4:29 AM
Hi Tilen,
If i want to change the buffer size, each time i don't want to change it manually. How it can be done with out giving specific value to it.
One Note:-
The given code passing array buffer index was mentioned.
HAL_UART_Receive(&huart2, (uint8_t *)rxdata[0], sizeof(rxdata), 1000);
correct one:-
HAL_UART_Receive(&huart2, (uint8_t *)rxdata, sizeof(rxdata), 1000);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-09-09 11:20 PM
Hi Tilen,
As of now , i am try to change the receive buffer size equal to transmit buffer size(16 byte). Till i am facing the same issue. I am using USART in Asynchronism mode.
