On the FRDM-KL25Z Board the target processor supports both USB host and device mode. However, the Freedom board has no jumper or other means to power the USB bus (which is required in the USB host mode). So if I want to get access to a memory stick from the KL25Z, then I’m stuck because the board does not offer that option. Luckily there is an easy hack to work around this.
Looking at the FRDM-KL25Z board schematics, there is 5V available on Pin 10 of J9:
The idea is to power the USB bus with 5V DC from the board itself. Normally I would use an ADML869L or similar device to have stable voltage and over-current protection. But attaching a memory stick or similar should be safe and would be protected through the other circuits and through the protection on my host.
So all what I need is to connect the power supply line on the USB host side of the cable. I cut the cable to prevent the current to flow back, just in case.
Usually in a USB cable the red wire is the VBUS/5V one, which connects to pin 1 of the USB plug. Cutting that cable and connected it with a probe tip:
That probe tip then connects to pin 10 on J9:
With this I can power devices on the USB bus, and I was able to enumerate a USB memory stick in USB MSD host mode on the KL25Z:
Happy Hosting 🙂
This is great Idea.
Be a little careful there. That 5V source comes through a BAT54C Schottky diode, which has a 200mA max continuous rating.
Hi Bill, yes, I have measured my memory stick, and it used less then 100 mA. But of course this could be different for any other device.
Accidentally burned Schottky diode, shame that I read the warning later, luckily I got a similar diode on the PCB of a RC car and my board works perfectly. As a recommendation if you supply a device that draws more than 200mA use output P5-9V_IN.
Yes, I have been very careful (and lucky) so far. P5-9V_IN is a good tip: I use that already with my Arduino Motor Shield (https://mcuoneclipse.com/2012/12/14/frdm-kl25z-with-the-arduino-motor-shield/). Unfortunately still the 5V from USB is needed.
Thanks for the feedback. Latest (and current) revisions of Freescale Freedom Platform changed those BAT54C diodes to 1A Schottky diodes, like MBR120VLSFT1G.
Thanks for precaution and to aware before we damage anything.
That applies to current used by that node on any shields as well.
I’m surprised they have not added Polyfuses to the various supplies on that board. That aspect (power distribution) is not well thought out IMHO.
I will be very interested in a tutorial in using the KL25 in host mode.
I mean how to read/write to devices like Memory sticks(MSD), USB Keyboard, Mouse (HID) etc, which .are the most common requirements
This presents such exciting possibilities …. unfortunately, I do not know where to start, and I don’t want to read the entire USB 2.0 specs handbook to implement this :-).
There are no examples at all for the KL25. in host mode (MSD & HID modes)
Would you kindly do a tutorial (using processor expert, preferably) on how to use these devices with the FRDM board, or at the least point me to some starting point for the same ?
Hi Royce, yes, I started with the MSD host mode for the Freedom board, but got stuck and had to work on something else. This one is definitely on my bucket list. As for pointers: I believe the Freescale USB stack (www.freescale.com/usb) comes with some host examples too for the KL25Z.
in case you have not seen it: I just published an article about USB HID Keyboard device support for the FRDM-KL25Z: https://mcuoneclipse.com/2013/06/30/using-the-frdm-kl25z-as-usb-keyboard/
I really want to move on from ‘Blinking an LED’ type projects to more serious, real world applications. (of course, the LED/Hello World projects are excellent starting points).
Something that uses all the resources meaningfully … like read a couple of temperatures from the ADC inputs, display the same on an LCD, log the same with time-stamp to a memory stick, accept settings from a USB keyboard, control a couple of relays….. etc.
Iv’e already done this (except USB) on 8 bit AVR MPUs…. just need to become good with the KL25Z (mainly understand the architecture/registers & the APIs involved) 🙂
Yes, agreed. But as I’m doing these kind of things in my free time, I only can do what I can do :-).
Oh I agree, and understand … you are doing a great service to the FRDM-K25Z user community. Hats off to you!
Freescale should give you a substantial raise, and put you on this free time work ,full time officially! You are doing a much better job at familiarising users with their new board.
Many users jumped at the FRDM board because of low cost, excellent peripherals, and better CPU, but now (official) documentation / examples are poor.
I hope this will change in the days to come !
I’m really new with FRDM-KL25Z. (approx. 1 day) And was looking for some example code for using the device as a HID keyboard (I’d read some data and “type it in” for easy and fairly compatible use – much like a barcode reader does.) when I found this post.
While reading your post I wonder why aren’t you using two Y cables and a female-female connector. That would make better use, i guess. (Of course a USB HUB is the easiest way in my reading, but it involves a spare power source, lowers speed etc….)
Then you could use the same power source that powers your device thru the OpenSDA Port.
My layout would be:
plugging the USB drive in a Y cable (i found this example: http://www.goldcomp.hu/components/com_virtuemart/shop_image/product/93353.jpg)
Plugging one Y cable in the OpenSDA port (e.g.: http://www.goldcomp.hu/components/com_virtuemart/shop_image/product/93587.jpg)
And connecting the two spare power ports with a female-female adapter (e.g.: http://www.amazon.com/USB-Type-Female-Adapter/dp/B000GHXTA0)
No cable ruining/cutting, and if you are changing to a power source from the OpenSDA connection you can still use the same Y cable with a double USB psu (or then for the production environment you can make a fixed USB plug with the “red wire” fixed to the PSU)
Yes, you could do it that way. All what you need is a way to provide 5V to the KL25Z USB Vdd pin. I did not had such adapters available, so cutting an existing cable is a low-cost and fast solution in any case.
As to use the FRDM as HID keyboard device (not host!), you even do not need such a power cable construct: here the PC/host is poviding power, so you can simply plug in the FRDM board as-is to your computer.
Pingback: USB MSD Host for the Freedom Board | MCU on Eclipse
Pingback: A new Freedom Board: FRDM-K20D50M with ARM Cortex M4 | MCU on Eclipse
Pingback: FRDM-KL25Z RevE Board arrived | MCU on Eclipse
Pingback: USB MSD Host for the FRDM-K20D50M Board | MCU on Eclipse
In the schematics of the FRDM-K25L i found that there are a jumper J21 and R82 to be populated in order to enable USB host functionality on board… Isn’t this a more comfortable solution?
yes, later Revs of the boards have that, but not that RevC available at that time.
Pingback: Bluetooth Stack on FRDM-KL25Z Kit - Demo | Embien Technology BlogEmbien Technology Blog