<?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>CDC/ACM fifo buffer flush</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/123648/cdc-acm-fifo-buffer-flush</link><description>Hi, I&amp;#39;m working on an application that transmits data via USB CDC/ACM class. I&amp;#39;m trying to improve the robustness of the application, and I realised that if the USB cable is unplugged during data transmission, my next transmission gets corrupted. 
 In</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 19 Aug 2025 10:27:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/123648/cdc-acm-fifo-buffer-flush" /><item><title>RE: CDC/ACM fifo buffer flush</title><link>https://devzone.nordicsemi.com/thread/546023?ContentTypeID=1</link><pubDate>Tue, 19 Aug 2025 10:27:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:083889c4-72f5-417a-bf04-805c2c24a52e</guid><dc:creator>Yaxit</dc:creator><description>&lt;p&gt;thanks for clarifying that there is no way to flush it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CDC/ACM fifo buffer flush</title><link>https://devzone.nordicsemi.com/thread/546010?ContentTypeID=1</link><pubDate>Tue, 19 Aug 2025 08:57:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e72ef95d-9bc9-44b6-ab35-bf8f47b6cd52</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Thank you for clarifying.&lt;/p&gt;
&lt;p&gt;Are you able to read the current contents of the ringbuffer after you replug the USB cable? Seems like the content is still present and when you send 10kB of 0xBB it needs to go through the motions of emptying the contents thats still there.&lt;/p&gt;
&lt;p&gt;You can use&amp;nbsp;uart_fifo_read() to read data from the CDC ACM RX ring buffer. This function should be called from the UART interrupt handler, as the CDC ACM implementation checks the context and will fail if not called from an interrupt handler. W.r.t clearing the buffer there&amp;#39;s no API to do so other than to keep reading until no more more data is available (which empties the buffer)&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CDC/ACM fifo buffer flush</title><link>https://devzone.nordicsemi.com/thread/545908?ContentTypeID=1</link><pubDate>Mon, 18 Aug 2025 11:15:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:075b7d60-c84b-4162-b570-028256d975fe</guid><dc:creator>Yaxit</dc:creator><description>&lt;p&gt;With corrupted, i mean that I get some of the data from the previous transmission. For example&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;I start the transmission of 10Kb of 0xAA&lt;/li&gt;
&lt;li&gt;I unplug the USB cable during transmission, then plug it again&lt;/li&gt;
&lt;li&gt;I start the transmission of 10Kb of 0xBB&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;At the beginning of the second transmission I get first a bunch of 0xAA bytes&lt;/p&gt;
&lt;p&gt;I do clear buffers on the host side. In fact, I used two different hosts for the two transmissions. However, I did not find a way to clear the cdc/acm ringbuffer, which I believe is what is causing the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CDC/ACM fifo buffer flush</title><link>https://devzone.nordicsemi.com/thread/545527?ContentTypeID=1</link><pubDate>Wed, 13 Aug 2025 12:39:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caaac8b8-54d6-42ac-8d85-9f867b10172a</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Could you expand a bit upon what you mean with the transmission getting corrupted?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you certain that you completely clear the buffer before releasing it to be able to be used?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>