[ARM] Does a USB device need a driver on the Host Microcontroller to get power? - Page 1
Forum section: electronics / general

author: robotwizard
author_rank: Newbie
timestamp: January 14, 2018, 08:24:30 am
content: I tried posting this question in beginners but did not get a reply that solved my issue. Please see if you can help me.I've recently transitioned from arduinoes to ARM devices. I'm trying to make a maze solving robot - 'micromouse' and I'm trying to use an optical mouse's sensors to track the movement of the robot on the maze floor.So I got this free NXP development board from Hackster - a FRDM-K82F board; This Board has USB support. So I saw the USB demo drivers and they're fairly complicated and add to that my puny knowledge of the USB stack - So I decided I would setup the hardware first; so I'm making a prototype and I connected two optical mice to a USB hub and tried connecting it to the USB port on the microcontroller via a cheap micro USB cable. Before powering the microcontroller up, I read in the documentation that there is a jumper in the FRDM-K82F that is supposed to be 'jumped' to give power to the USB port and allow the board to act as a USB hub. I connected the jumper properly.Now to check if the hardware is working properly, I connected the optical mouse + hub setup to my laptop computer and the laptop is reading both the mice. But when I connect the hub to the microcontroller and power the microcontroller, The light on the USB hub doesn't light up; neither does the light on the optical mouse.So this is my noob question - Does a USB host need to be running driver code for it to supply power to the devices? Or could there be something else wrong with my setup. Will I have to write the driver code before plugging in the optical mouse setup?Also it would be nice if someone could direct me to a nice tutorial other than the documentation on setting up USB devices on NXP or ARM cortex M4 devices.This is the link for the Development Board I have.https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/kinetis-cortex-m-mcus/k-seriesperformancem4/k8x-secure/freedom-development-platform-for-kinetis-k82-k81-and-k80-mcus:FRDM-K82F?&&tab=In-Depth_TabI've also attached the Datasheet for the Board.Please tell me if you need more information. Thanks for your time!

author: cstratton
author_rank: Regular Contributor
timestamp: January 14, 2018, 08:58:56 am
content: What's mostly relevant here is that you have a development board that is likely at most a "part time" USB host.In other words, the VBus supply won't be permanently hard wired (perhaps through some sort or resettable fuse) as it often is on host-only systems.You'll need to study the documentation or schematics of the board and figure out what is required to supply VBus. It might be a software-controlled electric switch, or a jumper - or possibly you'll have to actually modify the board... I think I remember adding a small to the KL25Z Freedom in order to be able to use it as a host.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: January 14, 2018, 10:05:58 am
content: Quote from: GeorgeOfTheJungle on January 12, 2018, 06:45:00 pmQuote from: GeorgeOfTheJungle on January 12, 2018, 06:48:04 pm

author: Howardlong
author_rank: Super Contributor
timestamp: January 14, 2018, 10:22:19 am
content: That board looks like it's an OTG port, as well as the hardware changes you will need to have a host stack of some sort. It is also recommended that you start without a hub, interfacing a single device: the hub is an extra layer of complication, and it may be that the host stack has limited features in this regard.If you can find a simple host stack demo to work to start with that would be useful, perhaps there's a keyboard HID demo for example?

author: abyrvalg
author_rank: Frequent Contributor
timestamp: January 14, 2018, 10:40:01 am
content: Doing just SetAddress and SetConfiguration (to set device to CONFIGURED state) should be enough to turn it on. The rest of classic enumeration process like getting/parsing descriptors is not relevant.

author: andersm
author_rank: Super Contributor
timestamp: January 14, 2018, 11:58:22 am
content: If you connect the hub and mouse directly to a power supply (eg. cell phone charger), do the lights light up? If they don't, then the devices need to be configured in some way by the host.

author: SiliconWizard
author_rank: Super Contributor
timestamp: January 14, 2018, 08:18:54 pm
content: Have you followed page 10 of the User's guide?First thing to check would be to see if you have 5V on the VBUS pin of the USB connector (P5V0_USB_CONN_VBUS).If not, you have to properly configure the onboard jumpers first.If you have 5V, then the reason would be that the device (here, a hub) just doesn't show some kind of "on" status (led) nor provides power to its slave ports until it has been enumerated. It's actually good practice.

author: robotwizard
author_rank: Newbie
timestamp: January 17, 2018, 06:44:33 pm
content: thank you all for your responses. Without a mentor, I've been lost. This is such a helpful community. I will try all the solutions you have suggested and let you know what works.Quote from: Howardlong on January 14, 2018, 10:22:19 amgreat practical advice. I will try this first.Once again, thanks for all the suggestions you guys.

author: mac.6
author_rank: Regular Contributor
timestamp: January 25, 2018, 08:47:39 pm
content: Why don't you use the opensda usb port for power?When using K82 usb, you can't use the debugger.

author: MosherIV
author_rank: Super Contributor
timestamp: January 26, 2018, 07:37:36 pm
content: HiThe hub has definetly added a layer of complication that you do not need as a starter.The Hub is a usb device itself. The hub itself must first be interogated and enumerated.When a device is attached to the hub, the hub will signal the host that a device has been attached to hub port X, I forget the exact sequence but it is then upto the host to tell the hub to enable power to port x. The host is then responsible for interigating the new device for enumeration.Your microcontroller usb host driver must support hubs as a device as well as the device itself.Mice is a Human Interface Device (HID) in usb world.Both hubs and hids are standard usb devices. Hopefully your usb host drivers will have support for them.Hope this answers your querry and helps.