Teensy3.1 USB to FT232R communications

Status
Not open for further replies.

nhk

Active member
Hi,
I am attempting to drive Teensy3.1 with a (x86 micro plus FT232R) system.
On the x86 I have serial read/write that appears to work with x86<->FT232R<-USB cable->Win_7_PC
On Teensy 3.1 I have the usb_serial example running, with Teensy3.1<-same USB cable->Win_7_PC working.

I check both the x86 and Teensy3.1 connectivity on PC using puTTy with appropriate COM port.
However when I connect x86 <- USB cable -> Teensy3.1 , I have no communication between them.

I modified the usb_serial example program as listed below. I notice that when the
Teensy3.1<-USb cable-> PC is connected, the program waits in "!Serial.dtr()" while loop.
When I start puTTy on PC, then Teensy3.1 starts to respond (type o to turn LED ON, f for OFF etc).

However when I plug in same cable to x86<->FT232R<- USB from Teensy3.1,
again I see that Teensy3.1 is waiting in loop "!Serial.dtr()".

Seems both the x86 system and Teensy3.1 are working fine on their own. But what
could be the problem?

Thanks in advance,

//////////////////////////////Serial_test.ino///////////
const int ledPin = 13;
void setup()
{
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop()
{
char incomingByte;
while (Serial.available()) {
incomingByte = Serial.read(); // will not be -1
if(incomingByte == '\n'){ Serial.print(incomingByte);}
if(incomingByte == 'o') { Serial.print(incomingByte); digitalWrite(ledPin, HIGH);}
if(incomingByte == 'f') { Serial.print(incomingByte); digitalWrite(ledPin, LOW);}
Serial.println("Hello World ** \n\n");
}
while (!Serial.dtr()) {
digitalWrite(ledPin, HIGH);
delay(250);
digitalWrite(ledPin, LOW);
delay(250);
} // wait for user to start the serial monitor
}
///////////////////
 
What exact is "a (x86 micro plus FT232R) system"? And how exactly are you connecting "x86 <- USB cable -> Teensy3.1"? I simply do not know what hardware you're really using (no links to specifics in your message) or how they're really connected.

FT232R usually means a USB-Serial chip or product. Many of those give 4 signals: TX, RX, RTS and CTS.

Normally, you would connect TX to RX1 on Teensy, and RX to TX1 on Teensy.

On Teensy, "Serial" communicates with the USB virtual serial to your PC. "Serial1" communicates with the RX1 and TX1 pins. The code you posted above uses only Serial, not Serial1.

This is fairly generic info, since I do not really understand what hardware you're really using, or how you're really connecting things, or even when you're really trying to accomplish. If this answer doesn't help, please try explaining in more detail what you're doing and how you want it to work. Better, more specific info really helps to be able to give better answers.
 
Hi Paul,
Thank you for the reply. Yes, my description is unclear. Perhaps the attached diagram helps.
In the diagram, the first and second configurations work hardware plus software. Note the x86 can be any micro controller --
it does not matter. What I am really looking for is the make the Teensy 3.1 talk to FT232R via Teensy3.1's USB.
Will appreciate any help,
Thanks again.


Teensy3.1-to-FT232R.jpg
 
Hi Paul,
OK, I looked up the documents (extracts below) you mentioned. I understand that even though the Teensy3.1
has the device (extracts from data sheet / manual below) that is capable of becoming the USB OTG host,
the system software is not in place. Sorry if I am otherwise confused. Please confirm.

Thank you,


MK20DX256 Manual from http://www.pjrc.com/teensy/datasheets.html:

2.2.8 Communication interfaces
The following communication interfaces are available on this device:
Table 2-9. Communication modules
Module Description
USB OTG (low-/full-speed) USB 2.0 compliant module with support
for host, device, and On-The-Go modes. Includes an on-chip transceiver
for full and low speeds

MK20DX256 Datasheet from http://www.pjrc.com/teensy/datasheets.html:

6.8.1 USB electrical specifications
The USB electricals for the USB On-the-Go module conform to the standards
documented by the Universal Serial Bus Implementers Forum. For the most up-to-date
standards, visit http://www.usb.org.

USB20.pdf from http://www.pjrc.com/teensy/beta/usb20.pdf:

4.1.1.1 USB Host
There is only one host in any USB system. The USB interface to the
host computer system is referred to as the Host Controller. The
Host Controller may be implemented in a combination of hardware,
firmware, or software. A root hub is integrated within the host
system to provide one or more attachment points.

4.4 Bus Protocol
The USB is a polled bus. The Host Controller initiates all data
transfers. Most bus transactions involve the transmission of up to
three packets. Each transaction begins when the Host Controller,
on a scheduled basis, sends a USB packet describing the type and
direction of transaction, the USB device address, and endpoint
number. This packet is referred to as the “token packet.” The USB
device that is addressed selects itself by decoding the appropriate
address fields. In a given transaction, data is transferred either
from the host to a device or from a device to the host. The
direction of data transfer is specified in the token packet. The
source of the transaction then sends a data packet or indicates
it has no data to transfer. The destination, in general, responds
with a handshake packet indicating whether the transfer was successful.

4.9 USB Host: Hardware and Software
The USB host interacts with USB devices through the Host
Controller. The host is responsible for the following:
• Detecting the attachment and removal of USB devices
• Managing control flow between the host and USB devices
• Managing data flow between the host and USB devices
• Collecting status and activity statistics
• Providing power to attached USB devices
The USB System Software on the host manages interactions
between USB devices and host-based device software. There
are five areas of interactions between the USB System Software
and device software:
• Device enumeration and configuration
• Isochronous data transfers
• Asynchronous data transfers
• Power management
• Device and bus management information
 
Status
Not open for further replies.
Back
Top