<?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>Nrf5340-Dk: UART DMA Packetization</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81372/nrf5340-dk-uart-dma-packetization</link><description>Hello, 
 I am looking to send packets of real time accelerometer data over uart to my PC via uart. The packets are similar to the code shown below where the data array is a buffer full of the accelerometer samples: 
 
 typedef struct __uart_packetet__</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Nov 2021 12:30:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81372/nrf5340-dk-uart-dma-packetization" /><item><title>RE: Nrf5340-Dk: UART DMA Packetization</title><link>https://devzone.nordicsemi.com/thread/337907?ContentTypeID=1</link><pubDate>Mon, 08 Nov 2021 12:30:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a5e744a-cd1a-464d-8771-52c3e81ae658</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Matt&lt;/p&gt;
&lt;p&gt;There is an implementation of Slip in Zephyr, which is essentially a protocol for handling UART packetization, but the Zephyr implementation doesn&amp;#39;t seem very generic:&lt;br /&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/net/slip.c"&gt;https://github.com/zephyrproject-rtos/zephyr/blob/main/drivers/net/slip.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Possibly you could use this library as a starting point, and modify it to fit your requirements better, by replacing the net_pkt struct with a struct of your own.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Essentially Slip uses the&amp;nbsp;standard method of using a dedicated 8-bit value to signal the end of a packet, and using a different 8-bit value as an escape character, which you can use whenever one of these dedicated values show up in the data that you want to send.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf5340-Dk: UART DMA Packetization</title><link>https://devzone.nordicsemi.com/thread/337772?ContentTypeID=1</link><pubDate>Fri, 05 Nov 2021 23:19:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef191d8d-a62c-46ac-9812-aed9a093c630</guid><dc:creator>mattmacleod</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Torbj&amp;oslash;rn,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for your response.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I was looking for the best way to packetize sensory data from my nrf5340 so that it could be passed over UART to my PC.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I came up with a work around using uart_tx&amp;nbsp;thought deliberately writing out the struct elements into the&amp;nbsp;byte array but I was wondering if there was an api that could packetize a struct similar to that one over UART.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Matt&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nrf5340-Dk: UART DMA Packetization</title><link>https://devzone.nordicsemi.com/thread/337472?ContentTypeID=1</link><pubDate>Thu, 04 Nov 2021 12:50:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f801b4bc-aabf-45ee-85fb-0e8d61820e9f</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Matt&lt;/p&gt;
&lt;p&gt;I am a bit unsure what it is you need help with.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you&amp;nbsp;asking how to convert your packet struct to a byte array so you can pass it to the UART API&amp;#39;s?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Or are you looking for a way to packetize the UART&amp;nbsp;stream?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>