<?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>Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33408/burstiness-of-nrf-52840-dev-kit-usb-cdc-adm-code-on-mac-os</link><description>We&amp;#39;re using a combination of the ESB library/example code and the USB CDC ADM example code to transfer data from one 52840 dev kit to another system via a 2nd 52840 dev kit, via this setup: 
 
 The transmitting 52840 send 128 bytes of data every millisecond</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 13 May 2018 17:33:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33408/burstiness-of-nrf-52840-dev-kit-usb-cdc-adm-code-on-mac-os" /><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/131776?ContentTypeID=1</link><pubDate>Sun, 13 May 2018 17:33:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bde247f-76bb-4cb1-a123-8d9a5877a558</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;I&amp;#39;m happy to hear that the issue is resolved.&lt;/p&gt;
&lt;p&gt;Yes, this change will be added in the next SDK release.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/131771?ContentTypeID=1</link><pubDate>Sun, 13 May 2018 15:53:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12ef9d23-7f53-4e63-be5a-2505e8c7fb51</guid><dc:creator>ejg2putt</dc:creator><description>&lt;p&gt;I&amp;#39;ve been testing all weekend and have not seen any burst problems, I think we can declare victory at this point. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Will your changes be rolled into the SDK at some point? &amp;nbsp;I&amp;#39;ll make sure our code includes the changes.&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;
&lt;p&gt;Ed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/131594?ContentTypeID=1</link><pubDate>Thu, 10 May 2018 01:02:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a53b23c7-e076-4608-95d7-396fb5609afd</guid><dc:creator>ejg2putt</dc:creator><description>&lt;p&gt;&lt;span&gt;Thanks for the quick response Sigurd,&lt;/span&gt;&lt;/p&gt;
&lt;div class=""&gt;This does appear to eliminate the problem, I&amp;rsquo;m able to move 128 byte packets (i.e. single app_usbd_cdc_acm_write) at a 1 KHz rate with minimum jitter and *NO* 4 ms bursts. &amp;nbsp;&lt;/div&gt;
&lt;div class=""&gt;&lt;/div&gt;
&lt;div class=""&gt;I thought we had fixed this before with the double write, so I&amp;rsquo;d like to test for a few days to ensure the problem doesn&amp;rsquo;t reappear. &amp;nbsp;I also want to test on Windows, which I won&amp;rsquo;t get to until this weekend, so I&amp;rsquo;ll update everyone on the state of things this weekend once I&amp;rsquo;m done testing.&lt;/div&gt;
&lt;div class=""&gt;&lt;/div&gt;
&lt;div class=""&gt;Ed&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/131569?ContentTypeID=1</link><pubDate>Wed, 09 May 2018 15:26:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84b0577a-ae9f-4b0b-8f0d-65cf1effb6a0</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi Ed,&lt;/p&gt;
&lt;p&gt;Can you see if this change improves anything ?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret_code_t app_usbd_cdc_acm_write(app_usbd_cdc_acm_t const * p_cdc_acm,
                                  const void *               p_buf,
                                  size_t                     length)
{
    app_usbd_class_inst_t const * p_inst = app_usbd_cdc_acm_class_inst_get(p_cdc_acm);
    app_usbd_cdc_acm_ctx_t * p_cdc_acm_ctx = cdc_acm_ctx_get(p_cdc_acm);

    bool dtr_state = (p_cdc_acm_ctx-&amp;gt;line_state &amp;amp; APP_USBD_CDC_ACM_LINE_STATE_DTR) ?
                      true : false;
    if (!dtr_state)
    {
        /*Port is not opened*/
        return NRF_ERROR_INVALID_STATE;
    }
    
    nrf_drv_usbd_ep_t ep = data_ep_in_addr_get(p_inst);
    
    if ((length % NRF_DRV_USBD_EPSIZE) == 0)
    {
        NRF_DRV_USBD_TRANSFER_IN_ZLP(transfer, p_buf, length);
        return app_usbd_ep_transfer(ep, &amp;amp;transfer);
    }
    else
    {
        NRF_DRV_USBD_TRANSFER_IN(transfer, p_buf, length);
        return app_usbd_ep_transfer(ep, &amp;amp;transfer);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Edit: The idea here is to use &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/group__nrf__drv__usbd.html?cp=4_0_0_6_9_0_33_18#ga9ec2fac985fd7d5b96629028d558796e"&gt;NRF_DRV_USBD_TRANSFER_IN_ZLP()&lt;/a&gt; when you don&amp;#39;t have a full packet to send. A&amp;nbsp;&lt;span&gt;Zero Length Packet will be generated on the end of the transfer when using&amp;nbsp;NRF_DRV_USBD_TRANSFER_IN_ZLP(), and it should therefore end the transaction.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/130412?ContentTypeID=1</link><pubDate>Tue, 01 May 2018 23:31:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:102c130d-c92c-40d9-91e2-b1fd2116c068</guid><dc:creator>ejg2putt</dc:creator><description>&lt;p&gt;Thanks TJ. &amp;nbsp;A zero byte packet did not work, but a combination of a 96 byte packet and a 32 byte packet fixes the problem. &amp;nbsp;112/16 did not work, gave me the same burst timing. &amp;nbsp;Don&amp;#39;t know what&amp;#39;s magic about 32 bytes.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for all the help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Ed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/130374?ContentTypeID=1</link><pubDate>Tue, 01 May 2018 10:23:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cf4937e-5821-458f-a988-020c3cf192af</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Either dont&amp;#39;t send an integer multiple of 64 byte or send a &amp;quot;zero&amp;quot; packet after sending such a packet.And yes, USB bulk should allow sending a packet that contains no data bytes.&lt;/p&gt;
&lt;p&gt;Reason behind this is bulk endpoint handling in the USB spec, that assumes &amp;quot;full&amp;quot; endpoint packets belong to the &lt;em&gt;same&lt;/em&gt; transaction. This delays delivery to your application until the transaction is finished.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/130372?ContentTypeID=1</link><pubDate>Tue, 01 May 2018 09:53:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:410f63f6-e019-47c8-81a3-125274b3c731</guid><dc:creator>ejg2putt</dc:creator><description>&lt;p&gt;Any ideas here? &amp;nbsp; Is there a different USB example/code base we could use to smooth out the transactions. &amp;nbsp;ESB does us no good if we can&amp;#39;t get the data across USB in a timely manner.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Ed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/129644?ContentTypeID=1</link><pubDate>Tue, 24 Apr 2018 23:41:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:912af7c3-e363-4cb7-af99-4ca5f1e8430b</guid><dc:creator>ejg2putt</dc:creator><description>&lt;p&gt;A bit more info. &amp;nbsp;Tried a few different configurations of packet size, and it appears the minimum &amp;quot;burst&amp;quot; is about 4 ms. &amp;nbsp;Nothing I&amp;#39;ve been able to do reduces this number, smaller packets just result within the burst window.&lt;/p&gt;
&lt;p&gt;Ignoring ESB, I modified the main loop of my code to do nothing but 128 byte&amp;nbsp;app_usbd_cdc_acm_writes (not waiting for any ESB provided data. &amp;nbsp;At 128 bytes, I see a burst of 4 transfers - first one about 1 ms, then the next 3 happening almost immediately. &amp;nbsp;Seems to related to USB transfers????&lt;/p&gt;
&lt;p&gt;Ed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/129423?ContentTypeID=1</link><pubDate>Tue, 24 Apr 2018 00:03:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2288278-0b21-4dbb-be57-90d09d98f773</guid><dc:creator>ejg2putt</dc:creator><description>&lt;p&gt;A bit more data, but I&amp;#39;m not sure it makes any sense:&lt;/p&gt;
&lt;p&gt;If I split up the app_usbd_cdc_acm_write into 64 byte packets, I now get a burst of 8 USB reads that are about 7.5 ms apart (i.e. eight 64 byte packets in 7.5 ms, first one takes about 7 ms, the remaining 7 happen almost immediately). &amp;nbsp;I did this both by just splitting up the 128 packet coming across the air into two packets, and by simply xfering a&amp;nbsp;64 byte&amp;nbsp;across the air (and not manipulating the local buffers at all).. &amp;nbsp;Both produced the same 7.5 burst cluster.&lt;/p&gt;
&lt;p&gt;Thinking this might be some sort of USB/CDC/ADM cache flush problem on a 512 byte boundary(4 x 128 = 8 x 64 = 512), I tried the opposite, by faking 256 byte writes by writing the 128 byte packet twice to&amp;nbsp;&lt;span&gt;app_usbd_cdc_acm_write. &amp;nbsp;I was&amp;nbsp;expecting the burst to be around 2 ms, but this produces&amp;nbsp;the same 4 ms burst as with a single 128 byte packet (???).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Need to ponder this some more, I&amp;#39;ll post any other data I come up with. &amp;nbsp;But this seems to indicate the problem is&amp;nbsp;somehow getting data thru the USB/CDC/ADM to our app, and not related to the ESB transfer of data.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Ed&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/129322?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 10:43:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e42f52d-ce01-4d4b-9ad0-dd89886ad8c9</guid><dc:creator>ejg2putt</dc:creator><description>&lt;p&gt;Already measured the interval. &amp;nbsp;In nrf_esb_event_handler, I recorded the time stamp of the received packet for the NRF_ESB_EVENT_RX_RECEIVED case of p_event-&amp;gt;evt_id. &amp;nbsp;The time stamp is based on the 32 KHz clock. &amp;nbsp;I recorded the time stamp in the received data so I could look at it after the transfer was complete. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The time stamp always show exactly 32 counts between packets, +/- 1 count. &amp;nbsp;So I would say that the data across the air is coming in at exactly 1 KHz rate (i.e 1 ms between packets). &amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will try different packet sizes later today.&lt;/p&gt;
&lt;p&gt;Ed&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Burstiness of nRF 52840 Dev Kit USB CDC ADM code on Mac OS</title><link>https://devzone.nordicsemi.com/thread/129285?ContentTypeID=1</link><pubDate>Mon, 23 Apr 2018 08:28:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08474104-5ab9-4d90-97c6-7410a2d2855c</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you measure the interval between the APP_USBD_CDC_ACM_USER_EVT_TX_DONE events?&lt;/p&gt;
&lt;p&gt;Do you see the same beahvior if you split your 1&lt;span&gt;28 byte packets in two, i.e. use 64 bytes per packet for app_usbd_cdc_acm_write instead?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>