Two Serial Links on one USB Serial cable

Status
Not open for further replies.

mborgerson

Well-known member
I would like to know if there is a way to have the Teensy USB cable support two separate serial communications links. At present, my host program handles text I/O and high-speed binary transfers on the same serial link. This requires careful handshaking lest the host program get back into text mode while the Teensy is in the middle of a binary file transfer. When that happens, the console display goes crazy and I have to shut down the program.

If there is a way to set up two separate USB Serial links, perhaps with different end points, etc. etc, I could use one for the text comms and the other for high-speed binary transfers. It seems that it should be possible, as the MTP responder seems to do something very similar.

I have gotten the MTP responder to work well enough to handle image transfers and the uploading of data files, but there are still issues with the MTP software. (However, there does seem to be significant progress in the MTP Responder thread.)

I'll take a look at the various Serial-MIDI combination devices and see if I can figure out how they handle the two separate communication links.
 
Click Tools > USB Type and select Dual Serial.

usb_type_menu.png


This setting takes effect when you upload a new program.

In Arduino, the 2nd USB serial device is access with "SerialUSB1". If you select Triple Serial, the 3rd device is "SerialUSB2". Details here:

https://www.pjrc.com/store/teensy41.html#communication
 
Click Tools > USB Type and select Dual Serial.

usb_type_menu.png


This setting takes effect when you upload a new program.

In Arduino, the 2nd USB serial device is access with "SerialUSB1". If you select Triple Serial, the 3rd device is "SerialUSB2". Details here:

https://www.pjrc.com/store/teensy41.html#communication

DOH! (Forehead Slap). I should have seen that when I was adding MTP to the USB descriptions file. I'll try it out on my C++ Builder host. After that, I hope to get a processing sketch with the same control and upload functionality that can be more easily distributed to Teensy users. That may take a while as I am currently a total noob with processing. Python is another alternative, but I've only written about 50 lines of python so far, so I'm at the low end of the learning curve on both. OTOH, I'm probably looking at 4 or 5 months until I get vaccinated and can travel outside Oregon, so we'll see how long it takes an old dog to learn new tricks.
 
Converting my T4.1 photo transfer app required changing two lines of code and adding another to open SerialUSB1. It took a lot more lines to open a second serial port on the PC and to separate out the terminal text data from the binary data------but it was only about an hour's work. The big advantage is that I now can communicate with the user over the terminal about the status of the binary transfers. In the old scheme, I had to wait until I was sure the binary transfer was complete before doing any user input or output. If there was a problem with the transfer, I often had to restart the host program and the T4.1.

I'm now considering moving the binary transfers to a separate thread on the PC----but that's a project for another day---or another year, in this case.
 
Status
Not open for further replies.
Back
Top