<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://test-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>How to combine USB CDC ACM and MODEL</title><link>https://test-devzone.nordicsemi.com/f/nordic-q-a/87520/how-to-combine-usb-cdc-acm-and-model</link><description>Hello, 
 I would like to enter simple commands such as on, off to the USB CDC ACM, and then set the parameters in the model through string comparing. 
 (now i&amp;#39;m trying Generic onoff model, but in the end, I want to pass the data through the vendor model</description><dc:language>en-US</dc:language><generator>Telligent Community 13 Non-Production</generator><lastBuildDate>Tue, 10 May 2022 19:02:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://test-devzone.nordicsemi.com/f/nordic-q-a/87520/how-to-combine-usb-cdc-acm-and-model" /><item><title>RE: How to combine USB CDC ACM and MODEL</title><link>https://test-devzone.nordicsemi.com/thread/367254?ContentTypeID=1</link><pubDate>Tue, 10 May 2022 19:02:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca7eb4ee-5ae4-4061-a7f5-daf3562f609f</guid><dc:creator>user20690</dc:creator><description>&lt;p&gt;Thanks for sharing the solution.&lt;/p&gt;
&lt;p&gt;You are welcome to post a new ticket if you have any further questions.&lt;/p&gt;
&lt;p&gt;Br, &lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to combine USB CDC ACM and MODEL</title><link>https://test-devzone.nordicsemi.com/thread/366743?ContentTypeID=1</link><pubDate>Fri, 06 May 2022 13:11:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62839804-cb48-47f0-8266-a035e4455595</guid><dc:creator>user115809</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;Joakim,Thanks for your reply.&lt;/p&gt;
&lt;p&gt;Now I have solved this problem by using a timer.&lt;pre class="ui-code" data-mode="c_cpp"&gt;APP_TIMER_DEF(zqaking_timer_id);

static void zqaking_app_timer_handler(void * p_unused)
{   
    if (DataChange)
    {
        DataChange = false;
        uint32_t status;

        app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm, my_data_buffer, my_data_buffer_lenght);
        status = hx_model_client_opcode_tx_unreliable(&amp;amp;m_hx_model_client[0], my_data_buffer, my_data_buffer_lenght, APP_UNACK_MSG_REPEAT_COUNT);
    }
}

static void start(void)
{
    &amp;#183;&amp;#183;&amp;#183;
    ERROR_CHECK(app_timer_create(&amp;amp;zqaking_timer_id, APP_TIMER_MODE_REPEATED, zqaking_app_timer_handler));
    ERROR_CHECK(app_timer_start(zqaking_timer_id, 6000, NULL));
    &amp;#183;&amp;#183;&amp;#183;
}&lt;/pre&gt;&lt;br /&gt;following is USB CDC ACM rx event:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;case APP_USBD_CDC_ACM_USER_EVT_RX_DONE:
        {
            ret_code_t ret;
            static uint8_t index = 0;
            index++;

            do
            {
                if ((m_cdc_data_array[index - 1] == &amp;#39;\n&amp;#39;) ||
                    (m_cdc_data_array[index - 1] == &amp;#39;\r&amp;#39;) ||
                    (index &amp;gt;= (244)))
                {
                    if (index &amp;gt; 1)
                    {   
                        nrf_gpio_pin_toggle(BSP_LED_0);
                        uint16_t length = (uint16_t)index;
                        if (length + sizeof(ENDLINE_STRING) &amp;lt; 244)
                        {
                            memcpy(m_cdc_data_array + length, ENDLINE_STRING, sizeof(ENDLINE_STRING));
                            length += sizeof(ENDLINE_STRING);
                        }
                        memcpy(my_data_buffer, m_cdc_data_array, length);
                        my_data_buffer_lenght = length;
                        DataChange = true;
                    }

                    index = 0;
                }
                /* Fetch data until internal buffer is empty */
                ret = app_usbd_cdc_acm_read(&amp;amp;m_app_cdc_acm,
                                            &amp;amp;m_cdc_data_array[index],
                                            1);
                if (ret == NRF_SUCCESS)
                {
                    index++;
                }
            }
            while (ret == NRF_SUCCESS);

            break;
        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I add a timer to&amp;nbsp;check for changes in variable DATACHANGE, and this makes my program works well.&lt;br /&gt;Although I don&amp;#39;t know the reason yet, I think there should be some kind of conflict between MESH and USB CDC ACM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to combine USB CDC ACM and MODEL</title><link>https://test-devzone.nordicsemi.com/thread/366432?ContentTypeID=1</link><pubDate>Thu, 05 May 2022 11:31:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8b2d794-56c8-4dc2-9e57-5e16556bfe73</guid><dc:creator>user20690</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;All four leds on would indicate you have run into some kind of error. Do you have any log output with error messages, or an error code?&lt;/p&gt;
&lt;p&gt;You are running into an error inside generic_onoff_client_set_unack()?&lt;/p&gt;
&lt;p&gt;Br, &lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>