<?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>Detect USB on nRF52840 and nRF52820</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111131/detect-usb-on-nrf52840-and-nrf52820</link><description>Hi. 
 Can you please tell me how to detect the presence of connected (detect event) USB on microcontrollers nRF52840 and nRF52820? 
 Thanks.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 May 2024 16:51:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111131/detect-usb-on-nrf52840-and-nrf52820" /><item><title>RE: Detect USB on nRF52840 and nRF52820</title><link>https://devzone.nordicsemi.com/thread/484762?ContentTypeID=1</link><pubDate>Thu, 16 May 2024 16:51:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:214cb760-6b24-4a6a-9658-e49afe6bcc46</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;Thanks again for your responses. &lt;br /&gt;I will most likely use the solution provided in the nRF52840DK schematic for USB detection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Detect USB on nRF52840 and nRF52820</title><link>https://devzone.nordicsemi.com/thread/483527?ContentTypeID=1</link><pubDate>Wed, 15 May 2024 13:41:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:442f1c1d-cf8e-4755-9de8-e4259b042691</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;It seems that currently there is no straightforward way to get USBDETECTED events in the application in Zephyr.&amp;nbsp;However, there is a pull request on the Zephyr project on GitHub that aims to provide this functionality, but it&amp;#39;s unclear when this PR will be merged. You can follow the progress of this pull request &lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/51034"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/51034&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Also see discussion on this devzone case: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/104785/usb-detection-by-pin?ReplyFilter=Answers&amp;amp;ReplySortBy=Answers&amp;amp;ReplySortOrder=Descending"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/104785/usb-detection-by-pin?ReplyFilter=Answers&amp;amp;ReplySortBy=Answers&amp;amp;ReplySortOrder=Descending&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Detect USB on nRF52840 and nRF52820</title><link>https://devzone.nordicsemi.com/thread/483477?ContentTypeID=1</link><pubDate>Wed, 15 May 2024 11:36:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca2b49b0-6d25-4fbd-8d30-ba9478866326</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;Thank you for your recommendations.&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;Can you please tell me if the &amp;quot;USB_DC_CONNECTED&amp;quot; event is triggered when there is voltage on the VBUS or if the D+ and D- lines should be connected as well?&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;Do I need to describe the USB in the device tree file (.dts) in some way?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Detect USB on nRF52840 and nRF52820</title><link>https://devzone.nordicsemi.com/thread/483351?ContentTypeID=1</link><pubDate>Tue, 14 May 2024 18:31:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65ae178d-ccab-4e05-8d82-01976dd77bd5</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;My suggestion, take the usb example that closest resemble what you want to make. Then find an example that have&amp;nbsp;&lt;span&gt;usb_enable(&amp;quot;with something else than NULL&amp;quot;); and re-use that callback handler.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&gt;&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: Detect USB on nRF52840 and nRF52820</title><link>https://devzone.nordicsemi.com/thread/483348?ContentTypeID=1</link><pubDate>Tue, 14 May 2024 17:21:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fd95a6f-98a9-4b17-9131-53cddbb6edef</guid><dc:creator>backstreet.devisor</dc:creator><description>&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;Are there any code samples where these callbacks are used?&amp;nbsp;What libraries do I need to include in for this?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Detect USB on nRF52840 and nRF52820</title><link>https://devzone.nordicsemi.com/thread/483346?ContentTypeID=1</link><pubDate>Tue, 14 May 2024 17:13:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c16e7ff-fc03-4f6f-bf02-149440939649</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I can see that the callback you define when calling usb_enable(&lt;span&gt;usb_dc_status_callback&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;status_cb) can provide multiple events that may be useful, see:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * @brief USB Driver Status Codes
 *
 * Status codes reported by the registered device status callback.
 */
enum usb_dc_status_code {
	/** USB error reported by the controller */
	USB_DC_ERROR,
	/** USB reset */
	USB_DC_RESET,
	/** USB connection established, hardware enumeration is completed */
	USB_DC_CONNECTED,
	/** USB configuration done */
	USB_DC_CONFIGURED,
	/** USB connection lost */
	USB_DC_DISCONNECTED,
	/** USB connection suspended by the HOST */
	USB_DC_SUSPEND,
	/** USB connection resumed by the HOST */
	USB_DC_RESUME,
	/** USB interface selected */
	USB_DC_INTERFACE,
	/** Set Feature ENDPOINT_HALT received */
	USB_DC_SET_HALT,
	/** Clear Feature ENDPOINT_HALT received */
	USB_DC_CLEAR_HALT,
	/** Start of Frame received */
	USB_DC_SOF,
	/** Initial USB connection status */
	USB_DC_UNKNOWN
};&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>