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.
10 years ago.
USBSerial blocking when Powered by a external USB Power Supply
I am working on a kind of datalogger, based on the KL25Z plattform. The device uses USBserial to access data and to communicate. It works like charm as long as USB is connected to a PC. However, USBSerial blocks the code execution as soon no PC connection is present and its powered only (USB Powersupply or Battery). VBUS detection won't work here. I have seen others with the same problem, but nobody seems to have any solution. ? Thanks a lot in advance for your help!
2 Answers
9 years ago.
Hi,
I used the connect_blocking argument and a watchdog for blocking when closing the serial terminal
Take a look to this example: https://developer.mbed.org/users/Manel_Marin/code/KL25Z_WATCHDOG_USBSERIAL/
9 years, 9 months ago.
Have you solved this problem?
Looking at USBSerial.h, it has a connect blocking argument
https://github.com/mbedmicro/mbed/blob/master/libraries/USBDevice/USBSerial/USBSerial.h
-
Edit: initializing USBSerial in non blocking mode looks like this:
USBSerial usb_serial(0x1f00, 0x2012, 0x0001, false);
The first 3 values are the default values of the USBSerial constructor.