<?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</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36414/usb</link><description>Is it possible to tell if the USB is connected to a wall-charger as opposed to a PC?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 Mar 2020 11:03:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36414/usb" /><item><title>RE: USB</title><link>https://devzone.nordicsemi.com/thread/237691?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2020 11:03:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:458c8fe4-58dd-4f60-9f67-d5e436c0ddb1</guid><dc:creator>Dmitriy L1</dc:creator><description>&lt;p&gt;I&amp;#39;m understand that topic is outdated, but it might be useful for those who has the same problem.&lt;br /&gt;&lt;br /&gt;I added &lt;strong&gt;APP_USBD_EVT_DRV_SOF&lt;/strong&gt; case to &lt;strong&gt;usbd_user_ev_handler()&lt;/strong&gt;&amp;nbsp; . If device is connected to wall charger SOF event would never come, so it can be easiest way to distinguish whether it plugged to USB host or not. At least this trick is works for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: USB</title><link>https://devzone.nordicsemi.com/thread/140257?ContentTypeID=1</link><pubDate>Mon, 16 Jul 2018 15:54:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e1771dd-955d-49c9-955c-0a9b8ba408fa</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I have not checked exactly which events that are the best to check for, but you can figure out quite fast whether you get some USB events or not. If you don&amp;#39;t get the USB events in a couple of seconds, you can conclude that you are only receiving power through the USB, and that you are connected to a wall-charger.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&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>