How to check if STM32F105 is powered by USB
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2010-12-08 2:57 AM
Posted on December 08, 2010 at 11:57
How to check if STM32F105 is powered by USB
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:17 AM
Posted on May 17, 2011 at 14:17
The easiest thing is to check CIDSTS in the GOTCTL register. This will tell you, if there is a USB cable attached. But unfortunately it will not tell you, if there is power on the cable.
I would suggest to take a look at chapter 27.16.8 in the Reference Manual. It describes the dual role device, but some information can be used for normal device mode, too. Especially the VBUSBSEN bit in GCCFG should be usefull for your case. (I never used it by myself, so I can not tell for sure)Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 5:17 AM
Posted on May 17, 2011 at 14:17
Hi, tried posting this three times thus far, not sure what I'm doing wrong but anyway, hopefully it gets out this time.
A thought: why not use some diodes and a voltage divider to separate the two voltage sources and enable detection? When USB is plugged in, the attached schematic should produce 3V (logic high) on its output. When USB is unpluggged, the MCU should see a logic low since the voltage divider will pull to 0V. This should work with both USB power supplies and real USB hosts. Regards, Stuart Longland