Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Wi-Fi Combo Forum Discussions

dast_1961951
Level 4
Level 4
10 likes received First like received

occasionally, function platform_uart_receive_bytes() gets stuck in the do-while loop where it attempts to copy data from driver->rx_buffer to the provided buffer.  execution stays in this tight loop until the UART in question receives datga.

it appears this function is reached when there is no data available from the UART on the buffer.   I currently have no code to reproduce, but have seen this condition..

workaround diff:

@@ -531,18 +531,22 @@ platform_result_t platform_uart_receive_bytes( platform_uart_driver_t* driver, u

                 }

             }

-            *expected_data_size -= transfer_size;

-

             // Grab data from the buffer

             do

             {

                 uint8_t* available_data;

                 uint32_t bytes_available;

+                if (ring_buffer_used_space( driver->rx_buffer ) < transfer_size)

+                {

+                    break;

+                }

+

                 ring_buffer_get_data( driver->rx_buffer, &available_data, &bytes_available );

                 bytes_available = MIN( bytes_available, transfer_size );

                 memcpy( data_in, available_data, bytes_available );

                 transfer_size -= bytes_available;

+                *expected_data_size -= bytes_available;

                 data_in = ( (uint8_t*) data_in + bytes_available );

                 ring_buffer_consume( driver->rx_buffer, bytes_available );

             } while ( transfer_size != 0 );

3 Replies
GauravS_31
Moderator
Moderator
Moderator
250 solutions authored 250 sign-ins First comment on KBA

May I know the data size in platform_uart_receive_bytes()? Also let me know the ring buffer size that you are using. I could not reproduce this issue using the values specified in snip.uart.

0 Likes

grsr wrote:

May I know the data size in platform_uart_receive_bytes()? Also let me know the ring buffer size that you are using. I could not reproduce this issue using the values specified in snip.uart.

Read this thread then you should be able to understand the *problem*.

https://community.cypress.com/message/32968#32968

If you search the forum with keyword "uart received timeout" you

will find a lot of issues reported for years.

I even tried to leave a message mentined it's a sdk bug in some report.

Somehow, cypress keep ignore the bug report on the forum.

0 Likes

typical requested bytes for this is 1.

0 Likes