7 Replies Latest reply on Dec 2, 2015 1:41 AM by renejos

    Thread and UART problem in SDK 3.4.0

    adidioui

      Hello,

       

      I have a problem with the source code bellow in SDK 3.4.0. When UART 2 receives a data of 1 byte, the thread calling never stops. I do not if the problem comes from the RTOS or UART lib. However, this source code is working fine in SDK 3.1.2.

       

      Thank you for your help

       

       

      void application_start(void)
      {
          wiced_init( );
          ring_buffer_init(&rx_buffer, rx_data, RX_BUFFER_SIZE );
          wiced_uart_init( WICED_UART_2, &uart_config, &rx_buffer );
      
      
          wiced_rtos_create_thread( &uart_thread, WICED_DEFAULT_WORKER_PRIORITY, "UART_RX", uart_thread_main, UART_THREAD_STACKSIZE, NULL );
      
      
      }
      
      
      void uart_thread_main()
      {
      
      
        char read_data;
        uint32_t expected_data_size = 1;
      
      
        while ( wiced_uart_receive_bytes( WICED_UART_2, &read_data, &expected_data_size, WICED_NEVER_TIMEOUT ) == WICED_SUCCESS )
        {
        WPRINT_APP_INFO( ( "Thread called. Data : %c", read_data ) );
        }
      
      
          WICED_END_OF_CURRENT_THREAD( );
      }