- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am developing USB-capable self powered device. I need this device to work properly both with and without connection to USB host. What is correct way to initialize USB peripheral in this scenario?
Here is my current init code:
if(VBus_Read() == 1)
{
UsbUart_Start(0, UsbUart_5V_OPERATION);
while(!UsbUart_GetConfiguration());
UsbUart_CDC_Init();
}
Thanks in advance
Stanislav
- Labels:
-
PSOC5 LP MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In case of a USB powered device, it is important that the device reacts to some commands over USB within a short time, something between 50ms and 500ms after power-up. If the reaction takes too long, no connection can be established.
In case of a self-powered device, the device must also react to a USB connect quickly. If the reaction comes too late, the connection wil not be established. Make sure to check VBUS frequently enough.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello GuNo,
Sorry for late reply. I have been thinking of this. I have a function that is to be periodically called, and will process incoming data(btw is there any way to do this with ISR instead of pooling?). Here I can also check VBUS.
Then, which init functions are to be called on boot, and which on VBUS rising edge? Also, do I need to call some deinit on VBUS falling edge?
For my concerns about USB specs, now I see that when I connect USB, I will init it. If I don't, it is unimportant what is on data pins.
Stanislav