Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Usb host (computer)to usb host(teensy)

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    19

    Usb host (computer)to usb host(teensy)

    I was wondering how can one connect a computer to the teensy.
    For usb communication i mean.
    Not for serial, or is that just the wsy to do it right.
    I mean the computer is a host and has host input( put in a usb cable) but teensy will be the host too.
    That can not be good, there is one host. Can one just make a cable and connect it to the computer usb-in port and connect it to the usb host port on the teensy.
    Thanks, Dian

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    1,979
    what exactly do you want to do so we can determine if its possible or no. what do you want to control?

  3. #3
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,099
    All Teensies have USB device connections (this is how you program them) so that is how they connect to a USB Host like a computer.

    Teensy 3.6 (and Teensies using a USB Host shield) also have a second, USB host, connection. You would plug a USB device into that (like a mouse, a computer keyboard, a MIDI controller, etc).

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,421
    Like @tonton81, not sure what you are asking? If you connect a computer to the Teensy, the teensy shows up as a device to the computer, that is the Computer is the Host.

    You have control on how the Teensy shows up to the computer. By default it simply creates a Serial port. On Windows a COMn device on Linux a /dev/ttyACMn device.

    But you can also configure the teensy to show up as a Keyboard, or a mouse, or a Joystick, or ... And a combination of many of these.

    The Teensy 3.6 has a second USB port that can be configured to be a USB Host or as a USB Device. So far I don't know of any code to configure it as a Device, but we now have some code that can configure it into USB Host mode and allow it to talk to a limited set of other USB devices (Mouse, Keyboard, Joystick, Midi, USB to Serial Adapter). This support will continue to grow for other types of USB devices.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,009
    I do not understand your question. Seems you also asked on this thread, with even more confusing questions!

    Nobody can give a useful answer without understanding. The problem is, your questions have almost no coherent info about your project, about what you're actually trying to accomplish. Without context to understand your goals, to know what you're really trying to make your project actually do, these questions can't be answered well.

    Of course, I or others could write lengthy messages about how USB works. But you can get that sort of background from the USB 2.0 spec, chapter 4. Here is the main PDF, to save you some time finding it at usb.org.

    https://www.pjrc.com/teensy/beta/usb20.pdf

    If you just want someone to explain how USB works and give you generic USB info, read that PDF.

    If you want useful, relevant answers regarding your project, you need to do much better at clearly explaining what your project is really about. We are real people, and humans can only give useful answers when they understand the context behind the questions!

  6. #6
    Junior Member
    Join Date
    Dec 2017
    Posts
    19
    Usb host (computer)to usb host(teensy) like i stated in the first line, host to host, so teensy is the host usb device talking to usb devices, and then(also) talking to the computer. How can one connect them. I want to sent midi from one to another over usb.
    And paul's right, i am helping somebody with a project, read that if nesecery, it maybe clearifies some things.
    Thanks, Dian

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,009
    Teensy 3.6 has two USB ports.

    The Micro-B connector is a USB device port, which can connect to a USB host using this Micro-B cable.

    The 2nd USB port is 5 pads on the circuit board. They are meant to be used with a header (DIY soldering required) and this USB host cable.

    Both cables can be connected at the same time. However, if you do this, be aware the Teensy 3.6 and the whatever devices you plug into the host cable will be powered by the Micro-B cable. Normally this works fine, but if you have power hungry devices, it's possible to draw too much power or have other power-related issues when you hot-plug the USB devices.

    Software-wise, both can work, if you craft your program to respond to both.

    The main (Micro-B) USB port is configured by the setting in Tools > USB Type.

    The 2nd USB port (host) is used with the USBHost_t36 library. The types of USB devices it supports depends on the list of object instances you put into your code. See that library's examples for details.

    Both USB ports work independently and simultaneously. Data never automatically moves between them. If you want to "connect" something from one to the other, perhaps have the USB serial or USB MIDI which appears to your PC "connect" to a similar USB device plugged into the Teensy 3.6 host port, you would need to add code in loop() which responds to incoming messages from one or both sides and transmits whatever messages are appropriate to the other side.

    How exactly you would do this depends on what you're trying to actually accomplish, which _still_ isn't clear, despite the many messages you've recently posted.

    I really can't write any more to help, without a more specific question. But I would like to ask you to, please, refrain from reposting similar questions as many different threads on this forum. Please, help us to help you in the most time-efficient manner possible by keeping the number of threads to a minimum, and please please please try to be more specific about what you're really doing. We can help you better if we actually understand.

  8. #8
    Junior Member
    Join Date
    Dec 2017
    Posts
    19
    Hello everybody reading this interesting post, First i have to say sorry for the (unintended) double post, and thanks for the reply's and advice and great support.
    I was enthausiastic about glennzone's project and this question was important to myself, i was helping myself to find the answer and dicided to begin a new tread about the usb host thing.
    Anyway it now is beginning to look like a riddle, and.........i know the answer allready to my own question.
    I will put the answer in the Glennzone project posts, and will continue over there https://forum.pjrc.com/threads/46952...l=1#post161129
    Greatings Dian fom the Netherlands
    And ps Paul or moderator you may close this Thread
    Last edited by arpeggio55; 12-06-2017 at 11:22 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •