Author Topic: [ARM] Does a USB device need a driver on the Host Microcontroller to get power?  (Read 2133 times)

0 Members and 1 Guest are viewing this topic.

Offline robotwizardTopic starter

  • Newbie
  • Posts: 8
  • Country: in
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_Tab

I've also attached the Datasheet for the Board.

Please tell me if you need more information. Thanks for your time!
 

Offline cstratton

  • Regular Contributor
  • *
  • Posts: 62
  • Country: us
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.
 
The following users thanked this post: robotwizard

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
As far as I know a USB 1 or 2 (and 3 too?) host should provide up to 500 mA @5v even when/if there's nothing connected to the data+ and data- pins.

OTOH, it may well be that your mouse won't lit its led until after it has negotiated properly with the host, you know, the enumeration phase and all that jazz.
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5319
  • Country: gb
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?
 
The following users thanked this post: robotwizard

Offline abyrvalg

  • Frequent Contributor
  • **
  • Posts: 824
  • Country: es
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.
 
The following users thanked this post: robotwizard

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
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.
 
The following users thanked this post: robotwizard

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14464
  • Country: fr
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.
 
The following users thanked this post: robotwizard

Offline robotwizardTopic starter

  • Newbie
  • Posts: 8
  • Country: in
 :D 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.

...It is also recommended that you start without a hub, interfacing a single device: the hub is an extra layer of complication,...
great practical advice. I will try this first.

Once again, thanks for all the suggestions you guys.
 

Offline mac.6

  • Regular Contributor
  • *
  • Posts: 225
  • Country: fr
Why don't you use the opensda usb port for power?
When using K82 usb, you can't use the debugger.
 

Offline MosherIV

  • Super Contributor
  • ***
  • Posts: 1530
  • Country: gb
Hi

The 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.
« Last Edit: January 26, 2018, 07:40:19 pm by MosherIV »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf