<?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>USB Power detect in SDK 16.0 as event to prevent polling</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84463/usb-power-detect-in-sdk-16-0-as-event-to-prevent-polling</link><description>Hi Nordic 
 
 I have been using your example on USB MST to embed it into my application 
 
 Everything works ok, but in the main loop im constantly polling for USB power event( app_usbd_event_queue_process() ) to detect when the USB cable is connected</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Feb 2022 08:29:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84463/usb-power-detect-in-sdk-16-0-as-event-to-prevent-polling" /><item><title>RE: USB Power detect in SDK 16.0 as event to prevent polling</title><link>https://devzone.nordicsemi.com/thread/352234?ContentTypeID=1</link><pubDate>Thu, 10 Feb 2022 08:29:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a20acf7-e42d-48bb-803a-588ecc62a4fd</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I think the issue is that when the USB is interrupt driven, there are events that doesn&amp;#39;t occur. If you get the NRF_EVT_POWER_USB_POWER_READY and the other events that you need using this implementation, then I guess it is fine. Do you see these events?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t remember the details of what events that doesn&amp;#39;t occur, but if you get these events, and it is all you need, then I guess it can work. But if you want to do data transfers over USB, then I don&amp;#39;t think you can use it in interrupt mode because of the lacking events.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Power detect in SDK 16.0 as event to prevent polling</title><link>https://devzone.nordicsemi.com/thread/351650?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 22:26:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7bb794d-36dc-4ec5-bb9a-f2c1427359fa</guid><dc:creator>Tommy F Kristensen</dc:creator><description>&lt;p&gt;Hi Edvin&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for your answer. I was trying to configure a SOC handler and then get the power events this way&lt;/p&gt;
&lt;p&gt;Some thin like this, and then handle the USB stack init here. Is this an reasonable way to go and what have to be enabled to use this, do you have an example, as it is a bit big task to switch SDK now&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &lt;/span&gt;&lt;span class="pl-c1"&gt;NRF_SDH_SOC_OBSERVER&lt;/span&gt;&lt;span&gt;(m_soc_observer, APP_SOC_OBSERVER_PRIO, soc_evt_handler, &lt;/span&gt;&lt;span class="pl-c1"&gt;NULL&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;// SoftDevice SoC event handler.&lt;br /&gt;static void soc_evt_handler(uint32_t evt_id, void * p_context)&lt;br /&gt;{&lt;br /&gt; switch (evt_id)&lt;br /&gt; {&lt;br /&gt; case NRF_EVT_POWER_USB_POWER_READY: /**&amp;lt; Event indicating that a USB 3.3 V supply is ready. */&lt;/p&gt;
&lt;p&gt;break;&lt;br /&gt;case NRF_EVT_POWER_USB_DETECTED: /**&amp;lt; Event indicating that voltage supply is detected on VBUS. */&lt;/p&gt;
&lt;p&gt;&lt;span&gt;break;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;case NRF_EVT_POWER_USB_REMOVED: /**&amp;lt; Event indicating that voltage supply is removed from VBUS. */&lt;/p&gt;
&lt;p&gt;break;&lt;/p&gt;
&lt;p&gt;default:&lt;br /&gt; // No implementation needed.&lt;br /&gt; break;&lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best Regards&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Tommy F Kristensen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB Power detect in SDK 16.0 as event to prevent polling</title><link>https://devzone.nordicsemi.com/thread/351646?ContentTypeID=1</link><pubDate>Mon, 07 Feb 2022 21:23:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5277cb0d-311a-4325-8e01-19e90ea32052</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Tommy,&lt;/p&gt;
&lt;p&gt;The reason why the examples are using the app_usbd_event_queue_process() is that there are some bugs in the USB drivers, which prevents the USB event handler from working properly. I see from some internal communication that this was not fixed in the nRF5 SDK, and I wouldn&amp;#39;t rely on that being fixed in the future (in the nRF5 SDK), since we put most of our efforts in the nRF Connect SDK at this point in time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>