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

0 Members and 1 Guest are viewing this topic.

Offline robotwizard

  • Contributor
  • 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!
 

Online blueskull

  • Supporter
  • ****
  • Posts: 8312
  • Country: cn
  • Power Electronics PhD Candidate
A USB device may only draw up to 100mA before enumeration, but in reality there's nothing that limit this. That's why you see there are so many USB fans or lamps or whatever that draws 500mA or even more and they don't have USB communication at all.

This is not standard compliant, but for most of the time it's not a big deal either.
SIGSEGV is inevitable if you try to talk more than you know. If I say gibberish, keep in mind that my license plate is SIGSEGV.
 
The following users thanked this post: robotwizard

Offline cstratton

  • Contributor
  • Posts: 22
  • 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

  • Frequent Contributor
  • **
  • Posts: 436
  • Country: aq
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.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 3937
  • 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: 289
  • Country: ru
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

  • Frequent Contributor
  • **
  • Posts: 850
  • 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

  • Regular Contributor
  • *
  • Posts: 82
  • 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 robotwizard

  • Contributor
  • 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf