3 Replies Latest reply on Nov 3, 2014 3:56 AM by soorajrk

    Read 16 bits from the Uart

    zouakiabdel

      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 ^_^

        • 1. Re: Read 16 bits from the Uart
          soorajrk

          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

          • 2. Re: Read 16 bits from the Uart
            zouakiabdel

            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[i], 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

            • 3. Re: Read 16 bits from the Uart
              soorajrk

              Simple Uart UDP Bridge Application

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

               

              Best regards,
              sooraj