USB - Serial Problems

Status
Not open for further replies.

AllenCherry

Active member
Anyone who can help a 'Newbie'?

I am using the 'Echo Both' example code for serial testing on the Teensy 3.5 board, with a USB to serial convertor lead from another computer which has RX, TX and ground connected to RX1, TX1 and GND on the Teensy board.
I am using 'RealTerm' on the computer to send data to the Teensy serial port via the USB-Serial convertor lead.
I have checked that data is being sent correctly from the computer by monitoring it using 'RealTerm' on another computer, and data is being sent and received correctly. Baud rates are set at 38400.
Using the Arduino serial monitor, I get the expected result when sending 'A' via the USB serial connected to the Teensy board i.e. the monitor shows:

USB received 65
USB received 13
USB received 10

But the 'RealTerm' monitor just shows garbage:

UV¯ÛTʪjšTºZ6VV¯¯Uµý۪ʪjšTºZÖ–Vo¯Uµý۪ʪjšTºZÖöVo

with the occasional brief showing of 'UART Receiver Framing Error' in the bottom status bar. I have triple-checked the baud rate, parity and stop bit settings.

I get no response in the Arduino serial monitor when sending from the other computer using the USB-Serial convertor lead, but some activity (UART received) is displayed if I connect and disconnect the serial connections (RX and TX) to the Teensy breadboard.

I would be very, very grateful of any help that anyone can give,

Many thanks,

Allen
 
Maybe a wrong connection? Can you show us photos of how the wires are really connected?

which has RX, TX and ground connected to RX1, TX1 and GND on the Teensy board.

Double check the grounds are really connected, and that each TX goes to RX on the other side. Sometimes a misunderstanding happen where people connect signals of the same name together. That's correct for SPI & I2C, but with serial each transmit pin needs to connect to a receive pin.
 
Dear Paul,

Many thanks for your prompt response.
I have double-checked the grounds, and also used a 'Null Modem' convertor to reverse the TX / RX connections. With the connections 'reversed', I get no output at all, with the TX / RX connected as they should be, I get the garbage as shown on my first posting.

PCB Layout (2).jpg

I have attempted to upload a photo of the board layout - not sure if it has worked!

Many thanks,

Allen
 
Dear Paul,

Many thanks for your prompt response.
I have double-checked the grounds, and also used a 'Null Modem' convertor to reverse the TX / RX connections. With the connections 'reversed', I get no output at all, with the TX / RX connected as they should be, I get the garbage as shown on my first posting.

View attachment 17176

I have attempted to upload a photo of the board layout - not sure if it has worked!

Many thanks,

Allen

It looks as though the upload of the photo has worked! The pink and white wires are the TX1 and RX1 from the Teensy (1 and 0) to the 9 pin 'D' connector, pins 2 and 3, the black wire is the ground to pin 5 on the 'D' connector from GND (0) on the Teensy board. Using a 'null modem' convertor to reverse pins 2 and 3 gives no response on the RealTerm display, so I assume that they are connected correctly.
 
Yikes, that looks like a connector for RS-232 level signals. Teensy 3.6 needs 3.3V "TTL level" signals, which are lower voltage and opposite polarity from RS-232 level signals.

Without connecting to Teensy, use a voltmeter to measure those signals (without any data flowing). RS-232 transmit will measure between -5V to -12V (yes, negative voltage relative to GND) when the line is idle. TTL level should measure +3.3V when idle, which you can confirm on pin 1 (TX1) on Teensy.

You're probably going to need a level converter. MAX232 is a popular chip. In fact, you can see one used on the breadboard on the serial page.

https://www.pjrc.com/teensy/td_uart.html

However, you MAX232 gives 5V signals. Teensy 3.6 is not 5V tolerant, so you would need a similar MAX3232 part, which is basically the same thing but for 3.3V signals.

td_uart.jpg


schematic_rs232.gif


There are also transistor circuits (usually lower performance) to convert the levels, which you can find by searching...
 
Hi Paul,

Yes, it is a 'standard' 9-pin 'D' connector, but the RS2332 from the USB to Serial convertor is only giving TTL signal levels of 5 volts.
I am using the Teensy 3.5, so it is 5 volt tolerant, hence I don't think that the MAX232 is actually required.

Any other clues?

Many thanks,

Allen
 
Check the actual voltage with a voltmeter. Maybe it's really -5V when idle?

Hard to believe any commercial serial product with that 9 pin connector would have the correct polarity, since it would then be unable to work with all the other 9 pin serial connectors in the world!
 
Hi Paul,

I think that you have found the problem - Pin 2 on the USB - Serial convertor is sitting at -5 volts!

So does that mean I will have to incorporate the MAX232 to drive the RX1 / TX1 serial port on the Teensy?

Many thanks for your help,

Allen
 
Maybe try to setup UART in teensy with inverse polarity. (I needed that to use a RS232 cable to a T3.2)

Many thanks for a possible solution - is the 'SERIAL_8N1_RXINV_TXINV' the correct syntax to use for the UART inverse polarity?

Best wishes,

Allen
 
Teensy 3.5 is 5 volt tolerant, but no Teensy is negative voltage tolerant.

You either need a proper level converter like MAX232, or at the very least a resistor and diode to clamp the voltage so Teensy's pin isn't driven negative.
 
Teensy 3.5 is 5 volt tolerant, but no Teensy is negative voltage tolerant.

You either need a proper level converter like MAX232, or at the very least a resistor and diode to clamp the voltage so Teensy's pin isn't driven negative.

Thanks Paul,

The MAX232 is definitely the most robust way forward. I have ordered a couple, and will wire them in tomorrow.

I'll let you know how I get on.

Very much appreciate your help,

Allen
 
Hi Paul,

Just to let you know that I used a DSD TECH USB to TTL Serial Adapter purchased from Amazon - two pieces for £8.99. I figured that I would have to have a USB plug and lead going from the computer to the MAX232 IC, so having the TTL levels built into the USB plug seemed to be a neater way.
All working fine now!

Again, really appreciate you help and guidance.

Many thanks,

Allen
 
Status
Not open for further replies.
Back
Top