Read 16 bits from the Uart

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

cross mob
Anonymous
Not applicable

Hi !!


I'm working with the BCM43362 and I send to another board 4 Bytes, in the 4th Byte I receive successively 4 Bytes as a response.

The problem is that I can only read the first Byte(because i receive only one IRq) and I don't find a function to access to the Rx Buffer. without checking the IRq
.

I'm actually using the function wiced_result_t wiced_uart_transmit_bytes( wiced_uart_t uart, const void* data, uint32_t size ) to transmits data and wiced_uart_receive_bytes( wiced_uart_t uart, void* data, uint32_t size, uint32_t timeout ).

Thanks for the help ^_^

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

Use a thread to receive data

and in that add

while ( wiced_uart_receive_bytes( WICED_UART_1, &read, 1, WICED_NEVER_TIMEOUT ) == WICED_SUCCESS )

  {

       Buffer[Bufcount++]=(unsigned char)read;
      //add  logic for resetting Bufcount  and other things as per your requirement.

  }


Thanks and Regards,
Sooraj

View solution in original post

0 Likes
3 Replies
Anonymous
Not applicable

Hi,

Use a thread to receive data

and in that add

while ( wiced_uart_receive_bytes( WICED_UART_1, &read, 1, WICED_NEVER_TIMEOUT ) == WICED_SUCCESS )

  {

       Buffer[Bufcount++]=(unsigned char)read;
      //add  logic for resetting Bufcount  and other things as per your requirement.

  }


Thanks and Regards,
Sooraj

0 Likes
Anonymous
Not applicable

Hello Soorajrk,

Thanks for the help !!
I did as you suggested in your response but the problem is that  when executing, the program stops in this part of the code(the part you suggested).

When I use the debugger, it never go into it  and I have this comments :

Failed to execute MI command:

-data-evaluate-expression Buffer[0]

Error message from debugger back end:

value has been optimized out

here is my code

while(1){

        for(i=0;i<5;i++){

            platform_uart_transmit_bytes( &platform_uart_drivers[STDIO_UART], &data, sizeof( data[0] ) );

        }

                while ( wiced_uart_receive_bytes( STDIO_UART, &c, 1, WICED_NEVER_TIMEOUT ) == WICED_SUCCESS )

                   {

                      Buffer[Bufcount]=(unsigned char)c;

                      Bufcount++;

                   }

               Bufcount = 0;

}


Thanks a lot for the help

0 Likes
Anonymous
Not applicable

Simple Uart UDP Bridge Application

Made this app now.. just check .. hope it helps..

Best regards,
sooraj

0 Likes