- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am sitting on a project based on the AN82072 USB General Data Transfer with Standard HID Drivers.
I would like to realize that I have a decision wether USB is connected or not and run different code respectively.
So I would like to detect USB connection in software.
If USB cable is connected to the host, it should display data in my host application, as it is realized in the AN now.
If no USB connection is present, I would like to record data to an SD card.
I have read that I can do this with detecting the BUS Voltage on the USB Component. I probably will realize it that way, but for now I am still sitting with the demo board and it would be convenient to have that in software.
Anyone can help here?
Solved! Go to Solution.
- Labels:
-
PSoC 5 Device Programming
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is what I did - I thought I got this from an example PSoC project...
if (USBFS_GetConfiguration()) // Only process USB stuff if it is connected.
{
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is what I did - I thought I got this from an example PSoC project...
if (USBFS_GetConfiguration()) // Only process USB stuff if it is connected.
{
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I needet a small delay before GetConfiguration.
I have done it now like this:
USBFS_Start(0, USBFS_DWR_VDDD_OPERATION);
//while(USBFS_bGetConfiguration() == 0x00)
// {
// }
/* Check for USB connection */
CyDelay(1000);
if(USBFS_bGetConfiguration() == 0) /* If USB connection is present run this */
{
for(;;)
{
}
}
else /* If USB is not connected, run this */
{
}
BTW: Anyone know what is the small letter "b" in the functions for the USB component?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you are using latest USB component in creator4.2, you can use "USBFS_GetConfiguration()" instead of "USBFS_bGetConfiguration()"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, anks. Will keep that in mind.
I am using at the moment still 3.3.