<?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 usbd problems</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59487/nrf52840-usbd-problems</link><description>Hi, 
 I use nrf52840, I meet some problems about the USBD, Can you help me? 
 We know that the usb device send data to host(such as PC) by EPIN： 
 (1) The host send IN event, But devie send NAK to host, because LOCAL BUFFER do not have any data, So many</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Mar 2020 13:16:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59487/nrf52840-usbd-problems" /><item><title>RE: nrf52840 usbd problems</title><link>https://devzone.nordicsemi.com/thread/242438?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2020 13:16:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:daf87a17-b265-4959-a182-6c6770e492ab</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It appears you are not using&amp;nbsp;our USBD drivers, is that correct?&lt;/p&gt;
&lt;p&gt;I would strongly advice against this, as we have spent a lot of time on these drivers to ensure that they work reliably with the chip. Most likely will you&amp;nbsp; have to spend significant development time to implement a similar driver, and it is much harder for us to support you if you don&amp;#39;t use the official drivers.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[quote user="unrulife"][/quote]&lt;/p&gt;
&lt;p&gt;Is stalling the EPIN[3] by EPSTALL register will clear the error status ?&lt;/p&gt;
&lt;p&gt;Could you help me to find some way , or ask for the developer ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The developer mentioned that running the &lt;a href="https://github.com/NordicSemiconductor/nrfx/blob/master/drivers/src/nrfx_usbd.c#L842"&gt;nrfx_usbd_ep_abort()&lt;/a&gt; function might clear this error status, but again he strongly suggested switching to the official drivers in the SDK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 usbd problems</title><link>https://devzone.nordicsemi.com/thread/241809?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 11:57:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2bc8460-2802-4c12-a4ba-54e588641306</guid><dc:creator>unrulife</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thanks for your reply!&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t done any benchmarking to see how high the CPU utilization is.&lt;/p&gt;
&lt;p&gt;But I don&amp;#39;t use the USB intterrupts&amp;nbsp;method during&lt;span&gt;&amp;nbsp;the procedure of communication stage which uses EP[3] and EP[4].&amp;nbsp;&amp;nbsp;&lt;/span&gt;I only used the USB interrupt method during procedure of USB enumeration which uses EP[0].&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Because I&amp;#39;ve found that if I use USB interrupts during communication , the&amp;nbsp; interrupts are often lost, probably because the USB interrupt priority is too low.&amp;nbsp;&lt;/span&gt;The interrupt priority for my USB is 6 .&amp;nbsp; I don&amp;#39;t want to use the priority of 2 or 3. because I don&amp;#39;t allow that&amp;nbsp;the ble SVC CALL is delayed by the USB intterupts.So finally, I give up the style of USB intterrupt.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p class="src highlight"&gt;Here&amp;#39;s an example of how I use it:&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, if I want to send data to the computer via EPIN[3],&amp;nbsp;&lt;span&gt;I will first&amp;nbsp;send the RAM data to the USB local buffer by DMA, and then I will&amp;nbsp;wait and check if the corresponding bit of EPIN[3]&amp;nbsp; in EPDATASTATUS register is set. If it has been set, I will clear&amp;nbsp;this bit and complete this procedure.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In a similar way , If I want to receive some data from computer via EPOUT[4], I will wait and check if the corresponding&amp;nbsp;bit&amp;nbsp;of&amp;nbsp;EPOUT[3]&amp;nbsp; in EPDATASTATUS register is set, If it has been set, I will read back the data from local buffer to data RAM by DMA. And then I clear the bit and complete this procedure.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;while my question is that:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If EPIN[3] send incomplete data(miss CRC last byte) to computer, the computer will not send ACK to nrf52840,&amp;nbsp;&amp;nbsp;and then the corresponding&amp;nbsp;bit&amp;nbsp;of&amp;nbsp;EPIN[3]&amp;nbsp; in EPDATASTATUS register of nrf52840 will not be set. And the error status will be remember by nrf52840. when next IN event is coming,&amp;nbsp;nrf52840 automatically send the previous data&amp;nbsp;instead of the data I update by DMA in&amp;nbsp;the local buffer .&lt;/span&gt;So my software logic got messed up.&lt;/p&gt;
&lt;p&gt;Could you tell me that is there any way I can clear the error status of EPIN[3]?&lt;/p&gt;
&lt;p&gt;I know that re-&lt;em&gt;&lt;span class="skip"&gt;enumerate&amp;nbsp;&lt;/span&gt;&lt;/em&gt;USB devices will clean up all the error states. But It cost much time.&lt;/p&gt;
&lt;p&gt;Is stalling the EPIN[3] by EPSTALL register will clear the error status ?&lt;/p&gt;
&lt;p&gt;Could you help me to find some way , or ask for the developer ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 usbd problems</title><link>https://devzone.nordicsemi.com/thread/241781?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 10:33:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee76fbc0-767f-4a15-8419-96bf2fb0a178</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;That&amp;#39;s indeed a lot of activities happening at the same time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you done any benchmarking to see how high the CPU utilization is?&lt;br /&gt;Or maybe more importantly, how much of the time is the CPU busy handling interrupts or events from the Bluetooth softdevice?&lt;/p&gt;
&lt;p&gt;I can check with the developer how much the USB interrupts can be delayed before it starts affecting&amp;nbsp;the USB operation, as this is probably an issue in this case.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 usbd problems</title><link>https://devzone.nordicsemi.com/thread/241628?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 14:46:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe4e00e6-df7f-48e0-aed5-f822b7ee3cfc</guid><dc:creator>unrulife</dc:creator><description>&lt;p&gt;The host device that I used is a desktop computer(PC).&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t provide a log , because I develop it in a special place, I can&amp;#39;t take anything out from that place , Because of the high level of security of my company.&lt;/p&gt;
&lt;p&gt;But I can provide more details about the scene:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As a ble master device, I use the nRF52840 scan and connect &lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;10 slave&lt;/strong&gt; &lt;/span&gt;ble devices, And the connect interval is &lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;7.5ms&lt;/strong&gt;&lt;/span&gt;,&amp;nbsp;And I let&amp;nbsp;it continue with a permanent scan. And the scan interval is &lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;80ms&lt;/span&gt;&lt;/strong&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Meanwhile It is also a ble slave device,&amp;nbsp;It broadcasts at &lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;50ms advtisement intervals&lt;/strong&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Under the above working conditions, I also develop nrf52840 as a USB BOT protocol device, I connect it with a computer by USB.&lt;/p&gt;
&lt;p&gt;And then I developed a desktop tool which&amp;nbsp;call the windows USB API function on computer. The tool can send USB BOT protocal data to nrf52840 device .&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The style of USB data transfer by end point is :&lt;/p&gt;
&lt;p&gt;Host&amp;nbsp;-&amp;gt; Slave&amp;nbsp;: The&amp;nbsp;procedure of&amp;nbsp; the host sends data to nrf52840 is EPOUT[4] -&amp;gt; EPOUT&lt;span&gt;[4](maybe more than one pack blongs to the data size that you want to send)&amp;nbsp;&lt;/span&gt;-&amp;gt; EPIN&lt;span&gt;3]&lt;/span&gt;,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Slave &lt;/span&gt;&lt;span&gt;-&amp;gt; &lt;/span&gt;&lt;span&gt;Host :&amp;nbsp;&lt;/span&gt;while the procedure&amp;nbsp; of nrf52840 send data to host is EPOUT&lt;span&gt;[4]&amp;nbsp;&lt;/span&gt;-&amp;gt; EPIN[3]&lt;span&gt;(maybe more than one&amp;nbsp;pack blongs to the data size that you want to send&lt;/span&gt;&lt;span&gt;)&amp;nbsp;&lt;/span&gt; -&amp;gt; EPIN&lt;span&gt;3]&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I repeat the procedure of&amp;nbsp;&lt;span&gt;Host&amp;nbsp;-&amp;gt; Slave&amp;nbsp; and&amp;nbsp;Slave&amp;nbsp;-&amp;gt;&amp;nbsp;Host&amp;nbsp; &lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;quickly as possible&lt;/strong&gt;&lt;/span&gt;. Maybe some minutes later , nrf52840 can&amp;#39;t receive the EPDATASTATUS being set at EPIN[3] . And I Found that the last byte of CRC of the data is not sent by the USB protocol analyzer. And then the computer don&amp;#39;t send ACK to nrf52840.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If I&amp;nbsp;don&amp;#39;t enable BLE master and slave function, Just let USB work,&amp;nbsp;&lt;/span&gt;It&amp;#39;s not going to be like that, It will be normal even some hours later.&lt;/p&gt;
&lt;p&gt;I search the source code of &amp;quot;nrfx_usbd_errata.h&amp;quot; ，And I searched the 《nRF52840_Rev_2_Errata_v1.2.pdf》, Finally , I can&amp;#39;t find the answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 usbd problems</title><link>https://devzone.nordicsemi.com/thread/241610?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 13:36:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:554d48f5-cba5-4b64-8001-2b1d561b889d</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;What kind of&amp;nbsp; host device are you using?&lt;/p&gt;
&lt;p&gt;Are you able to provide a log of the USB communication that we can take a look at?&lt;/p&gt;
&lt;p&gt;According to one of the USB developers we have never seen any issues with missing CRC bytes being sent from the USBD interface in the nRF52840. This is handled by dedicated hardware in the USBD interface, and will not be affected by other activities in the nRF52840 device.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52840 usbd problems</title><link>https://devzone.nordicsemi.com/thread/241571?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 11:01:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:248e918d-3ebe-4720-9a1c-41634e7e3602</guid><dc:creator>unrulife</dc:creator><description>&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1585134095332v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>