Not applicable
Sep 21, 2015
05:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 21, 2015
05:35 AM
Dear XMC community.
I use Relax Lite Kit, DAVE 3.1.10 and USBD_VCOM app. One function of my device is to show time on LCD screen, it runs on batteries but sometimes USB cable might be connected to set time or just to power the device.
When the only power supply are batteries I want the device to go to deep sleep mode (with stopping USB clock if possible). When there is a USB power supply I want it to work in normal mode.
Can I detect USB presence using software? Maybe software can detect USB VBUS presence - couldn't understand it from reference manual.
Thank You!
I use Relax Lite Kit, DAVE 3.1.10 and USBD_VCOM app. One function of my device is to show time on LCD screen, it runs on batteries but sometimes USB cable might be connected to set time or just to power the device.
When the only power supply are batteries I want the device to go to deep sleep mode (with stopping USB clock if possible). When there is a USB power supply I want it to work in normal mode.
Can I detect USB presence using software? Maybe software can detect USB VBUS presence - couldn't understand it from reference manual.
Thank You!
5 Replies
Not applicable
Sep 28, 2015
07:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 28, 2015
07:10 AM
I don't believe that there is no easy way to check USB connection presence.
Oct 05, 2015
05:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 05, 2015
05:08 AM
Hi Dronchic,
It depends on the hardware set up.
- If the ID line is connected you can have easily the disconnect Interrupt when the ID line gets disconnected.
- If the ID line is not connected you will not have the disconnect interrupt and the process is a bit more complex.
In this case the device disconnect detection flow is as follows:
1. When the USB cable is unplugged or when the VBUS is switched off by the Host, the
device core triggers the RESET(GINTSTS.USBRst [bit 12]) interrupt bit.
2. When the device application detects GINTSTS.USBRst, the application sets a timeout
check for set address control transfer from host.
3. If application does not receive set address control transfer from host before the timeout
period, it is treated as a device disconnection.
The Relax Lite Kit has not connected the ID line so, in your case, the process to follow would fit to the second point described.
Best regards,
Angel
It depends on the hardware set up.
- If the ID line is connected you can have easily the disconnect Interrupt when the ID line gets disconnected.
- If the ID line is not connected you will not have the disconnect interrupt and the process is a bit more complex.
In this case the device disconnect detection flow is as follows:
1. When the USB cable is unplugged or when the VBUS is switched off by the Host, the
device core triggers the RESET(GINTSTS.USBRst [bit 12]) interrupt bit.
2. When the device application detects GINTSTS.USBRst, the application sets a timeout
check for set address control transfer from host.
3. If application does not receive set address control transfer from host before the timeout
period, it is treated as a device disconnection.
The Relax Lite Kit has not connected the ID line so, in your case, the process to follow would fit to the second point described.
Best regards,
Angel
Not applicable
Oct 06, 2015
04:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oct 06, 2015
04:53 AM
Hi AngelB,
Thanks for your answer, I'll try to implement your method.
I've found USB_DeviceGetState() function. It returns USB Device status flags such as "powered" and "connected".
These flags are set correctly when I plug USB cable in, but they don't reset when I unplug USB cable.
Best regards,
Andrey
Thanks for your answer, I'll try to implement your method.
I've found USB_DeviceGetState() function. It returns USB Device status flags such as "powered" and "connected".
These flags are set correctly when I plug USB cable in, but they don't reset when I unplug USB cable.
Best regards,
Andrey
Not applicable
Nov 25, 2015
06:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 25, 2015
06:51 AM
Dear Andrey
I have the same situation as you for my Relax kit and Dave3. The USB_DeviceGetState() bits are set correctly such as "active", "powered" and "connected" when I plug USB cable
in, but they don't reset when I unplug USB cable
Did you find any solution that you can share to detect disconnection when USB cable is unplugged.
thanks,
Rehan
I have the same situation as you for my Relax kit and Dave3. The USB_DeviceGetState() bits are set correctly such as "active", "powered" and "connected" when I plug USB cable
in, but they don't reset when I unplug USB cable
Did you find any solution that you can share to detect disconnection when USB cable is unplugged.
thanks,
Rehan
Not applicable
Nov 26, 2015
04:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 26, 2015
04:36 AM
Hello, maybe with new version your problem is solved. Could you try to update your dave3 to dave4.1.4. Did you used dave app or xmc lib? In both cases you should update to latest version too.