llSDK 3.7 Uart Timeout & Number of Bytes to Receive Problem

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

cross mob
ritu_2178811
Level 3
Level 3
5 likes given First like received First like given

Hello,

I have modified snip.uart example like below.  Basically I want to UART receive with timeout and check the number of incoming bytes.  I have 2 questions

1)  UART RECEIVE does not work when I set the timeout anything other than WICED_NEVER_TIMOUT

2)  When timeout is set to WICED_NEVER_TIMEOUT, expected Data Size always return as 0

can you please tell me what I am missing?

void application_start( )

{

    char c[8];

    uint32_t expected_data_size = 2;

    wiced_gpio_init(USER_LED, OUTPUT_PUSH_PULL);

    /* Initialise ring buffer */

    ring_buffer_init(&rx_buffer, rx_data, RX_BUFFER_SIZE );

    /* Initialise UART. A ring buffer is used to hold received characters */

    //wiced_uart_init( STDIO_UART, &uart_config, &rx_buffer );

    wiced_uart_init( STDIO_UART, &uart_config, NULL );

    /* Send a test string to the terminal */

    wiced_uart_transmit_bytes( STDIO_UART, TEST_STR, sizeof( TEST_STR ) - 1 );

    /* Wait for user input. If received, echo it back to the terminal */

    //while ( wiced_uart_receive_bytes( STDIO_UART, &c, &expected_data_size, WICED_NEVER_TIMEOUT ) == WICED_SUCCESS )

    while ( wiced_uart_receive_bytes( STDIO_UART, c, &expected_data_size, 10) == WICED_SUCCESS )

    {

        snprintf(c,3,"%x\n",expected_data_size);

        wiced_uart_transmit_bytes( STDIO_UART, c, 8 );

        expected_data_size = 2;

        memset(c, 0, 8);

    }

}

0 Likes
8 Replies
Anonymous
Not applicable

​what your platform?

0 Likes

Hello,

I am using a Redbear DUO, which has a BCM43438 on it.  Below there is a link for the board.

GitHub - redbear/WICED-SDK: Add-on for RedBear boards to work with Broadcom's WICED SDK

0 Likes
Anonymous
Not applicable

This board using stm32F205 and BCM43438A1 which must work ok with wiced SDK. What is you make string command? Your board with RBLINK, so. Can you debug code?

0 Likes

Darius Babrauskas wrote:

This board using stm32F205 and BCM43438A1 which must work ok with wiced SDK.

No, this bug report is vaild.

The bug happens when expected_data_size > 1 with timeout setting.

You can easily test it using snip.uart.

e.g. Set expected_data_size = 10, and set timeout to 500ms.

Run the code and type 3 characters(ABC) then wait for timeout.

What do you expect when timeout happen? (I would assume receive ABC).

Try it and you will be surprised what you got.

Due to copy-paste of the same code in various platforms, this bug appears

in many platforms including stm32f2xx/stm32f4xx.

AxLi_1746341
Level 7
Level 7
10 comments on KBA 5 comments on KBA First comment on KBA

riforifo wrote:

Hello,

I have modified snip.uart example like below.  Basically I want to UART receive with timeout and check the number of incoming bytes.  I have 2 questions

1)  UART RECEIVE does not work when I set the timeout anything other than WICED_NEVER_TIMOUT

It's a bug in wiced SDK. Ask cypress to fix it.

0 Likes
ritu_2178811
Level 3
Level 3
5 likes given First like received First like given

I have patched Wiced SDK according to instructions on the redbear (cheong2kduo github webpage. I compile it as .\make snip.uart-RB_DUO

I may be wrong but from what I observe, I believe that following happens

  • uart_receive  WITH timeout doesn't work (with ringbuffer )
  • uart_receive WITH timeout works but number of bytes received is not correct  (this is without ringbuffer)

I didn't see anything in the errata regarding this. Can anyone from Cypress shed light onto this?

Also I would be most happy if you guys can give the code snippet a try to see how SDK behaves for uart_receive?

thanks

rifo

0 Likes
Anonymous
Not applicable

Hi

  BCM4390 and SDK 3.7.0

We have perfect same problem with this UART data loss and spending time for a month.

For our project, UART is data input source  but wen do not know the time that UART data is dropped.

If we know the source of uart driver in BCM4390, we can check it but BCM4390 has driver binary code only in SDK.

We found this problem in our module project and our software.

For easy duplication, we tested with snip.uart.  with API option does not make better effects.

wiced_result=wiced_uart_receive_bytes(uart_port, input_buf,&expected_data_size, NO_WAIT); 

wiced_result=wiced_uart_receive_bytes(uart_port, input_buf,&expected_data_size, WICED_NEVER_TIMEOUT); 

Please refer below thread for more information.

https://community.cypress.com/thread/7699

0 Likes

manulsan wrote:

Hi

  BCM4390 and SDK 3.7.0

We have perfect same problem with this UART data loss and spending time for a month.

BCM4390 includes closed source binary driver.

Only Cypress team can support you.

0 Likes