Shop OBEX P1 Docs P2 Docs Learn Events
BS2 and USB... Who is the master? — Parallax Forums

BS2 and USB... Who is the master?

Kaos KiddKaos Kidd Posts: 614
edited 2006-02-14 13:13 in BASIC Stamp
··There are some really nifty USB items out there, of quality and not expensive, called Phidgets.· They all use a USB interface.· I called to ask about the device to device protocall, citing I wanted to use a BS2 to be the host.· Well, they avoided the whole issue about the device to device protocall by saying "The basic stamp is a slave, as well as all the Phidgets.· Therefore you can't connect the two."

· I have a problem believing this, because we (stamp users) have direct access to the USB chip, therefore the ability to create a "Host".· Next, it's hard to believe this, but it's the first time I ever heard the issue of "master/slave" in the USB connection / Communication layout.

· How much truth is there to this, the Master / Slave issue metioned?·
· If this is the truth, can in fact the BS be made a "Master" or "Host"

· I precieve the USB to be nothing more then a serial communication with a common protocall.· This being the case, then the USB devices mearly "listen" on the bus for their identifer and respond.· USB is a method of inter-device communications, a protocall, not the method of software to software (host to device) communications.· To Clairfy my example:· If UDP is the language used to communicate the conversation, and the datagram is the conversation then:· USB is the language, and the conversation is the data.· Is this right?

· At this point, I am seriously considering getting one of the Phidgets and trying to "hack" out the communications just to prove the issue.· At the expense of some $40.00 USD.

Searching for the truth...Answers anyone?
Thanks !


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Just tossing my two bits worth into the bit bucket
KK
·

Comments

  • Tom WalkerTom Walker Posts: 509
    edited 2006-02-10 14:33
    There is more to USB than you realize (and FAR more than can be discussed here). The Stamp cannot be the host because of the complexity of identification, enumeration, and all of the other things that require horsepower and much more dataspace than the Stamp possesses.

    If you don't believe me, check out the USB spec or spend your Phidget money on Jan Axelson's book "USB complete".

    For what it's worth, no Stamp "speaks USB".· They only speak serial to a USB chip which handles all of the low-level stuff.

    HTH





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Truly Understand the Fundamentals and the Path will be so much easier...
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-10 14:35
    USB slave and USB master are very different things, USB is more like ethernet than it is RS-232 (it is on whole even more complicated than ethernet), theres alot more formal requirements, defined protocol layers and what not. USB masters must preside over the bus, discovering hot-plugged slaves and a host of other features. The USB protocol is not for the faint of heart (I have trouble understanding all facets of it, and I consider myself to be an electronics guru), on top of that USB mastering is another layer of complications added in. All that said, GHI Electronics is now offering an interface module for USB hosting. It has simplified things considerably, but I have read the documentation on the device and it is still somewhat hard to comprehend all aspects of it. I have not tried the module, so I cannot vouch for how well it works, or how easily it is used.

    Im probably going to take Tom's advice myself and get the USB complete book. I would like to understand USB more fully as well.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 2/10/2006 2:41:03 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-10 14:39
    KK, how you "percieve" the world, and how the world actually is, can be dramatically different. If you then go on your "perception", without attempting to correct it or research it, the actuallity of what you are doing will defeat you. Just try not to spend too much money in the process, OK?

    This is triggered by your statement "I precieve the USB to be nothing more then a serial communication with a common protocall" -- because your perception is dramatically WRONG in this case.

    RS-232 serial-based communications do not necessarily have a "master-slave" relationship. If one device is 'listening' when the other device 'sends', communication can occur.

    USB-based device DO have a 'master-slave' relationship. The 'master' queries the bus, the 'slave' responds with it's device code. The 'master' then goes into a large registry of its known USB devices, to find the driver for this particular 'slave'. It then loads that driver, and then uses that driver to communicate with the 'slave'.

    It takes a reasonable amount of hard-disk space to store that registry, and the drivers. This is what some programmers call "non-trivial". It is really, honest-to-God, beyond the capabilities of a device with 2000 bytes of program storage space, and 32 bytes of ram to be a USB master. It just is.

    Now, being a USB 'slave' device is relatively simple -- the FTDI company has created an affordable chip to implement that side, along with the appropriate drivers for the PC side. But that device STILL will not allow you to connect two USB slave devices together so they can communicate with each other -- unless you have a USB 'master' device relaying the data.

    Now, I expect you're going to do whatever you want, anyway, so let me just summarize:

    1. At the present time, there is no interface chip (that I know about, anyway) that would let a BS2 be a USB 'master'.

    2. A BS2 by itself cannot be a USB master.

    3. It sounds like an interesting project to hack a "phidget"

    4. Two USB 'slaves' CANNOT talk to each other without a 'master' in the middle.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-10 14:44
    KaosKidd -

    Believe every bit of what you were told. If you have any doubts at all, I suggest you read the entire USB specifications from cover to cover, which is the best way to learn about it. Second to that, or along with it, would be Jan Axlerod's book "USB Complete", now in its Third Edition. The entire USB 2.0 Specifications can be downloaded from the link below, for free, but make sure you bring lunch! :
    http://www.usb.org/developers/docs/

    The single biggest problem with using any device as a USB HOST, is that the HOST must be able to load and execute the appropriate device drivers on-the-fly. Unlike other serial protocals, there is NO device independence WITHOUT these device drivers, therein the problem.

    Save your $40.00 on the "Phigets", and use it as a down payment on Jan's excellent USB book. Like air brakes on a jackass, trying to use any Stamp as a USB HOST is just not going to happen in this lifetime. Sorry!

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-10 14:47
    allanlane5 said...
    1. At the present time, there is no interface chip (that I know about, anyway) that would let a BS2 be a USB 'master'.
    Allan, check out this product: http://www.ghielectronics.com/USBwiz.htm·I am still a little intimidated about using it after reading the docs, but it may be child's play to use for someone with more knowledge of USB.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • mike_smike_s Posts: 42
    edited 2006-02-10 20:24
    If you would like to reduce the amount of reading you need to do. This link indicates which of the 650 pages in the usb spec are necesary reading. As with every document there are parts you can skip

    http://www.beyondlogic.org/usbnutshell/usb1.htm
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-02-13 17:28
    · Well... I had a major lesson here, one in USB and one in...(I’ll cover that at the end of this post)…
    Thanks every one on the ‘warnings’ and information, it’s all taken to heart.· After I posted the question, I did read parts of the USB 2.0 spec.· I also did other research on the matters.· My current “Perception”: There are far better then I whom can make since of it all.· However, I am going to order the USBWiz, and continue to move forward.· I’m not looking to create what a PC host can do, only communicate to a single family of devices.· I do believe it’s a complicated subject, but, if you look at what you’re trying to do, remove things you don’t need, it does get somewhat simpler.· For example, I won’t have to load drivers, or support hot swappable devices.· Only provide for data exchange with a limited family / class of products.· Thanks again everyone, for all the information.
    allanlane5 said...
    KK, how you "percieve" the world, and how the world actually is, can be dramatically different. If you then go on your "perception", without attempting to correct it or research it, the actuallity of what you are doing will defeat you. Just try not to spend too much money in the process, OK?

    This is triggered by your statement "I precieve the USB to be nothing more then a serial communication with a common protocall" -- because your perception is dramatically WRONG in this case.


    [noparse][[/noparse]remainder of post removed for clarity-> KK]

    allanlane5:·
    · I find your reply irritating, and inflammatory, and now you (and sadly, everyone else) will get to read why:· I explained, very clearly what it was I was trying to do.· I further explained how I thought things worked.· Finally I ask the question, “Is this right?”· I was very clear and concise in the wording I used, “I perceive”; it was designed to let the reader know it’s how I thought things were, not a statement of fact, as you yourself pointed out.· The tone of the first two paragraphs of your reply is counterproductive to the meaning and usage of the forums.· Yes, I may have been wrong, but I posted a question to better educate myself in the matter at hand.· Please demonstrate some compassion when dealing with those who know less then you.· I will·say this to you because I did single you out in this reply:· Thank you for the time it took you to write your reply.· There was some good information, although repeated in other posts, contained within it.· I have entertained the idea of hacking several of their devices.· I am in communications with their director of research and development, and we are going to see if I can get the actual command format needed to talk to some of their devices.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Just tossing my two bits worth into the bit bucket
    KK
    ·
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-13 17:56
    Fair enough. I think my 'snarky' attitude was triggered by the phrase "nothing but" in there. Half of your query seemed to be honestly seeking for feedback, the other half seemed (to me) to be expressing happiness in ignorance.

    I sincerely apologize for 'going off' that way. I am very happy that you do seem to be following a responsible path, and I do wish you luck with it.
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-02-13 18:24
    Thanks Allanlane5...
    I apologize if I wasn't clear enough in my request. This too shall improve.
    I am looking, always looking for feedback... good or bad...

    KK

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Just tossing my two bits worth into the bit bucket
    KK
    ·
  • kelvin jameskelvin james Posts: 531
    edited 2006-02-14 06:49
    I found the idea of the Usbwiz to be kinda interesting, so with my very limited knowledge, i took a good read through the manual to see what it is all about. Also took a look at the forum just to see what problems people have faced. From what the specs say, it can be a usb interface from a micro to a usb device. The uart mode is recommended for serial communication with a micro as the easiest, and is a bi-directional communication. So, i would assume that would fall into the master / slave configuration? The oem board looks pretty good, and not overly expensive, might make a nice toy to play around with. Lots of applications to experiment with. A look at the Usbwiz chip itself is way beyond my comprehension.

    kelvin
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-02-14 13:13
    Its been a couple months since I looked at the docs for USBWiz, but if the UART is simulataneous bi-directional, the Stamp would be incompatible with that configuration, likewize if the SPI interface was simultaneous bidirectional the Stamp could not handle it. By definition the Stamp would be compatible with the I2C interface. Perhaps thats why they included all 3 types of interface, provide the speed and power to µCs that can handle it, and other interfaces for µCs if they can't.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
Sign In or Register to comment.