<?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>NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71450/nrf52840-usb-cdc-serial-is-missing-first-character-when-sof-2-and-queue_en-0-only</link><description>Hi, 
 The following code has been working fine since it was taken from the examples (NRF52840). 
 
 We wanted to remove the app_usbd_event_queue_process() so we enabled these 2 options in the sdk_config.h (config file was also from the example) 
 
 We</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 13 Nov 2021 00:18:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71450/nrf52840-usb-cdc-serial-is-missing-first-character-when-sof-2-and-queue_en-0-only" /><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/338862?ContentTypeID=1</link><pubDate>Sat, 13 Nov 2021 00:18:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a51f5914-98e5-4201-89dd-d61a45ef6fda</guid><dc:creator>OPCODE</dc:creator><description>&lt;p&gt;Just wanted to come back to this and say that everything is working well. Your initial code helped me understand the way the SDK code was triggering on new data and work from there.&lt;/p&gt;
&lt;p&gt;Had some timing issues when a lot of data was flowing between the USB and UARTs but that was solved with a nice circ buffer.&lt;/p&gt;
&lt;p&gt;Thanks for taking the time to help me and sorry for replying late.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/295291?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2021 10:32:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0060dfc0-c2cc-4f45-9fbf-47a70f24e412</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>[quote user="OPCODE"]&lt;p&gt;Regarding the missing first character during RX, I tried improving the code as per your suggestions but I cant get it to go away either. Only the first string is received well.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;- Do you think its something related to the CDC APP? Shall I start poking in&amp;nbsp;app_usbd_cdc_acm.c?&lt;/p&gt;[/quote]
&lt;p&gt;It is related to how the API works and how you are using it. Like I said, the problem is that the app_usbd_cdc_acm_read() function only provides a buffer to the CDC ACM library, that will be filled with received data sometime in the future. This means that when you reset the pointer to start receiving bytes at the start of the buffer again, there will already be one byte later in the buffer that is already provided to the library. You can work around this by copying the last byte into the first index when you have preformed the write operation:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrfx.h&amp;quot;

#include &amp;quot;nrf_sdh.h&amp;quot;
#include &amp;quot;nrf_sdh_soc.h&amp;quot;
#include &amp;quot;nrf_sdh_ble.h&amp;quot;
// #include &amp;quot;nrf_ble_gatt.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
// #include &amp;quot;ble_nus.h&amp;quot;
#include &amp;quot;app_uart.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;

#include &amp;quot;nrf_drv_usbd.h&amp;quot;
#include &amp;quot;nrf_drv_clock.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf_drv_power.h&amp;quot;

#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;app_util.h&amp;quot;
#include &amp;quot;app_usbd_core.h&amp;quot;
#include &amp;quot;app_usbd.h&amp;quot;
#include &amp;quot;app_usbd_string_desc.h&amp;quot;
#include &amp;quot;app_usbd_cdc_acm.h&amp;quot;
#include &amp;quot;app_usbd_serial_num.h&amp;quot;

#define RECV_BUF_LEN 256
static char m_cdc_data_array[RECV_BUF_LEN] = {0};
volatile uint32_t buffer_available_idx = 0;
volatile uint32_t last_buffer_idx = 0;
static bool m_usb_connected = false;
static bool usbd_tx_done = true;

// USB DEFINES START
static void cdc_acm_user_ev_handler(app_usbd_class_inst_t const * p_inst,
                                    app_usbd_cdc_acm_user_event_t event);
#define CDC_ACM_COMM_INTERFACE  0
#define CDC_ACM_COMM_EPIN       NRF_DRV_USBD_EPIN2
#define CDC_ACM_DATA_INTERFACE  1
#define CDC_ACM_DATA_EPIN       NRF_DRV_USBD_EPIN1
#define CDC_ACM_DATA_EPOUT      NRF_DRV_USBD_EPOUT1

/** @brief CDC_ACM class instance */
APP_USBD_CDC_ACM_GLOBAL_DEF(m_app_cdc_acm,
                            cdc_acm_user_ev_handler,
                            CDC_ACM_COMM_INTERFACE,
                            CDC_ACM_DATA_INTERFACE,
                            CDC_ACM_COMM_EPIN,
                            CDC_ACM_DATA_EPIN,
                            CDC_ACM_DATA_EPOUT,
                            APP_USBD_CDC_COMM_PROTOCOL_AT_V250);


/** @brief User event handler @ref app_usbd_cdc_acm_user_ev_handler_t */
static void cdc_acm_user_ev_handler(app_usbd_class_inst_t const * p_inst,
                                    app_usbd_cdc_acm_user_event_t event)
{
    //app_usbd_cdc_acm_t const * p_cdc_acm = app_usbd_cdc_acm_class_get(p_inst);

    switch (event)
    {
        case APP_USBD_CDC_ACM_USER_EVT_PORT_OPEN:
        {
            /*Set up the first transfer*/
            //ret_code_t ret = 
            app_usbd_cdc_acm_read(&amp;amp;m_app_cdc_acm, &amp;amp;m_cdc_data_array[buffer_available_idx++], 1);  // necessary it seems
            break;
        }

        case APP_USBD_CDC_ACM_USER_EVT_PORT_CLOSE:
            break;

        case APP_USBD_CDC_ACM_USER_EVT_TX_DONE:
            usbd_tx_done = true;
            //app_usbd_cdc_acm_read_any(&amp;amp;m_app_cdc_acm, m_cdc_data_array, 1);
            //app_usbd_cdc_acm_read(&amp;amp;m_app_cdc_acm, &amp;amp;m_cdc_data_array[0], 1);  
            break;

        case APP_USBD_CDC_ACM_USER_EVT_RX_DONE:
        {
            ret_code_t ret;

            if(last_buffer_idx != 0)
            {
                memcpy(&amp;amp;m_cdc_data_array[buffer_available_idx], &amp;amp;m_cdc_data_array[last_buffer_idx], 1);
                last_buffer_idx = 0;
                buffer_available_idx++; 
            }

            do{
                    ret = app_usbd_cdc_acm_read(&amp;amp;m_app_cdc_acm, &amp;amp;m_cdc_data_array[buffer_available_idx++], 1);  
            }while (ret == NRF_SUCCESS);
 
            break;
        }
        default:
            break;
    }
}

static void usbd_user_ev_handler(app_usbd_event_type_t event)
{
    switch (event)
    {
        case APP_USBD_EVT_DRV_SUSPEND:
            break;

        case APP_USBD_EVT_DRV_RESUME:
            break;

        case APP_USBD_EVT_STARTED:
            break;

        case APP_USBD_EVT_STOPPED:
            app_usbd_disable();
            break;

        case APP_USBD_EVT_POWER_DETECTED:
            //NRF_LOG_INFO(&amp;quot;USB power detected&amp;quot;);
            if (!nrf_drv_usbd_is_enabled())
            {
                app_usbd_enable();
            }
            break;

        case APP_USBD_EVT_POWER_REMOVED:
        {
            m_usb_connected = false;
            app_usbd_stop();
        }
            break;

        case APP_USBD_EVT_POWER_READY:
        {
            m_usb_connected = true;
            app_usbd_start();
        }
            break;

        default:
            break;
    }
}


void INIT_usb_cdc(){

    ret_code_t ret;
    static const app_usbd_config_t usbd_config = {
        .ev_state_proc = usbd_user_ev_handler
    };

    app_usbd_serial_num_generate();

    ret = nrf_drv_clock_init();
    APP_ERROR_CHECK(ret);

    ret = app_usbd_init(&amp;amp;usbd_config);
    APP_ERROR_CHECK(ret);

    app_usbd_class_inst_t const * class_cdc_acm = app_usbd_cdc_acm_class_inst_get(&amp;amp;m_app_cdc_acm);
    ret = app_usbd_class_append(class_cdc_acm);
    APP_ERROR_CHECK(ret);

    ret = nrf_sdh_enable_request();
    APP_ERROR_CHECK(ret);

    ret = app_usbd_power_events_enable();
    APP_ERROR_CHECK(ret);
}




int main(void){
    INIT_usb_cdc();
    ret_code_t ret;
    while(1)
    {
        if (buffer_available_idx&amp;gt;1){            
            while(usbd_tx_done == false);
            usbd_tx_done = false;
            ret = app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm, &amp;quot;&amp;gt;&amp;gt; &amp;quot;, 3);
            if(ret == NRF_SUCCESS)
            {              
                while(usbd_tx_done == false);
                usbd_tx_done = false;

                ret = app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm, m_cdc_data_array, buffer_available_idx-1);
                if(ret == NRF_SUCCESS)
                {
                    last_buffer_idx = buffer_available_idx - 1;
                    buffer_available_idx=0;
                }
            }
        }
    }
}

&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You may also use a similar approach to store multiple bytes received during the write in main (as I described in point 4 above).&lt;/p&gt;
&lt;p&gt;Another solution would be to use a ring buffer, instead of resetting the index to the start of the buffer after every read. This will allow you to store the current read and write index of the buffer, to always be able to write the last read bytes. See&amp;nbsp;&lt;a title="Ring buffer library" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_ringbuf.html?cp=7_1_3_39"&gt;Ring buffer library&lt;/a&gt;&amp;nbsp;in the SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/295216?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 19:23:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35bb0ebf-3d55-418f-aadb-055d0d646e22</guid><dc:creator>OPCODE</dc:creator><description>&lt;p&gt;Thanks so much for looking at it Jorgen!&lt;/p&gt;
&lt;p&gt;Adding a delay of 100uS or a while(flag) check, after the app_usbd_cdc_acm_write also fixes the loss of any TX data (my original issue no2). I have confirmed that with my larger codebase and this example. I dont see any loss when transmitting in bursts anymore. I think it solves the same issue as the usbd_tx_done flag does in your code above.&lt;/p&gt;
&lt;p&gt;Regarding the missing first character during RX, I tried improving the code as per your suggestions but I cant get it to go away either. Only the first string is received well.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;- Do you think its something related to the CDC APP? Shall I start poking in&amp;nbsp;app_usbd_cdc_acm.c?&lt;/p&gt;
&lt;p&gt;- Shall I try a different SDK?&lt;/p&gt;
&lt;p&gt;I am basically a little unclear as to what I should try next. Any pointers would be welcome!&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/295194?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 16:39:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:260e38d4-503a-4d3a-8ef8-782ab8496640</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I spent some time looking into your example today. I think I found the root cause of all issues, but I do not have a good solution for all:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Initially, the first missing character is caused by how you call app_usbd_cdc_acm_read(). This function will only provide a buffer to the USBD library, which will be filled when data is coming in over USB. When the port is opened, you provide the first byte of the buffer as the initial buffer to the library. When the first byte is received, you provide the same byte of the buffer to the library (since buffer_available_idx is 0). You can resolve this by also incrementing buffer_available_idx in APP_USBD_CDC_ACM_USER_EVT_PORT_OPEN, and wait until buffer_available_idx &amp;gt; 1 before writing back the data in main().&lt;/li&gt;
&lt;li&gt;When you write back the data in main(), you do not check the return codes of the calls to app_usbd_cdc_acm_write(). This function will return an error if another write operation is ongoing. You need to wait for the APP_USBD_CDC_ACM_USER_EVT_TX_DONE event before starting a new transfer. You can resolve this by setting a flag in the event handler and wait for this before starting the next transfer.&lt;/li&gt;
&lt;li&gt;When you are done writing the data back, you reset &lt;span&gt;buffer_available_idx&amp;nbsp;to 0, but you do still have 1 byte buffer passed to the library from the latest call to&amp;nbsp;app_usbd_cdc_acm_read().&amp;nbsp;&lt;/span&gt;When you send the second string from the terminal, the first byte will be store at the last&amp;nbsp;&lt;span&gt;buffer_available_idx, while subsequent bytes will be stored from 0 and upwards. This will possibly overwrite the first byte (if the string is longer than the previous). I cannot see any API to cancel a buffer, so this issue I do not have a good solution to at the moment.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;One final issue is that the USB running at interrupt may preempt the execution of the main loop while writing the data. If&amp;nbsp;data is received between the second call to&amp;nbsp;app_usbd_cdc_acm_write and the reset of the&amp;nbsp;buffer_available_idx variable, you may also lose these bytes.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;div style="font-family:inherit;"&gt;Attaching my main.c which works apart from the missing first byte of second and subsequent strings:&lt;/div&gt;
&lt;div style="font-family:inherit;"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrfx.h&amp;quot;

#include &amp;quot;nrf_sdh.h&amp;quot;
#include &amp;quot;nrf_sdh_soc.h&amp;quot;
#include &amp;quot;nrf_sdh_ble.h&amp;quot;
// #include &amp;quot;nrf_ble_gatt.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
// #include &amp;quot;ble_nus.h&amp;quot;
#include &amp;quot;app_uart.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;

#include &amp;quot;nrf_drv_usbd.h&amp;quot;
#include &amp;quot;nrf_drv_clock.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf_drv_power.h&amp;quot;

#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;app_util.h&amp;quot;
#include &amp;quot;app_usbd_core.h&amp;quot;
#include &amp;quot;app_usbd.h&amp;quot;
#include &amp;quot;app_usbd_string_desc.h&amp;quot;
#include &amp;quot;app_usbd_cdc_acm.h&amp;quot;
#include &amp;quot;app_usbd_serial_num.h&amp;quot;

#define RECV_BUF_LEN 256
static char m_cdc_data_array[RECV_BUF_LEN] = {0};
volatile uint32_t buffer_available_idx = 0;
static bool m_usb_connected = false;
static bool usbd_tx_done = true;

// USB DEFINES START
static void cdc_acm_user_ev_handler(app_usbd_class_inst_t const * p_inst,
                                    app_usbd_cdc_acm_user_event_t event);
#define CDC_ACM_COMM_INTERFACE  0
#define CDC_ACM_COMM_EPIN       NRF_DRV_USBD_EPIN2
#define CDC_ACM_DATA_INTERFACE  1
#define CDC_ACM_DATA_EPIN       NRF_DRV_USBD_EPIN1
#define CDC_ACM_DATA_EPOUT      NRF_DRV_USBD_EPOUT1

/** @brief CDC_ACM class instance */
APP_USBD_CDC_ACM_GLOBAL_DEF(m_app_cdc_acm,
                            cdc_acm_user_ev_handler,
                            CDC_ACM_COMM_INTERFACE,
                            CDC_ACM_DATA_INTERFACE,
                            CDC_ACM_COMM_EPIN,
                            CDC_ACM_DATA_EPIN,
                            CDC_ACM_DATA_EPOUT,
                            APP_USBD_CDC_COMM_PROTOCOL_AT_V250);


/** @brief User event handler @ref app_usbd_cdc_acm_user_ev_handler_t */
static void cdc_acm_user_ev_handler(app_usbd_class_inst_t const * p_inst,
                                    app_usbd_cdc_acm_user_event_t event)
{
    //app_usbd_cdc_acm_t const * p_cdc_acm = app_usbd_cdc_acm_class_get(p_inst);

    switch (event)
    {
        case APP_USBD_CDC_ACM_USER_EVT_PORT_OPEN:
        {
            /*Set up the first transfer*/
            //ret_code_t ret = 
            app_usbd_cdc_acm_read(&amp;amp;m_app_cdc_acm, &amp;amp;m_cdc_data_array[buffer_available_idx++], 1);  // necessary it seems
            break;
        }

        case APP_USBD_CDC_ACM_USER_EVT_PORT_CLOSE:
            break;

        case APP_USBD_CDC_ACM_USER_EVT_TX_DONE:
            usbd_tx_done = true;
            //app_usbd_cdc_acm_read_any(&amp;amp;m_app_cdc_acm, m_cdc_data_array, 1);
            //app_usbd_cdc_acm_read(&amp;amp;m_app_cdc_acm, &amp;amp;m_cdc_data_array[0], 1);  
            break;

        case APP_USBD_CDC_ACM_USER_EVT_RX_DONE:
        {
            ret_code_t ret;

            //if (app_usbd_cdc_acm_bytes_stored(&amp;amp;m_app_cdc_acm) &amp;gt; 0){
            //ret = app_usbd_cdc_acm_read(&amp;amp;m_app_cdc_acm, &amp;amp;m_cdc_data_array[buffer_available_idx++], 1);
                        
            do{
                    ret = app_usbd_cdc_acm_read(&amp;amp;m_app_cdc_acm, &amp;amp;m_cdc_data_array[buffer_available_idx++], 1);  
            }while (ret == NRF_SUCCESS);
 
            break;
        }
        default:
            break;
    }
}

static void usbd_user_ev_handler(app_usbd_event_type_t event)
{
    switch (event)
    {
        case APP_USBD_EVT_DRV_SUSPEND:
            break;

        case APP_USBD_EVT_DRV_RESUME:
            break;

        case APP_USBD_EVT_STARTED:
            break;

        case APP_USBD_EVT_STOPPED:
            app_usbd_disable();
            break;

        case APP_USBD_EVT_POWER_DETECTED:
            //NRF_LOG_INFO(&amp;quot;USB power detected&amp;quot;);
            if (!nrf_drv_usbd_is_enabled())
            {
                app_usbd_enable();
            }
            break;

        case APP_USBD_EVT_POWER_REMOVED:
        {
            m_usb_connected = false;
            app_usbd_stop();
        }
            break;

        case APP_USBD_EVT_POWER_READY:
        {
            m_usb_connected = true;
            app_usbd_start();
        }
            break;

        default:
            break;
    }
}


void INIT_usb_cdc(){

    ret_code_t ret;
    static const app_usbd_config_t usbd_config = {
        .ev_state_proc = usbd_user_ev_handler
    };

    app_usbd_serial_num_generate();

    ret = nrf_drv_clock_init();
    APP_ERROR_CHECK(ret);

    ret = app_usbd_init(&amp;amp;usbd_config);
    APP_ERROR_CHECK(ret);

    app_usbd_class_inst_t const * class_cdc_acm = app_usbd_cdc_acm_class_inst_get(&amp;amp;m_app_cdc_acm);
    ret = app_usbd_class_append(class_cdc_acm);
    APP_ERROR_CHECK(ret);

    ret = nrf_sdh_enable_request();
    APP_ERROR_CHECK(ret);

    ret = app_usbd_power_events_enable();
    APP_ERROR_CHECK(ret);
}




int main(void){
    INIT_usb_cdc();
    ret_code_t ret;
    while(1)
    {
        if (buffer_available_idx&amp;gt;1){            
            while(usbd_tx_done == false);
            usbd_tx_done = false;
            ret = app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm, &amp;quot;&amp;gt;&amp;gt; &amp;quot;, 3);
            if(ret == NRF_SUCCESS)
            {              
                while(usbd_tx_done == false);
                usbd_tx_done = false;

                ret = app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm, m_cdc_data_array, buffer_available_idx-1);
                if(ret == NRF_SUCCESS)
                {
                    buffer_available_idx=0;
                }
            }
        }
    }
}

&lt;/pre&gt;&lt;/div&gt;
&lt;div style="font-family:inherit;"&gt;&lt;/div&gt;
&lt;div style="font-family:inherit;"&gt;Best regards,&lt;br /&gt;Jørgen&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/293851?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 17:10:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:941c670d-870c-4cbe-939e-e40410b69bba</guid><dc:creator>OPCODE</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;Thanks for your reply. When I made this example, I had the same issue. When I sent characters down the terminal I also get &amp;gt;&amp;gt; and sometimes I get the characters minus the first. But sometimes I don&amp;#39;t get any response.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looking at the code do you see any issue? Basically I am looking for a barebones interrupt CDC example with SD (no cli, no logging, no bsp, no uart) that can echo back characters so I can build on top of it. I cant run the examples as they have BSP/uart in them that might turn on and off random&amp;nbsp;mosfets on our PCB. When I modify the examples to remove the bsp and uart things, I basically end up with the example I sent you, which looks like a pretty logic CDC interrupt based CDC example, but I have no idea why it doesnt work.&lt;/p&gt;
&lt;p&gt;Regarding the terminal, I use many different ones like coolterm, minicom, custom one, and they all show the same behaviour.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/293840?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 16:24:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34b88dd7-9828-465a-8fcd-85f65dd57ef5</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Unfortunately this example does not enumerate as a serial device on my setup, it only shows up as a generic USB device with a warning triangle in Windows Device manager.&amp;nbsp;I was able to resolve this by modifying the VID/PID configs in sdk_config.h. Maybe this could also have been resolved by manually installing drivers, etc.&lt;/p&gt;
&lt;p&gt;When connecting the serial terminal, I only see &amp;gt;&amp;gt; printed in most cases when I send strings. How are you testing this? Which serial terminal are you using? What is the input and output that you get?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/293660?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 03:15:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d6012b1-828b-4c6e-8588-4009692d1220</guid><dc:creator>OPCODE</dc:creator><description>&lt;p&gt;Thanks for looking at it Jorgen. I have spent some hours today trimming the code down to the minimum where the bug occurs.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The code just enumerates a CDC serial and should echo back whatever is typed. Please see the attached zip!&lt;/p&gt;
&lt;p&gt;Setup details:&lt;/p&gt;
&lt;p&gt;Compiler: gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux&lt;/p&gt;
&lt;p&gt;SDK version:&amp;nbsp;nRF5_SDK_17.0.0_9d13099&lt;/p&gt;
&lt;p&gt;Softdevice version:&amp;nbsp;s140_nrf52_7.0.1_softdevice.hex&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let me know what you find!&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/usbd_5F00_cdc_5F00_acm2.zip"&gt;devzone.nordicsemi.com/.../usbd_5F00_cdc_5F00_acm2.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.dropbox.com/s/wchalqw71t1vbzg/usbd_cdc_acm2.zip?dl=1"&gt;www.dropbox.com/.../usbd_cdc_acm2.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/293610?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2021 16:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c77f5527-20a8-4058-8ca2-2f589573a211</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I tried to reproduce this behavior by modifying the configs in the app_usbd_cdc_acm example in the SDK, but I&amp;#39;m not able to reproduce it. Maybe I missed something else required to reproduce this?&lt;/p&gt;
&lt;p&gt;Could you share the full project that can be used to reproduce the issue?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52840 USB CDC Serial is missing first character when SOF = 2 and QUEUE_EN = 0 only</title><link>https://devzone.nordicsemi.com/thread/293497?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2021 09:39:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6628e85-c9da-4f0b-9685-36c9276946d6</guid><dc:creator>OPCODE</dc:creator><description>&lt;p&gt;I have&amp;nbsp;nRF5_SDK_17.0.0_9d13099 btw on NRF52840 rev2.&lt;/p&gt;
&lt;p&gt;Also maybe this is an issue that resurfaced?&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/40431/52840-usb-cdc-missed-first-byte-in-rx-event"&gt;devzone.nordicsemi.com/.../52840-usb-cdc-missed-first-byte-in-rx-event&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>