<?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>nRF52820 USB connection detection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86298/nrf52820-usb-connection-detection</link><description>Dear , 
 I am using nrf52833dk with NCS1.7.0 SDK. 
 Is there any flag or register value that I could use to determine if the device has been connected via USB? Or I can only achieve this using hardware approaches, for example, using IO to monitor the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 31 Mar 2022 09:47:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86298/nrf52820-usb-connection-detection" /><item><title>RE: nRF52820 USB connection detection</title><link>https://devzone.nordicsemi.com/thread/360967?ContentTypeID=1</link><pubDate>Thu, 31 Mar 2022 09:47:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:721840a0-aee3-4130-927e-c85725d804b9</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/zephyr/reference/usb/uds.html#c.usb_enable"&gt;usb_enable()&lt;/a&gt;&amp;nbsp;function that you call in your application has a parameter to provide a status callback function. An example of this can be seen in the &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/samples/subsys/usb/hid/src/main.c#L117-L135"&gt;USB HID sample&lt;/a&gt;. When the USB driver enters the POWERED state, &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/drivers/usb/device/usb_dc_nrfx.c#L724"&gt;a&amp;nbsp;&lt;span&gt;USB_DC_CONNECTED event will be passed to this callback&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52820 USB connection detection</title><link>https://devzone.nordicsemi.com/thread/360905?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2022 22:42:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86d70d8a-03a3-414c-81b1-efd9b49a09c3</guid><dc:creator>pigno5e</dc:creator><description>&lt;p&gt;Dear&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks a lot for your reply.&amp;nbsp;&lt;/span&gt;&lt;span&gt;I checked the link above and it makes sense to me. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;However, could you please kindly help explain a bit more as I am still not quite sure how I can use the value of the &amp;quot;new state&amp;quot; variable that is updated via the function&amp;nbsp;submit_dc_power_event()?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/b05b8ad63acf30e08a570ce553831a06db27a2e0/drivers/usb/device/usb_dc_nrfx.c#L524"&gt;github.com/.../usb_dc_nrfx.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks and kind regards, Kevin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52820 USB connection detection</title><link>https://devzone.nordicsemi.com/thread/360482?ContentTypeID=1</link><pubDate>Tue, 29 Mar 2022 09:11:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7217b323-5361-4fd2-b0d3-f16890721b05</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The nRF52820/nRF52833 POWER peripheral has a&amp;nbsp;&lt;a title="EVENTS_USBDETECTED" href="https://infocenter.nordicsemi.com/topic/ps_nrf52820/power.html?cp=4_3_0_4_2_6_5#register.EVENTS_USBDETECTED"&gt;USBDETECTED event&lt;/a&gt;&amp;nbsp;which will be set when the VBUS power is detected.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.7.99-ncs1-1/drivers/usb/device/usb_dc_nrfx.c#L502"&gt;Zephyr USB stack/nrfx_usb driver will detect this event&lt;/a&gt;, and put the stack in the correct state for you.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>