Teensy 4.1 and SERIAL_PORT_2 ERRORS
November 23, 2023 02:42PM
Hi all
before every one says WHY a teensy 4.1. just becasue i can.

but i made my own motherboard for my 3d printer with a teensy 4.1 and all so far seems to work great!
BUT when i try to enable #define SERIAL_PORT_2 1 and at the same time #define SERIAL_PORT 0
i get ALLOT of errors.

it only works when i disable //#define SERIAL_PORT_2 1 and change #define SERIAL_PORT 1
it all works great but i would love to have usb on serial port 0 and tft screen on serial port 1

can someone shed some light.

3d printer specs:
XYZ threaded rod TR8X8
XYZ mks servo42c
Extruder Revo hemera
Bltouch
heated bed
teensy4.1
Sidewinder X1 TFT
old Ender3 frame
Re: Teensy 4.1 and SERIAL_PORT_2 ERRORS
November 23, 2023 06:17PM
"just because i can." ah but you can't, that is why your here...



Apply this diff.

This Compiles. But I don't have the hardware to test it


diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.cpp b/Marlin/src/HAL/TEENSY40_41/HAL.cpp
index 1d02ab8575..f6dae65f6e 100644
--- a/Marlin/src/HAL/TEENSY40_41/HAL.cpp
+++ b/Marlin/src/HAL/TEENSY40_41/HAL.cpp
@@ -42,6 +42,9 @@
 #if WITHIN(SERIAL_PORT, 0, 3)
   IMPLEMENT_SERIAL(SERIAL_PORT);
 #endif
+#ifdef SERIAL_PORT_2
+  #if WITHIN(SERIAL_PORT_2, 0, 3)
+   IMPLEMENT_SERIAL(SERIAL_PORT_2);
+  #endif
+#endif
 USBSerialType USBSerial(false, SerialUScool smiley;
 
 // ------------------------
diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.h b/Marlin/src/HAL/TEENSY40_41/HAL.h
index 84c5847677..5a0fb8e90b 100644
--- a/Marlin/src/HAL/TEENSY40_41/HAL.h
+++ b/Marlin/src/HAL/TEENSY40_41/HAL.h
@@ -94,6 +94,7 @@ extern USBSerialType USBSerial;
   #elif SERIAL_PORT_2 == -2
     #define MYSERIAL2 ethernet.telnetClient
   #elif WITHIN(SERIAL_PORT_2, 0, 8)
+    DECLARE_SERIAL(SERIAL_PORT_2);
     #define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
   #else
     #error "SERIAL_PORT_2 must be from 0 to 8, or -1 for Native USB, or -2 for Ethernet."
Re: Teensy 4.1 and SERIAL_PORT_2 ERRORS
November 23, 2023 11:47PM
The above will probably work well enough for your situation, but here is a more substantial change

This should allows for SERIAL_PORT, SERIAL_PORT_2 and SERIAL_PORT_3 to be set to any port from -1 to 8

special serial over Ethernet -2 is still limited to SERIAL_PORT_2 only.

replace Marlin/src/HAL/TEENSY40_41/HAL.cpp with HAL.cpp
and Marlin/src/HAL/TEENSY40_41/HAL.h with HAL.h

But beyond compiling it, I have no way to try this
Re: Teensy 4.1 and SERIAL_PORT_2 ERRORS
November 24, 2023 01:28AM
hi thanks allot!
both options worked.

""just because i can." ah but you can't, that is why your here..."

i did try to add DECLARE_SERIAL(SERIAL_PORT_2); into hal.h
but i needed a bit more.

and it's not a shame to ask for help if you dont see it right away.

but many thanks for helping me!
Sorry, only registered users may post in this forum.

Click here to login