How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.

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

cross mob
lola_1650581
Level 3
Level 3
First like received

Hi,all:

     Now I am using the module of SPIL (SB-WBM-N07P1 ) to do UART bridge(The Platform is CYW943907WAE3).

     How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.If beyond the timeout time ,the number of data by UART   sent   less than  the number of expected_data_size.

0 Likes
7 Replies
KS_96
Employee
Employee
10 sign-ins 5 sign-ins 10 replies posted

size contains actual number of received bytes

From WICED-Studio-5.0\43xxx_Wi-Fi\doc\API.html 

wiced_result_t wiced_uart_receive_bytes(wiced_uart_t uart,
void * data,
uint32_t * size,
uint32_t timeout
)

Receive data on a UART interface.

Parameters
[in]uart: The UART interface, platform header file enumerates UART interfaces from WICED_UART_0 to WICED_UART_MAX.
[out]data: Pointer to the buffer which will store incoming data
[in,out]size: Number of bytes to receive, function return in same parameter number of actually received bytes
[in]timeout: Timeout in milliseconds WICED_WAIT_FOREVER and WICED_NO_WAIT can be specified for infinite and no wait.
Returns
WICED_SUCCESS : on success.
WICED_ERROR : if an error occurred with any step

Seems you fail to understand the bug report.

The problem is the device behavior is different from what the API documentation said when timeout happened.

I'm so surprised that when 769482734_1650581 try to explain more, his question is being marked as "correct answer".

The qestion is pretty simple:

Set expected_size to 10, and input 5 characters then wait until timeout.

What do you expect for the retured expected_size after timeout?

Normal user will expect to get 5 characters, but the device return expected_size is 0. (i.e. data lost if the input is less than 10)

lola_1650581
Level 3
Level 3
First like received

Hi:

     All,this is my software:

void application_start( )

{

    uint32_t RXRecieveCount = 0;

    char    printChar;

    wiced_init();   /* Initialize the WICED device */

    /* Configure and start the UART. */

    ring_buffer_init(&rx_buffer, rx_data, RX_BUFFER_SIZE ); /* Initialize ring buffer to hold receive data */

    /* Note that WICED_DISABLE_STDIO must be defined in the make file for this to work */

    wiced_uart_config_t uart_config =

    {

        .baud_rate    = 9600,

        .data_width   = DATA_WIDTH_8BIT,

        .parity       = NO_PARITY,

        .stop_bits    = STOP_BITS_1,

        .flow_control = FLOW_CONTROL_DISABLED,

    };

    wiced_uart_init( STDIO_UART, &uart_config, &rx_buffer); /* Setup UART */

    while ( 1 )

    {

        if ( wiced_uart_receive_bytes( STDIO_UART, &receiveChar, &expected_data_size, 500) == WICED_SUCCESS )

        {

             RXRecieveCount = RXRecieveCount  + expected_data_size;

            wiced_uart_transmit_bytes(STDIO_UART,(char*) (&RXRecieveCount) , 4);

            if(1==printChar)

            {

                printChar = 0;

                wiced_gpio_output_low( WICED_LED1 );

            }

            else

            {

                printChar = 1;

                wiced_gpio_output_high( WICED_LED1 );

            }

            expected_data_size = 10;

        }

    }

}

I expect to receive ten data through the UART port in 10 milliseconds. I use the Serial debugging assistant to sent only five data to it .However ,when the timeout  occurs, the parameter of RXRecieveCount is always zero.How can I get the number of the received data when the timeout  occurs?

0 Likes
GauravS_31
Moderator
Moderator
Moderator
10 questions asked 250 solutions authored 250 sign-ins

This issue is platform specific. I tested in WICED Studio 5.2. The issue that you have described is reproducible in STM32F4XX platforms (BCM943364WCD1 and BCM943438WCD1). However when I tested with CYW43907 based platforms in WICED Studio 5.2, it returned the correct expected_data_size when timeout was finite and actual received bytes were less than expected_data_size. I basically used breakpoint debugging to check the value of expected_data_size after executing wiced_uart_receive_bytes() and typing a few characters less than expected_data_size before timeout. Can you check if you are still facing this issue with your 43907 based platform in WICED Studio 5.2?

BCM4390 also has this bug.

I'm not sure if you will update sdk-3.7 serial which supports BCM4390.

If you won't release sdk-3.7 update, I will send this issue to SFDC system.

But note there are actually more *major* bug fixes after sdk-3.7.0-7, update the sdk is a better option IMHO.

0 Likes

BCM4390 is a deprecated chip so this shall not be supported.

0 Likes

grsr wrote:

This issue is platform specific. I tested in WICED Studio 5.2. The issue that you have described is reproducible in STM32F4XX platforms (BCM943364WCD1 and BCM943438WCD1). However when I tested with CYW43907 based platforms in WICED Studio 5.2, it returned the correct expected_data_size when timeout was finite and actual received bytes were less than expected_data_size. I basically used breakpoint debugging to check the value of expected_data_size after executing wiced_uart_receive_bytes() and typing a few characters less than expected_data_size before timeout. Can you check if you are still facing this issue with your 43907 based platform in WICED Studio 5.2?

grsr

I can confirm the bug is still in sdk-6.1 for STM32F4XX platforms. (At least for 4343W/43438).