Teensy LC - Fried UART pins

Status
Not open for further replies.

aunsbjerg

New member
So, I finally got around to playing with my Teensy LC. Apparently, it does not like playing with me :D

I have an FTDI USB UART cable (3.3V version), and wanted to see if I could use it with the teensy, so I made a small sketch (see below), and hooked up RX/TX/GND to the Serial1 pins (pin 0 and 1). No joy - nothing is received by my terminal program on the PC. I tried swapping RX and TX by flipping the cable connector, but still no joy. I've tested the cable and I know it works.

Now, I measured the voltage levels on the UART pins before I connected the cable. RX pins were at 0V, and TX at 3.3V. After I've had the cable connected, the voltage level at the TX pins were 0V, leading me to believe the pins are fried.

I don't know what I'm missing here, everything is operating at 3.3V logic levels, and I connected the cable ground to the Teensy ground. Any inputs?

Code:
void setup()
{
  Serial1.begin(115200);
  Serial2.begin(115200);
  Serial3.begin(115200);

  pinMode(2, OUTPUT);
  pinMode(13, OUTPUT);
}

void loop()
{
  Serial1.println("serial 1 printing something");
  Serial2.println("serial 2 printing something");
  Serial3.println("serial 2 printing something");
  
  digitalWrite(13, !digitalRead(13));
  digitalWrite(2, !digitalRead(2));
  
  delay(100);
}
 
Did you just exchange Rx/Tx or actually flip the connector? May have swapped 3.3V and GND

You can just put a jumper wire on the LC Serial1 Rx to Tx and print out Serial1 will come back in Serial1 which you can then print out USB Serial to the Serial monitor. And you can take input from Serial and print to Serial1 so what you Enter into Serial monitor should come to Serial and loop out and in Serial1 and then echo back to Serial monitor.

That will confirm if the pins work. If not then do the same on Serial2 instead and it should work showing sketch is correct and those Serial1 pins are bad. If both work maybe the FTDI adapter went bad
 
Last edited:
Another test is to just stick a resistor + led on those two pins and confirm they blink. I think it's the same driver components so if the driver transistors are dead they will also be dead for digital IO.

+1 for looping both your USB serial dongle and the Teensy UART, see also the example->teensy->serial, though be careful doing the 'loop TX and RX' thing there since it's echoing to both USB and UART so you get an endless loop. Would confirm function though.
 
Thanks for the input, both of you.

Did you just exchange Rx/Tx or actually flip the connector? May have swapped 3.3V and GND

I made sure to only exchange RX and TX. Ground remained connected to the right pin.

Another test is to just stick a resistor + led on those two pins and confirm they blink. I think it's the same driver components so if the driver transistors are dead they will also be dead for digital IO.

I didn't have any LED's, so instead I just measured the voltage level of the unconnected pins with a multimeter, that should be enough, right? One of the Serial ports seems dead, the pins does not change value when toggling. The other pins seems to work.

You can just put a jumper wire on the LC Serial1 Rx to Tx and print out Serial1 will come back in Serial1 which you can then print out USB Serial to the Serial monitor. And you can take input from Serial and print to Serial1 so what you Enter into Serial monitor should come to Serial and loop out and in Serial1 and then echo back to Serial monitor.

Well, this is got me some weird results. Using the code below produces some results I can't quite decode. Now, there definately is something going on, everytime I enter a single character into the USB uart, something is also received on the HW uart and looped back to the USB uart. However, it's not the same character thats looped back; it's two characters and they don't really make sense to me. Like so:

USB received: 51
UART received: 53
UART received: 49

And the code I used for the loopback test. It doesn't matter which SerialX I use, they all produce the same results.
Furthermore, when RX and TX are physically connected, I measure 3.3V between the pins and GND. When I disconnect the two pins, they hover at around 0V. Is this to be expected from unconnected pins?

Code:
#define HWSERIAL Serial3

void setup()
{
	Serial.begin(115200);
  HWSERIAL.begin(115200);
}

void loop()
{
  int incomingByte;

  if (Serial.available() > 0)
  {
    incomingByte = Serial.read();
    Serial.print("USB received: ");
    Serial.println(incomingByte);
    HWSERIAL.print(incomingByte);
  }

  if (HWSERIAL.available() > 0)
  {
    incomingByte = HWSERIAL.read();
    Serial.print("UART received: ");
    Serial.println(incomingByte);
  }
}
 
Last edited:
So if I am guessing you sent an ascii '3' to the USB port, which is decimal 51, which you printed and sent to HWSERIAL.

So then HWSerial receives the ASCII string "51", which is two bytes '5' which is decimal 53 and a '1' which is decimal 49 so looks like that worked.

If you wanted the same to come back change HWSERIAL.print(incomingByte) to HWSERIAL.write(incomingByte)
 
You are right. Using .write makes the HW uart loopback the correct character.

So I tried with another FTDI cable and it works just fine. Then I tried with the original cable again, and it also works. I'm happy it works but no wiser as to why it works.

Anyways, thanks for the help :)
 
Glad it is working.

Not seeing the output toggle code you wrote - wondering if both pins were set to output, and the Serial1.begin() was removed?
 
I'm sure I had Serial1.begin(), but it is likely that I set the pinmode afterwards, overriding the serial driver.

Also, my breadboarding skills are non-existant. My breadboard has two columns of pin holes on both sides, I did not realize that these are connected vertically as opposed to diagonally like the rest of the board. I used those vertically connected pin holes to connect my serial cable, shorting out all the pins of the cable. :rolleyes:
 
Status
Not open for further replies.
Back
Top