The platform used is the BCM943362WCD4
I could not replicate the problem the BCM943362WCD4 and WICED 3.4.0 AWS Ready SDK.
Please can you try with 3.4.0 AWS Ready SDK.
Was the problem fixed by trying the AWS release? I'm seeing the same behavior, my UART code in 3.1.2 is working like a charm, but on the new SDK it goes into a loop constant receiving the same value.
The problem was resolved in SDK 3.5.1. "expected_data_size = 1" at the end of the while loop is mandatory.
Yes, resetting the length variable fixed my issue. Thanks alot
Why? Does that mean wiced_uart_receive_bytes() can return WICED_SUCCESS with
expected_data_size != 1?
Since the length is passed to the function as a pointer, it uses the value stored in the memory location. So the value only works one time.
in platform_uart_receive_bytes it has this line:
*expected_data_size -= transfer_size;
where the expected_data_size is the pointer to the value passes by the user/developer. Maybe a local copy of the value was better, so that the length value does not need to be reset, but again using this method i think it would be possible to determine how many bytes was actually received if the receive function fails.
So when the function returns the length value will be 0, and if it is not reset before making a new receive call, it will never go into the while loop where is actually receives on the UART. Instead it jumps to the end and returns the result value which is set to PLATFORM_SUCCESS at the start. So you could argue that the handling of a 0 length is not properly implemented.