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

Thread: USB not detected

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    6

    USB not detected

    I am using a Teensy LC an an HID Keyboard. This works fine in most devices. I am trying to use it in an EPSON printer (as an HID Keyboard card reader) but it is not detected as a device. Other HID devices seem to work fine in the printer including keyboards, card readers etc. If I put the Teensy into program mode (pressing the button) it is detected by the printer but of course is not running my code!

    Any ideas/suggestions?

    Thanks,

    John

  2. #2
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    I have check a device which works on the printer and in device manage it shows as a single usb input device (where the Teensy shows as 3 input devices). I'm not sure it will make any difference but is this something I can change for the Teensy?

    John

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,022
    You might need to edit usb_desc.h to customize the USB descriptors. By default, even the keyboard only option in Tools > USB Type still includes an extra HID interface to emulate serial, so you can use Serial.print().

    Windows, Linux, Macintosh and all modern PC bios are able to properly detect USB composite devices having multiple HID interfaces and ignore the extra HID interface they don't understand. But perhaps the code inside this printer is not so savvy?

    You can delete the extra interface by just commenting out some of those lines and editing a few numbers. See the comments in that file for instructions. Of course, what this printer will actually detect involves some guesswork.

  4. #4
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Thanks Paul. I will try and have a go at it. Is the code which initialises the usb for the bootloader (when the reset button is pressed) very different to the startup for programs?

    We are using 2 Teensies as a serial to USB keyboard device and it has been a pleasure to work with.

    I also had problems with RC522 readers locking attached to a Raspberry PI, moved the reading to a Teensy with a watchdog and no more problems!

    Thanks!

  5. #5
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    I managed to make the changes but unfortunately it is not seen.

    It is odd that it is detected when the bootloader button is pressed. Does that run at a different speed?

  6. #6
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,451
    Quote Originally Posted by johnh View Post
    I managed to make the changes but unfortunately it is not seen.

    It is odd that it is detected when the bootloader button is pressed. Does that run at a different speed?
    It’s not about different speeds, it’s about different profiles. Before going into deeper details, you should acquire more basic knowledge by googling and studying the USB specifications, profiles and protocols. To make it somewhat simpler: An USB device can present itself in different ways to its host, like a guy using different business cards. Then, not every host is able to read all possible variants of business cards depending on his firmware, and even if he reads, there is no warranty that he will let you in.
    That’s a complex thing of fitting key and lock on both sides.
    To diagnose and debug such USB communication problems, you need a bunch of theoretical knowledge and an USB protocol sniffer, too.

  7. #7
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    Thanks for the reply and advice - it is very helpful. I will use a protocol sniffer to compare the startup sequence of a keyboard (which is detected) and the Teensy (which is not).

  8. #8
    Junior Member
    Join Date
    Nov 2017
    Posts
    6
    I managed to get it working. I got an analayzer and saw that I had to simplify the descriptor to remove the "KEYMEDIA_INTERFACE". I had to fix up a missing ifdef in usb_keyboard.h but after that it worked like a dream.

    Thanks again for your help and advice.

  9. #9
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,451
    That's what a support forum is for.

Posting Permissions

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