Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 11 months ago.
simultanous communication and power with usb kl25z??
Hello in a project I am using USBDevice library to have a virtual uart using USBSerial. The problem is that iIwant to have the possibility of communicating throught USB but nearly all the time the USB will be just a power connector.
If I compile with USBDevice support plugging "power only" makes the micro not booting. Perfectly boot when the cable is plugged to a Computer USB port.
If i remove the USBDevice support the micro boots with "power only" and also connected to a computer USB port, but I have lost the chance to communicate with it.
I am gueessing that some pull-up in the D lines is needed and not configured when I try the "power only" option but I do not know how to find that.
Any ideas
Question relating to:
1 Answer
9 years, 11 months ago.
The problem is that by default it will block until it is connected. One of the arguments in the constructor can change that to non-blocking. Then it will start fine in both situation (at least it should :P).
There is something like .isConnected() (check the API for what it is exactly) which will tell you if it is connected. The part however what might be a problem is how to handle disconnects and subsequent reconnects. If that isn't required for your application then you don't have to worry.