Controlling USB devices with Teensy

Status
Not open for further replies.

w9ran

Member
Being a noob as I am, it's probably not smart for me to get too close to the bleeding edge, but I have a strong desire to do a project that requires controlling an external device via USB commands. The device has an onboard Arduino Nano, and is intended to be connected to a PC or equivalent host, so I assume this means I'd need the Teensy to operate in host mode, my understanding of USB OTG is that it allows a device to be either master or slave, but that wouldn't be necessary in my application once the code is loaded, as in normal operation after the external device is connected, the Teensy would always be the master and the other device always the slave. The data consists of short commands of

I found this: https://forum.pjrc.com/threads/28173-Teensy-3-x-NATIVE-USB-HOST-PREVIEW-AVAILABLE?highlight=usb+otg but have not played with it yet. Is this the best option available? I'm a little unclear as to how could be connected to a PC for development as normal and also to the external device -- hub? My default choice of CPU is the Teensy 3.2 but I'd be open to using 3.5 or 3.6 if it helped to resolve this issue.

I'd appreciate any thoughts or suggestions as to feasibility of what I'd like to do, thanks.

Bob
 
Does the "device" let you edit the code on the Nano? If you could move the data transfer to Serial pins rather than USB it might be a good work around?
 
I'd thought about that too, and I do have the sketch so I can make changes to the Nano code as needed. It would require making hardware connections and thus not quite as easy as just plugging in a cable, but it may be the way to go. My app uses a lot of I/O pins on the Teensy but at least one set of the serial port pins can be made available. I assume they're all the same.

Thanks,
Bob
 
Serial1 and 2 have optimal hardware support with FIFO's. On a T_3.2 you can use Alternate Serial2 from bottom pads. Forum has some simple solder boards that bring those pins from a castellated PCB to pins off the end.
 
Thanks. One more question - and this may be obvious and I just haven't found where it is explained - but is the USB serial port the same as Serial1, or is it separate? The little card that came with the Teensy 3.2 shows RX1 on D0 and TX1 on D1, but is data sent via these pins the same as what is sent to the Serial Monitor?

Bob
 
Thanks all. Just to close the loop, I've got it working just fine at 57,600 with a straight 3-wire connection, thanks to Teensy 3.2's 5 volt tolerant inputs. Since the Nano has resistors between the RX/TX pins and the USB IC, the Teensy is able to override the static levels with no problem.

Bob
 
Status
Not open for further replies.
Back
Top