Teensy 4.1 cannot connect to Putty/Teraterm

danieltsz

Active member
Hi again, I'm new to Teensy boards and I almost finished migrating my program from Arduino Mega to Teensy 4.1.
My past project using Arduino is connecting the serial port of my Arduino (via USB) to my PC, reading the output from the Serial port, and saving all the data to MySQL.

But when I try to connect my Teensy4.1 board to my PC using Putty/Teraterm, it says "Access is denied". Do I need to use the USB host port of my Teensy board to gain access to the Serial port of the PC?

Thanks in advance folks.
 
Just a guess, but make sure there is nothing else that is using the Serial port. For example the Arduino Serial monitor.

I am assuming a windows machine as you mention PuTTy.

Other potential things. On boards like Arduino UNO, The Serial object is connected up to pins 0 and 1, and likewise to the USB.
On Teensy 4.1 Serial is only USB, and pins 0 and 1 are Serial1.

Again just throwing darts as don't see your sketch or wiring or the like.
 
Hi, thank you sir for your response. I drafted a simple sketch to check the connectivity of Teensy to the PC serial port (via PuTTy).

Code:
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Test Serial Connection");
}

void loop() {
  // put your main code here, to run repeatedly:
  //do nothing
}

When I run this sketch on Arduino IDE 2.x, the result in Serial Monitor is "Test Serial Connection".
But when I close the Arduino IDE and start to connect my Teensy4.1 to the PC, it says access denied.
Is it safe to assume that I need to connect Teensy's Serial1 to the PC instead of the Teensy USB port for serial communication?
 
A couple of things that might be happening is that the Teensy might have completed sending your print before you can open Putty. If you change the sketch to:
Code:
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Serial.println("Test Serial Connection");
}

void loop() {
  // put your main code here, to run repeatedly:
  //do nothing
  Serial.println("Test Serial Connection");
  delay(1000);
}

and set Putty to the correct com port it should work regardless of the baud rate selected. Here is what I am seeing with Putty using a Teensy Micromod:
Screenshot 2023-09-28 125716.png
 
Works for me:
Screenshot.png

Although I did add a wait for the Serial port before the code ontinued:
Code:
void setup() {
  Serial.begin(115200);
  while (!Serial) {} // wait for Serial port
  Serial.println("From The T4.1");
}

void loop() {
}

Note: Normally I would put a timeout on the wait, as a lot of sketches may run either connected to terminal or not, so don't want it to sit forever...
Like:
Code:
while (!Serial && (millis() < 5000) {} // wait up to 5 seconds for Terminal
 
Thank you sir for the help. I think I encountered some "glitches" on my PC's com port. I'll try to troubleshoot what causing my teensy not connecting to the serial port of my PC.

Thank you so much for your help.
 
Back
Top