TeensyLC as HID + serial +USB OTG

Status
Not open for further replies.

JasonH

Member
I have a TeensyLC in HID mode and a serial port (Serial2).

I wrote code to take serial commands and turn them into HID events.

I use an 8-byte packet that is read and decoded which uses Keyboard and Mouse libraries.
The serial channel is used to send these messages and plain text messages back about what was decoded:
moveRel 0, -1, 0
moveRel -4, 0, 0
moveRel -2, 0, 0
moveRel -1, 0, 0

That works when I plug it into my own computer (and my mouse moves around accordingly).
However when I plug it into a phone using a USB OTG adapter, I get gibberish:
\xFD\x01\x01\x00\x00\x00\x00\x80
\xFD\x01\x00\x00\x00\x00\x00\x00
\xFD\x01\x00\x00\x00\x00\x00\x00
\xFD\xFF\x00\x00\x00\x00\x00\x00
\xFD\xFE\x80\x00\x00\x00\x00\x00
\xFD\xFF\x00\x00\x00\x00\x00\x00
\xFD\xFD\x00\x00\x00\x00\x00\x80
\xFD\xFE\x00\x00\x00\x00\x00\x00

But it is recognized as a keyboard (and presumably a mouse)
 

Attachments

  • Screen Shot 2019-07-09 at 1.05.12 PM.jpg
    Screen Shot 2019-07-09 at 1.05.12 PM.jpg
    41.4 KB · Views: 43
Last edited:
Nevermind! It worked on the same computer because the grounds are connected. To the phone, they were not. Connecting the FTDI ground to the Teensy ground resolved the issue.

(I thought it was a voltage/baud thing)
 
Status
Not open for further replies.
Back
Top