AnsweredAssumed Answered

Detecting a USB host with KSDK 2.x on K24

Question asked by Ryan Lush on Sep 25, 2018
Latest reply on Sep 27, 2018 by Daniel Chen

I have a bootloader running on a K24 based upon the KSDK virtual comm port example for the Freedom board. Most of the virtual comm stuff has been stripped out and its just 2 bulk endpoints. When the device is powered the bootloader waits 2 seconds to see if there is a USB host and if not it boots the application. Right now I determine I'm in the bootloader when I hit the kUSB_DeviceEventSetConfiguration event in the USB device callback. Basically once enumeration is complete. The trouble is with some computers the device does not enumerate without the driver installed. Then the app starts, complains about low voltage and shuts down. Not really the functionality I'm going for here. I need a way to detect a host without enumeration.


It looks like you get a kUSB_DeviceEventBusReset event when you enable the controller but I never see anymore unless it's plugged into my hub, so I'm also checking to see if I have more than 1 event. This seems to work but I'm making some assumptions about how it works.


Any other ideas are appreciated.