You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/11/22 11:56:06 UTC

[GitHub] [incubator-nuttx-apps] ryancb4 opened a new issue #898: Byte Order, Single thread - Pi Pico: USB Serial

ryancb4 opened a new issue #898:
URL: https://github.com/apache/incubator-nuttx-apps/issues/898


   Writing from a single character array in the USB serial example in a single thread causes the bytes to write out of order. Ex, define the string as: 
   
   ```
   static const char total_string[] = {0xAA, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 
                                       0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 
                                       0x18, 0x19, 0x88, 0x89};
   
   ```
   Then call the write for a single byte, the next nineteen bytes, and then the last two bytes:
   
   ```
   write(outfd, out_string, 1);
   write(outfd, out_string[1], 19);
   write(outfd, out_string[20], 2);
   ```
   
   
   The output across the USB channel using 
   `cat /dev/ttyACM0 |  hexdump -e '22/1 "%02X ""\n"" "'`
   
   will be similar to:
   ```
   AA 1F 04 20 EF 00 00 00 35 00 00 00 31 00 00 00 4D 75 01 02 5F 03
    *
   AA 01 02 5F 03 AA 00 00 35 00 00 00 31 00 00 00 4D 75 01 02 5F 03
    AA 00 31 00 00 00 4D 75 01 02 5F 03 AA 02 5F 03 AA 1F 04 20 EF 00
    00 00 35 00 00 00 31 00 00 00 4D 75 01 02 5F 03 AA 1F 04 20 EF 00
    *
   00 00 35 00 00 00 31 00 00 00 4D 75 01 02 5F 03 AA 00 00 31 00 00
    00 4D 75 01 02 5F 03 AA 1F 04 20 EF 00 00 00 35 00 00 00 31 00 00
    *
   00 4D 75 01 02 5F 03 AA 4D 75 01 02 5F 03 AA 00 00 4D 75 01 02 5F
    03 AA 01 02 5F 03 AA 1F 04 20 EF 00 00 00 35 00 00 00 31 00 00 00
    4D 75 01 02 5F 03 AA 1F 04 20 EF 00 00 00 35 00 00 00 31 00 00 00
    *
   4D 75 01 02 5F 03 AA 35 00 00 00 31 00 00 00 4D 75 01 02 5F 03 AA
    1F 04 20 EF 00 00 00 35 00 00 00 31 00 00 00 4D 75 01 02 5F 03 AA
    75 01 02 5F 03 AA 1F 04 20 EF 00 00 00 35 00 00 00 31 00 00 00 4D
    *
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org