<?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>how to get data from pc by usb ep0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51333/how-to-get-data-from-pc-by-usb-ep0</link><description>SDK ver：15.2.0 
 demo：usbd 
 i want to use the 52840 usb function ，the pc is the host ，the 52840 is device。 
 i cant use respond_setup_data to send data to pc。 
 but how to get data from pc？ 
 source： 
 static void usbd_event_handler(nrf_drv_usbd_evt_t</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Nov 2019 07:56:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51333/how-to-get-data-from-pc-by-usb-ep0" /><item><title>RE: how to get data from pc by usb ep0</title><link>https://devzone.nordicsemi.com/thread/218140?ContentTypeID=1</link><pubDate>Mon, 04 Nov 2019 07:56:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b2468beb-7098-4b65-965b-8331d48671d8</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Sorry for the late reply.&lt;/p&gt;
&lt;p&gt;Endpoint 0 is used for control transfers only and can not be assigned to any other function.&lt;/p&gt;
&lt;p&gt;The USB specification mandates every USB device to implement endpoint 0 IN and OUT as control endpoints.&lt;/p&gt;
&lt;p&gt;See e.g. &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fusbd.html&amp;amp;cp=3_0_0_5_34_8&amp;amp;anchor=concept_usb_ctrl_ep"&gt;this &lt;/a&gt;and &lt;a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-endpoints-and-their-pipes"&gt;this link&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data from pc by usb ep0</title><link>https://devzone.nordicsemi.com/thread/209044?ContentTypeID=1</link><pubDate>Wed, 11 Sep 2019 01:25:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0963f38-3c31-4ff0-85b6-9208dfee66d1</guid><dc:creator>lyi</dc:creator><description>&lt;p&gt;&lt;span&gt;Sorry, I have been a little busy recently, so I didn&amp;#39;t reply in time&lt;/span&gt;，&lt;span&gt;Our requirement is to use ep0 port to transfer data，Could you please help me to try whether ep0 can accept the data of PC terminal? I really can&amp;#39;t find any problem，thanks。&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data from pc by usb ep0</title><link>https://devzone.nordicsemi.com/thread/206857?ContentTypeID=1</link><pubDate>Thu, 29 Aug 2019 12:05:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcca8096-eb1b-4a33-861e-9011810abaa1</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I believe you need&amp;nbsp;to&amp;nbsp;configure NRF_DRV_USBD_EPOUT1 for the data-transfer from pc to the nRF52840.&lt;/p&gt;
&lt;p&gt;If you are interested in using a predefined USB class, then perhaps&amp;nbsp;the&amp;nbsp;&lt;span&gt;CDC ACM USB class is more suitable for your application. Take look at the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/usbd_cdc_acm_example.html?cp=5_1_4_6_50_3"&gt;usbd_cdc_acm example&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(If you are creating your own custom USB class, then let me know, and I could create a simple example for that.)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data from pc by usb ep0</title><link>https://devzone.nordicsemi.com/thread/206295?ContentTypeID=1</link><pubDate>Tue, 27 Aug 2019 09:20:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9826e906-d2c9-4c1e-9adc-8dd5638d1608</guid><dc:creator>lyi</dc:creator><description>&lt;p&gt;hi thank for you answer.&lt;/p&gt;
&lt;p&gt;i want to get 32 byte of data from the pc, It is then transmitted to other devices through spi.&lt;/p&gt;
&lt;p&gt;how to use the &lt;em&gt;NRF_DRV_USBD_EVT_EPTRANSFER &lt;/em&gt;?&lt;/p&gt;
&lt;p&gt;I can use nrf_drv_usbd_ep_transfer(NRF_DRV_USBD_EPIN0, &amp;amp;transfer) to send data to PC,It can also trigger the&lt;/p&gt;
&lt;p&gt;usbd_event_handler function into the NRF_DRV_USBD_EVT_EPTRANSFER branch.&lt;/p&gt;
&lt;p&gt;but i can&amp;#39;t use the nrf_drv_usbd_ep_transfer(&lt;span style="background-color:#ff0000;"&gt;NRF_DRV_USBD_EPOUT0&lt;/span&gt;, &amp;amp;transfer) to get data from pc ,It does not&lt;/p&gt;
&lt;p&gt;trigger usbd_event_handler.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t understand the difference between them,Why can I send data to pc but not receive?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to get data from pc by usb ep0</title><link>https://devzone.nordicsemi.com/thread/206181?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2019 16:46:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14e04f17-ef50-43b6-881f-b3c543a942ed</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you explain what you are trying to send&amp;nbsp;in the setup stage?&lt;/p&gt;
&lt;p&gt;What type of data are you trying to send from the pc ? What are you trying to&amp;nbsp;achieve?&lt;/p&gt;
&lt;p&gt;If you are trying to do a &lt;em&gt;data transfer&lt;/em&gt;, then you should use the&amp;nbsp;&lt;em&gt;NRF_DRV_USBD_EVT_EPTRANSFER&amp;nbsp;&lt;/em&gt;event instead. See &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/hardware_driver_usbd.html?cp=5_5_0_2_0_20"&gt;this &lt;/a&gt;and &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Fgroup__nrf__drv__usbd.html&amp;amp;cp=5_5_0_6_9_0_35_25_6&amp;amp;anchor=gga9f0b03e5a41539896e07ccba22b67b3dab9887fadb83f5b3193b45845a62180df"&gt;this link.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>