USB object?
I am NOT good with assembly, and I want to create a USB object. I'm guessing this cannot be done in SPIN, so 1) can it be done, and 2) how can it be done.
I'm lazy...
(snore)
I'm lazy...
![redface.gif](http://forums.parallax.com/images/smilies/redface.gif)
Comments
How about a "core" example file of a HID class slave object?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Here are some references though:
<http://www.edn.com/article/CA243218.html>
<http://www.usb.org/developers/devclass_docs/HID1_11.pdf>
<http://www.usb.org/developers/devclass_docs/Hut1_12.pdf>
<http://www.usb.org/developers/docs/usbspec.zip>
Also look in the Circuit Cellar archives. They had a series of articles several years ago on making your own USB devices.
I have pumped many, many hours into this. From times before the propeller on my bs2, and I can honestly say the following:
A USB master does not need to know about all devices that you can attach to it, only the ones you do attach to it.
#1: if you plan on only ever hooking a mass storage device, then you only need that aspect of a driver.
#2: All you really need to know is :
......A: The actual cmd protocall needed to access the default endpoint
......B: The method of reading the device(s) power requirements and then setting it.
......C: (Only if more then one is connected) -> Change the default address (which is zero) to something un used.
......D: Access and store the prefered endpoint.
......E: What to do with the data when it arrives
THis link to a forum discussion holds lots of links needed to make it work: http://forums.parallax.com/forums/default.aspx?f=25&m=127446
I was working on a USB Master for mass storage devices. My propeller programming skills are still womewhat weak, but they are improving.
Next, because of the power switching and enumeration (step B & C) and understanding the data returned in step D, I was going to move to a chip implimentation.
This is very simular to the product USBWIZ, and it's abilities. The advantage of the $59 USD USBWIZ is that is comes complete with 12/16 & 32 FAT on chip!
(Meaning you don't have to code a file system). For now, until my skills improve (and I know many users here have skills way better then mine), I am placing the project on hold. Never the less, just understand it like it is:USB is popular because the master can load a driver and access any kind of device without any special hardware.
If you know the devices you project is going to use, you don't need vast code to support things your not going to use.
Within the links I supplied on USB above is the command struct, timing and actual C code implimenting a usb master.
Yes, the propeller can be a USB Master, I'm 100% sure of it, and I'm not the only one who knows this.
BUT: It's not going to be like a PC with USB host and lots of different things you can attach, and, it will consume resources.
Sorry if this sounds like I'm preaching, grumpie or just a binge, I'm really not.
Before you blow off creating a USB Master, think about it, breaking down into it's smallest parts and building it up from there.
A USB Master is some hardware and lots of code following a very percise protocall. that's it; nothing else.
There are chips that will tend to all of the nitty gritty, including the sending / recieving of the data, the checksums, error protocalls, and even the power switching, leaving only the implimentation of the commands and the end device needing to be coded.
The only reason it needs to be coded in assembly is to achieve the top end speeds of USB 2.0. If speed isn't the issue, and the device(s) you plan on using are either mass storage or HID, low speed USB 1.0 is fine, and the propeller can maintain that speed with no problems. This assumes you use hardware to impliment the usb spec.
Thank you for reading...
This post is not ment to come off in a negitive way, against anyone or anything. This post summerizes what I have learned from reading, what I know from doing, and its a small attempt at opening the eyes of others at a different way of looking at things, something the propeller must force you to do as well.
My sorries to anyone how may be offended, again, it's not intented.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Just tossing my two bits worth into the bit bucket
KK
·
Very true. I was refering to using one of the dedicated chips, it handles all of the data xfers, it delivers and takes data in parallel.
But, in all, your most likely very correct about needing assembly; I'll sum up my propeller assembly skills here: "" [noparse]:)[/noparse]
Once I get some more propeller programming exp, I"m going to hop back onto this project again.
And you are 100% on it about a slave being much easier to impliment then a master... way much easier.
The mass storage drivers simply tie into the file system drivers, ie the data gets piped through that type of driver, which is why most systems don't need a driver for the mass storage and hid devices. My idea was to create a usb master object just for mass storage, for like the thumb drives and stuff. Again, I'm in a holding pattern.
THanks..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Just tossing my two bits worth into the bit bucket
KK
·
Oliver