7 Replies Latest reply on Apr 5, 2018 10:48 PM by axel.lin_1746341

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

    769482734_1650581

      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.

        • 1. Re: How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.
          kavs

          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
          1 of 2 people found this helpful
          • 2. Re: How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.
            769482734_1650581

            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?

            • 3. Re: How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.
              axel.lin_1746341

              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)

              • 4. Re: How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.
                grsr

                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?

                1 of 1 people found this helpful
                • 5. Re: How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.
                  axel.lin_1746341

                  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.

                  • 6. Re: How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.
                    grsr

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

                    • 7. Re: How can I get the actually number of the data when I use the wiced_uart_receive_bytes fucntion.
                      axel.lin_1746341

                      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).

                      1 of 1 people found this helpful