<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Switching from USB to UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95782/switching-from-usb-to-uart</link><description>hi 
 I created a project that uses Zephyr RTOS on a nRF52840 dk that is attached to a USB port on the computer, and on the computer side, there is Python code that sends configuration data over USB. It reads config data over USB in hex format, so it is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 18 Jan 2023 19:25:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95782/switching-from-usb-to-uart" /><item><title>RE: Switching from USB to UART</title><link>https://devzone.nordicsemi.com/thread/405550?ContentTypeID=1</link><pubDate>Wed, 18 Jan 2023 19:25:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec05a5f7-6474-453f-bb7b-47e2901ebbdb</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I suspect that there is something in the way that you are trying to read the uart that strips away the &amp;#39;0&amp;#39;s. 0 is a perfectly fine UART byte, and it shouldn&amp;#39;t be cut out like this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using UART, you need to read out byte by byte, because there is no header or anything saying anything about the length of a message. It is being sent one byte at the time. You need to stitch the message back together in your application.&lt;/p&gt;
&lt;p&gt;I suggest you have a look at the NCS\nrf\samples\bluetooth\peripheral_uart, and look at how this example reads the UART, and checks for special characters to determine whether to handle the message now, or wait for the next byte.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If that doesn&amp;#39;t work out, is it possible for you to upload your project, so that I can replicate what you are seeing on a DK?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>