Is my Teensy 4.1 broken - HW serial not working?

Praxis

New member
I have a CP2102 chip that converts serial to usb. It is working because I can connect TX and RX together and run this python program and it outputs fine

Code:
import time

import serial
from struct import pack, unpack

from time import sleep

SERIAL_DEVICE='COM6'
BAUD_RATE=9600

ser = serial.Serial(SERIAL_DEVICE, BAUD_RATE)

try:
    while ser.is_open:
        ser.write(b'hello')
        time.sleep(1)
        s = ser.read(5) 
        print(s)
except:
    ser.close()

So this works fine. But when I connect to Teensy Serial1 (port 0 and 1) and try to just print something, nothing is happening

Code:
#define HWSER Serial1


void setup()
{
  HWSER.begin(9600);
}

void loop()
{ 

  HWSER.print("hello");
  

  delay(100);
}

I would post an image of putty or python but the screen will just be blank. I am positive I am using the correct port when connecting - I made sure of this by disconnecting the CP2102 to see which port disappears. I have also checked all the other ports just to be sure.

So the problem is that I had a more complex program than this which was working a couple of months ago, I come back to try to use it again and it is no longer working. So I go back to the simple code above and even that does not work. This leads me to two things
  1. I broke the Teensy
  2. I am doing something wrong

So please if anyone has any ideas I would be grateful, maybe I am missing something simple... One last thing to add is the teensy still seems to work other than the HW serial, I have run a Keyboard feedthrough using USB host, the micro USB Serial, and that seems to work. So is it possible that just the HW serial is broken?
 
@Praxis: Can you post a picture of your setup & wiring ?? Could you possibly have the RX & TX pins misconnected/swapped ?? Try swapping those two pins for a quick test . . . without seeing your setup, I would initially guess that you need TeensyRX-to-AdapterTX & TeensyTX-to-AdapterRX.

Hope that helps . . .

Mark J Culross
KD5RXT
 
So is it possible that just the HW serial is broken?

Hardware serial definitely works.

As a quick check anyway, I ran your program on a Teensy 4.1 with a FTDI USB-Serial cable connected to RX1 / TX1. Here's a screenshot of a terminal emulator listening to the FTDI cable (didn't try running the Python code).

screenshot.jpg
 
Hi all,

thank you for all the replies. Thankfully I figured it out when trying @kd5rxt-mark 's suggestion. It was a very dumb mistake, I was connecting Tx to Tx and Rx to Rx between the teensy and ttl to usb... Kind of funny, I was just matching labels and not actually thinking about the connections. I never even suspected that because I figured it was a very small chance that the labels are wrong haha
 
Back
Top