9 years, 3 months ago.

USBSerial stop working after first connection


I've been playing with USBSerial along with raw Serial thru UART, all in the RTOS context. I'm instantiating the USBSerial with connect_blocking=false so that all code is working if I dont attach picocom to /dev/ttyACM0 at startup. The code is outputing prints thru both UART and USB while flashing leds in the mainloop. At the first connection to /dev/ttyACM0, everything is working, both UART and USB, but as soon as I quit picocom and try to comeback to /dev/ttyACM0, nothing is outputted anymore. Also, if I don't connect to /dev/ttyACM0 right at the beginning, it will block at the first usb.printf() although I've mentionned connect_blocking=false. Is there a way to make USBSerial really Non-Blocking ?

Question relating to:

1 Answer

8 years, 6 months ago.

I found same problem.

My walkarround has been to enable the watchdog, a "selfreset" when blocking is perfect for me. It was quite hard to enable watchdog in my KL25Z.

I know that is not your board but you can take a look to this anyway: https://developer.mbed.org/users/Manel_Marin/code/KL25Z_WATCHDOG_USBSERIAL/