<?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>SPI/USB will drop large multiple of packets in a row. Can&amp;#39;t keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61202/spi-usb-will-drop-large-multiple-of-packets-in-a-row-can-t-keep-up-with-1-mbps-on-nrf52840-dk</link><description>Hi, 
 I&amp;#39;m using an nrf52840 dk to query another device over spi and then pipe the response back USB to a host PC. Ideally, we&amp;#39;re piping data at 1 Mbps (which should be very much doable for USB) and for a little bit, it will work perfectly. Then randomly</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 May 2020 13:23:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61202/spi-usb-will-drop-large-multiple-of-packets-in-a-row-can-t-keep-up-with-1-mbps-on-nrf52840-dk" /><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/251503?ContentTypeID=1</link><pubDate>Mon, 25 May 2020 13:23:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59b0157a-d6f1-449c-afe2-003b9c8d4e77</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ryerye120"]Do you think these missed packets are related to how often I run _queue_process()?[/quote]
&lt;p&gt;It could be, but without seeing the whole picture, I would only be guessing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
[quote user="ryerye120"]Also what did you mean by &amp;quot;retry function&amp;quot;. I interpreted as checking the usb_write() return code. So now, my code will try to such that whenever a USB transfer returns something NOT(NRF_SUCCESS) then I run _queue_process() instead and then wait till the next iteration of my main loop&amp;nbsp;before trying another USB transfer.[/quote]
&lt;p&gt;Since you&amp;#39;re using the queue, events and handling related to usbd is performed in iterations, as per how often the _queue_process() function is called. If there&amp;#39;s something blocking the function from executing (like a delay in your main loop or similar), handling of the USBD traffic would also be delayed.&lt;/p&gt;
&lt;p&gt;Could you share more of your code so I can have a look, or even better; be able to reproduce the problem?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you have a log file or similar which has timestamped data on the host side, to see which transfers are missing? Is the data missing, as in you see &amp;quot;skipped packets&amp;quot;, or is the data delayed?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/251152?ContentTypeID=1</link><pubDate>Thu, 21 May 2020 20:25:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d2e9951-ee75-4797-84d3-a6d20e256bf7</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;Hi Hakon,&lt;/p&gt;
&lt;p&gt;So at first I thought it was fixed, but ultimately no.&amp;nbsp;Something is slowing down the USB transfer such that the FIFO fills up and then I start missing packets.&lt;/p&gt;
&lt;p&gt;Do you think these missed packets are related to how often I run _queue_process()?&lt;/p&gt;
&lt;p&gt;Also what did you mean by &amp;quot;retry function&amp;quot;. I interpreted as checking the usb_write() return code. So now, my code will try to such that whenever a USB transfer returns something NOT(NRF_SUCCESS) then I run _queue_process() instead and then wait till the next iteration of my main loop&amp;nbsp;before trying another USB transfer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This way my USB_transfer doesn&amp;#39;t block me from pushing SPI data into my FIFO.&lt;/p&gt;
&lt;p&gt;Regardless ... I still can&amp;#39;t empty out my FIFO fast enough.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/250685?ContentTypeID=1</link><pubDate>Tue, 19 May 2020 11:39:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c061e57-930c-43e6-824c-47df89886e6c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ryerye120"]I only call app_usbd_event_queue_process() once because I was scared of putting a blocking while loop before the spi_processing block. Again, I&amp;#39;m assuming this loop will be called enough times in between interrupts that it should be fine. Do you think this may cause a problem down the line?[/quote]
&lt;p&gt;&amp;nbsp;Sorry, I&amp;nbsp;didn&amp;#39;t think of the queue handler. try catching the &amp;quot;retry function&amp;quot; in a non-blocking fashion and setup the logic to run the _queue_process().&lt;/p&gt;
&lt;p&gt;Has there been any progress compared to the original race-condition/missing packets? Its a bit hard to follow by looking solely on code snippets.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/250274?ContentTypeID=1</link><pubDate>Fri, 15 May 2020 18:47:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19ab52de-91e7-483a-a16c-b2ffd9661e2c</guid><dc:creator>ryerye120</dc:creator><description>[quote userid="2115" url="~/f/nordic-q-a/61202/spi-usb-will-drop-large-multiple-of-packets-in-a-row-can-t-keep-up-with-1-mbps-on-nrf52840-dk/250090"]It is therefore very important that you check the return code from&amp;nbsp;app_usbd_cdc_acm_write().[/quote]
&lt;p&gt;Of course! I didn&amp;#39;t appreciate that app_usbd_cdc_acm_write() was non-blocking and wasn&amp;#39;t&amp;nbsp;checking the return value. This is definitely a major issue that I&amp;#39;ve now fixed in my code.&lt;/p&gt;
&lt;p&gt;Unfortunately, that alone didn&amp;#39;t seem to fix the issue - nor did the FIFO - nor did the combination.&lt;/p&gt;
&lt;p&gt;I played with my FIFO depth and in the end, putting a 2000 entry FIFO between the SPI and USB seemed to do the trick (while of course checking to make sure the usb_write() returned NRF_SUCCESS).&lt;/p&gt;
&lt;p&gt;Unfortunately, I worry that&amp;nbsp;I haven&amp;#39;t solved the root issue and that putting such a deep FIFO has just pushed the error further down the road.&lt;/p&gt;
&lt;p&gt;My code currently looks like:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;app_usbd_event_queue_process();

if (spis_xfer_done)
{
  spis_xfer_done = 0;
  data = process_data();
  fifo_status = fifoWrite(data); //if FIFO full, doesn&amp;#39;t do anything
  if (fifo_status == 0) 
  {
    NRF_LOG_INFO(&amp;quot;ERROR: FIFO FULL&amp;quot;);
  }
}

if (usb_xfer_done)
{
  if (fifoRead()) //if FIFO empty, function returns 0 and skips if block
  {
    // fifo updates pointers so that usb_data points to the right place
    size_t size = sprintf(usb_data)
    while (app_usbd_cdc_acm_write(&amp;amp;m_app_cdc_acm, m_tx_buffer, size) != NRF_SUCCESS);    
    usb_xfer_done = 0;
  }
  else
  {
    NRF_LOG_INFO(&amp;quot;FIFO Empty, nothing to send&amp;quot;);
  }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I only call app_usbd_event_queue_process() once because I was scared of putting a blocking while loop before the spi_processing block. Again, I&amp;#39;m assuming this loop will be called enough times in between interrupts that it should be fine. Do you think this may cause a problem down the line?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/250090?ContentTypeID=1</link><pubDate>Fri, 15 May 2020 07:24:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:764ecd58-bb31-4a89-a9c7-2262a79454e7</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Ryan,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ryerye120"]Am I right to assume that the USB driver finishes really fast? Or is there overhead that I&amp;#39;m not accounting for.[/quote]
&lt;p&gt;The call to app_usbd_cdc_acm_write() will not be a blocking call (ie: will return before the transaction is done), and eventually you will get a callback in your event handler with event &amp;quot;APP_USBD_CDC_ACM_USER_EVT_TX_DONE&amp;quot;. At this point, the transaction is done and fully transferred to the USB host.&lt;/p&gt;
&lt;p&gt;It is therefore very important that you check the return code from&amp;nbsp;app_usbd_cdc_acm_write(). If your timing on SPI / USB is asynchronous to each other, then you can get into a scenario where you push several packets through USB, and this function returning&amp;nbsp;NRF_ERROR_BUSY (0x11, 17 decimal). At this point, you should wait, then try to call the _acm_write() function again. Its simplest form for testing purposes is: while (&lt;span&gt;app_usbd_cdc_acm_write(...) != NRF_SUCCESS);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;These types of while-loops should not be called from interrupts (including callback handlers)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user="ryerye120"]Right now I&amp;#39;m considering putting a FIFO&amp;nbsp; in that the spi will push data into and the USB driver will pop from? Unfortunately, I don&amp;#39;t know if there&amp;#39;s enough space to make this FIFO worth it since it would need to be 520 bits x 1024 at least...[/quote]
&lt;p&gt;If you need to buffer up 1024 entries, this indicates a very large delay in USB communications. Having a buffer that is between 2-10 entries deep should be sufficient, unless you plan to buffer while the USB is inactive (not plugged in)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ryerye120"]Also thanks Hakon and everyone who&amp;#39;s chimed in.&amp;nbsp;I really appreciate all of your help. Otherwise, I&amp;#39;d be on my lonesome and be a sad boy.[/quote]
&lt;p&gt;Happy to help! No one wants you to be sad and lonesome.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/250043?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 18:03:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d9c94a7-ecff-415a-b15a-f5dde8e339ea</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;Hi Hakon!&lt;/p&gt;
[quote userid="2115" url="~/f/nordic-q-a/61202/spi-usb-will-drop-large-multiple-of-packets-in-a-row-can-t-keep-up-with-1-mbps-on-nrf52840-dk/249862"]Did you call app_usbd_cdc_acm_write() directly from the SPI interrupt callback prior to this? [/quote]
&lt;p&gt;I tried this a long time ago&amp;nbsp;but ultimately moved everything to the main specifically because of what you were saying. I worried that if I&amp;nbsp;put the data processing and the usb_write() in the SPI interrupt handler, then I&amp;#39;d run into issues down the line. Thanks for confirming this because I&amp;#39;m kind of going off the cuff here.&lt;/p&gt;
[quote userid="2115" url="~/f/nordic-q-a/61202/spi-usb-will-drop-large-multiple-of-packets-in-a-row-can-t-keep-up-with-1-mbps-on-nrf52840-dk/249862"]Do you clear the usb_xfer_done flag somewhere else in that loop?[/quote]
&lt;p&gt;Yea sorry, in my actual code, I actually clear usb_xfer_done&amp;nbsp;in that inner if-sentence. I&amp;#39;ve updated the above blurb to reflect this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Am I right to assume that the USB driver finishes really fast? Or is there overhead that I&amp;#39;m not accounting for.&lt;/p&gt;
&lt;p&gt;Right now I&amp;#39;m considering putting a FIFO&amp;nbsp; in that the spi will push data into and the USB driver will pop from? Unfortunately, I don&amp;#39;t know if there&amp;#39;s enough space to make this FIFO worth it since it would need to be 520 bits x 1024 at least...&lt;/p&gt;
&lt;p&gt;Also thanks Hakon and everyone who&amp;#39;s chimed in.&amp;nbsp;I really appreciate all of your help. Otherwise, I&amp;#39;d be on my lonesome and be a sad boy.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249862?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 08:48:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95eb7559-a95a-42dd-8d15-eda8fb07d64a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Did you call app_usbd_cdc_acm_write() directly from the SPI interrupt callback prior to this? By moving it to main, with a flag &amp;quot;usb_xfer_done&amp;quot;, you are essentially forcing the usbd process to occur in main priority instead of interrupt priority, which is a good thing, as you want interrupts to finish processing as quick as possible.&lt;/p&gt;
&lt;p&gt;Do you clear the usb_xfer_done flag somewhere else in that loop? Right now, your code will run the inner if-sentence regardless of if the usb is finished or not.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249809?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 18:49:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3607f326-72f1-4c8e-a30b-b7bd112ae934</guid><dc:creator>Mojo</dc:creator><description>&lt;p&gt;You can send a packet containing prbs code. &amp;nbsp;Google &amp;#39;prbs&amp;#39;. &amp;nbsp;On the receiving side check the code for error. &amp;nbsp;You only printout when there is an error. &amp;nbsp;Then you&amp;#39;ll know whether your spirits transfer is good. I am assuming you are handling Master/Slave.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249808?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 18:37:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6029f47c-5e7c-43f2-8ffa-d42000965280</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;The SPI clock? I set it to 4MHz because I was getting set up errors at 8MHz.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I should note that I found a bug in my code. Now if I save all the SPI codes and send them over USB *after* the fact, I don&amp;#39;t drop any packets. So is there a recommended way of transferring&amp;nbsp;data from SPI to USB on a packet-per-packet basis?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Earlier I had a naive nested conditional:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;app_usbd_event_queue_process();
if (spi_xfer_done)
{
    spis_xfer_done = 0;
    if (usb_xfer_done)
    {
        size = sprintf(some data);
        app_usbd_cdc_acm_write(some data, size);
        usb_xfer_done = 0;
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Where spi_xfer_done is set to 1 by the spi_event_handler &amp;amp; usb_xfer_done is set to 1 by a handler looking out for the&amp;nbsp;APP_USBD_CDC_ACM_USER_EVT_TX_DONE event.&lt;/p&gt;
&lt;p&gt;This assumes that the USB driver is much faster than the SPI driver and will finish before the next SPI transaction is fired off/complete. Unfortunately, I must be missing something because experimentally speaking, this doesn&amp;#39;t work.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249807?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 18:30:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd463186-6171-4843-99e0-35ddc438b995</guid><dc:creator>Mojo</dc:creator><description>&lt;p&gt;What is your SPI speed settings ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249794?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 15:42:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a8264b8-3cac-42af-8f28-5e642ea86d94</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;Sorry I did mean 500us. That was a silly mistake on my part. 512 bits every 500 us.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using&amp;nbsp;v16.0.0 of the SDK (which I believe is the latest).&amp;nbsp;In this setup, it&amp;#39;s purely SPIM and USBD. At least, those are the only things that I&amp;#39;m making calls to.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249632?ContentTypeID=1</link><pubDate>Wed, 13 May 2020 09:16:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:558a9770-96ce-4bb2-ad80-17504414632e</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Ryan,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ryerye120"]Does CDC have a similar limit?[/quote]
&lt;p&gt;No, that should be able to push more data through the link.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="ryerye120"]I send 520 bits every 500 ms[/quote]
&lt;p&gt;&amp;nbsp;65 bytes will trigger a 64 byte + 1 byte transaction over USB, as your EP size is 64. Sending that every 500 milliseconds should be plenty time, or do you mean every 500 us?&lt;/p&gt;
&lt;p&gt;Which SDK version are you using? What else than SPIM and USBD is running in your application? Do you have any BLE links active?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249558?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 17:19:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a357de7f-20b7-4ba9-af69-9c9fa5f7f6a5</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;The SPIM is running on the nRF.&lt;/p&gt;
&lt;p&gt;I can try with RTT to see if the chip select issue continues (you&amp;#39;re right in that I was using UART debugging) - and if not, I can look into debugging with that.&lt;/p&gt;
&lt;p&gt;I send 520 bits every 500 us (so throughput is slightly higher than 1 Mbps). The software will send/receive 520 bits over SPI, then&amp;nbsp;after a flag (spi_xfr_complete flag) is tripped in the main() body. After this flag is tripped, the data is processed (minorly) and then sent via USB to the host pc.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve built this off the CDC example so&amp;nbsp;it enumerates as CDC with whatever settings were in the usb_CDC example.&amp;nbsp;Does CDC have a similar limit?&lt;/p&gt;
&lt;p&gt;Thank you for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249388?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 09:19:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84583574-72b6-4be5-8555-1e1408b3e21c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Is the SPIM or SPIS running on the nRF?&lt;/p&gt;
&lt;p&gt;If logging is an issue, you could use RTT instead of UART as the logger backend (see sdk_config.h::NRF_LOG_BACKEND_RTT_ENABLED and clearing&amp;nbsp;NRF_LOG_BACKEND_UART_ENABLED) to see if something is caught and printed.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How large are the USB packets and how often do you send? How does your device enumerate, HID, CDC, libusb, winusb?&lt;/p&gt;
&lt;p&gt;Note that HID is limited to 64 byte per 1 ms frame.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249328?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 04:35:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc7dac6b-c8f5-42d5-ad73-dd204316da6c</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;Yea I agree that there seems to be an issue with the SPI code. I tried writing all the SPI data to a buffer and then reading that out over USB after the fact (in order to decouple the two) and I still had missing packets. I rarely missed a single packet, rather large chunks of adjacent packets were missed so it seems to me that there is some process interrupting&amp;nbsp;the SPI.&lt;/p&gt;
&lt;p&gt;But even that seems odd since the SPI should mostly be handled by hardware.&lt;/p&gt;
&lt;p&gt;Do you have any suggestions for testing the SPI out on its own? Using the NRF Log is a no go because it will sometimes cause issues with the SPI&amp;#39;s chip select driver and limit data throughput to &amp;lt;1Mbps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI/USB will drop large multiple of packets in a row. Can't keep up with 1 Mbps on nrf52840 dk?</title><link>https://devzone.nordicsemi.com/thread/249322?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 00:49:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f64f7f0d-5b6c-47c9-a0fe-cba3009ac372</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;USB is 12MHz no way USB can be slower than SPI.&amp;nbsp; The problem is more likely in your SPI code.&amp;nbsp; Have you validate that you got all the data through SPI before sending to USB ? Are you also sure the SPI sender actually sent all the data correctly.&amp;nbsp; Validate each step of the way in order to find where the issue is.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>