USB Host library current status, keyboard especially?

Status
Not open for further replies.

gwideman

Well-known member
I wonder if Paul or someone could update on the current status of the USB Host library for models of Teensy with second USB port.

1) The USB Host library is the one here, right?
https://github.com/PaulStoffregen/USBHost_t36

2) Does this work on the Teensy 3.5 as well as the 3.6? I ask because a message in USBHost_t36.h says "USBHost_t36 only works with Teensy 3.6.", similar to comment on https://www.pjrc.com/store/cable_usb_host_t36.html.

3) What is the best source of documentation?

4) What level of prime-time-readiness is the library at with respect to keyboard client? I read in earlier posts that it could be hit or miss which keyboards would communicate successfully, but perhaps that's been solved?

5) ... including handling intervening hubs (possibly built-in to fancy keyboard)?

6) ... also I see in keyboard.cpp a number of comments "TODO: queue events, perform callback from Task". Do I infer that there was an intent not to call user code from USB interrupt or something like that? How much of an obstacle is that apparently not being implemented yet?

7) I See the library's example folder has distinct examples for various client devices, but not keyboard (though basic keyboard OnPress handling is shown in example "Test".) Are there other keyboard examples somewhere?

Thanks! -- Graham
 
Only the T3.6 has the 2nd USB port. No USB host function is available on T3.5.

Concerning the other questions: Why not show some community spirit and just checkout by yourself to find answers. And, if needed, contribute fixes and new/extended functionalities?

BTW: the best documentation is still the source code itself. ;)
 
Only 3.6 has USB host. Absolutely will not work on 3.5 or lower.

The library works very well for keyboards and other HID stuff. A full HID parser is present, so HID support isn't just for "boot" devices. Hubs are fully supported. Most serial and MIDI also work, but some of the drivers do not yet support large buffers for some 480 Mbit/sec devices.

The only documentation at this time is the examples and info in USBHost_t36.h.
 
The best example for Keyboard (and most others) is the Mouse example. It should really be renamed as it has mouse, keyboard, joystick, rawhid, ...

State of the keyboard code: I believe the code works for most USB keyboards. If you find a keyboard that it does not work with, let us know.

Current exceptions include:
Bluetooth: I don't believe bluetooth code has been added to main library yet. I do/did have some working on my machine, but then started doing other stuff and don't think I ever issued Pull Request for any of this. At the time I did have one keyboard working. But was trying to decide on how to integrate in some of the pairing, trusting... code. Was also trying to get some Bluetooth joysticks working as well...

We may not support all of the keys on a keyboard. Hard to explain: A keyboard may be comprised of several parts.
a) keys associated with boot device: This is all of the standard keys, A-Z, a-z, 0-9, arrows, enter, Fn, ...
b) Many keyboards also have a HID device associated with it. The HID device might be it's own or might be part of something else. Example I believe Microsoft and Logitech wireless desktop units with Mouse and keyboard, that the HID device for Mouse is also for keyboard (Different Reports). With the HID parser we also can handle several other keys, like a lot of multimedia keys and the like.

c) However some keyboards have their own custom HID devices and/or reports: which on host devices often have a special device driver that handles these. Examples some boards have custom Power button, or ...

d) We do some standard outputs to the keyboards. In particular we try to update the leds associated with Caps lock, shift lock, num lock. Some keyboards have additional output reports, that on host machines are typically handled by that vendors device drivers. and like mentioned in c) We do not handle those.

Hope that helps
 
Paul and KurtE: Thanks tremendously for your fast and very informative answers (and of course for the work on Teensy and the libraries).

Regarding the keyboard nuances mentioned by KurtE -- thanks for elaborating, very useful.

Expanding slightly regarding 3.5 vs 3.6, for benefit of future readers: In many contexts, the T 3.5 can be thought of as a version of the 3.6 except it has 5V-tolerant I/Os, has a slower clock, and has a few other specs that are quantitatively lower performance but otherwise similar. Conforming to that expectation, the 3.5 PCB has a header position for the second USB port, and the schematic shows the second USB port, lulling me, at least, into an assumption that it was indeed present.

But previous answers on this thread set us straight -- no second port. The 3.5 header and schematic are accounted for by virtue of the same PCB being used for both 3.5 and 3.6. And poking into the MK64FX512 datasheet -- no second USB port (not that I doubted Paul and KurtE -- just looking for the basis of the difference in features.)
 
Yes - a lot of the differences show up on the main hardware page: https://www.pjrc.com/teensy/techspecs.html

@Paul/@Robin - you might want to update this page to show that the T3.5 actually also has 256K of memory :D
Also not sure why the title for this page (shows up in Firefox Tab) as Teensy LC(Low Cost)

It may not be obvious from this page but shows T3.6 has 2 USB ports and T3.5 has 1.

Also maybe not obvious from this page, but what is used as the 2nd USB port for the T3.6 on the T3.5 two of these pins are additional Analog only pins (A25 and A26),
Which you can see see on the on the T3.5 reference card back:
card8b_rev2.png


And as noted here, like other analog only pins, these pins are not 5v tolerant.
 
Only the T3.6 has the 2nd USB port. No USB host function is available on T3.5.
Thanks for that response.

Concerning the other questions: Why not show some community spirit
If you're going to say something antagonistic, you might want to consider whether your assumption is true. I see that you frequently contribute in a positive way, so I'll assume you were just having a cranky moment.

and just checkout by yourself to find answers.
... because doing something by yourself is the essence of community? Questions like "is the library at the stage where it's handling the the set of cases you're targeting" (such as a population of keyboards) are not something an individual can readily "checkout by yourself".

Further, collecting together a set of coherent questions pertaining to a popular use-case, including the opportunity to dispel misimpressions or outdated info from previous discussions or other docs, making it easy for Paul and others to respond, actually is a community-benefiting activity, witness the useful responses. It assists users to assess and adopt this function, and thereby amplifying the efforts of Paul and others.

And, if needed, contribute fixes and new/extended functionalities?
... actually I already answered that question here:
https://forum.pjrc.com/threads/46466-Teensy-3-6-USB-High-Speed-status?p=153731&viewfull=1#post153731

BTW: the best documentation is still the source code itself. ;)
Good to know whether it is or isn't.
 
Status
Not open for further replies.
Back
Top