dev/Serial0/Serial1 error on Teensy 4.1

dlab

Active member
Hi!

I was using Teensy 3.6 for my experiment code which includes Joystick analog input to be collected. My code is huge, made up of many files.

I shifted to Teensy 4.1 and now if analog is used (there's an if condition to check analog is true or not and we can control it in our code), teensy compiles but doesn't upload the code and return the Serial Error.

But if the Analog is set to false, then it uploads it well. So the problem is related to analog. Could you suggest possible errors?

(Joystick (Apem) runs on a 3.3V input)

The analogReadResolution is also 10 bits. I have checked other minor errors too.

(The serial Port is fine as it is working fine and reporting data on an independent sample code)
 
Last edited:
It's almost impossible to give you a relevant advice without seeing the code [see on top of this page: Forum Rule: Always post complete source code & details to reproduce any issue!].
You said your code is huge so maybe you can reduce your code to the smallest size that still reproduces the issue you encounter and then share on this forum?

Paul
 
... what @PaulS said ... small repro example would allow seeing the problem to understand and resolve.

What Version of IDE and TeensyDuino are in use?

no obvious reason for this to occur. Open Teensy Loader 'Help / Verbose info' and clear output. Then attempt the upload that fails and copy the posted output here in case it gives a clue.

Also, the output showing: "doesn't upload the code and return the Serial Error."

Also closed other thread with duplicate post - didn't seem to add any other info but here it is:
Hi!

I was using Teensy 3.6 for my experiment code which includes Joystick analog input to be collected. My code is huge, made up of many files.

I shifted to Teensy 4.1 and now if analog is used (there's an if condition to check analog is true or not and we can control it in our code), teensy compiles but doesn't upload the code and return the Serial Error.

But if the Analog is set to false, then it uploads it well. So the problem is related to analog. Could you suggest possible errors?
(Joystick runs on a 3.3V input)

The analogReadResolution is also 10 bits. I have checked other minor errors too.
 
... what @PaulS said ... small repro example would allow seeing the problem to understand and resolve.

What Version of IDE and TeensyDuino are in use?

no obvious reason for this to occur. Open Teensy Loader 'Help / Verbose info' and clear output. Then attempt the upload that fails and copy the posted output here in case it gives a clue.

Also, the output showing: "doesn't upload the code and return the Serial Error."

Also closed other thread with duplicate post - didn't seem to add any other info but here it is:

Hi So here are the details:

Arduino (Genuino) IDE Version: 1.8.19

Teensy Duino Version: 1.57


Also we use 'xvfb' to open the IDE through terminal and not by manually opening. Teensy 4.1 has no documentation about using the xvfb command either.

This is the part of the Code trying to open the Ports

Code:
if analogEnabled:
        anSer = getSerialConnection('/dev/serial0', '/dev/serial1', 1000000)

def getOpenPort(port0, port1):
    """
    Function to get a working serial port (Teensy or Hardware Serial)
    """

    def portIsOpen(portName):
        """
        Function to check if a serial port is available
        """

        try:
            ser = serial.Serial(port=portName)
            return True
        except:
            return False

    timeRecordSerial = time.time()

    while True:
        if portIsOpen(port0):
            return port0
        if portIsOpen(port1):
            return port1

        if (time.time() - timeRecordSerial > 10):
            print('   ... * EXCEPTION HAPPENED.')
            print('   ... * Serial ports '+port0+' , '+port1+' are not open.')
            print('   ... * Try < dmesg | grep tty* > in Linux shell.')
            print('   ... * Check serial and USB connections.')
            exit('   ... * Error: exiting the program.')

        time.sleep(1.0/10000.0)


def getSerialConnection(port0, port1, bRate):
    """
    Function to create and return a serial connection to Teensy
    """

    ser = serial.Serial(
        port=getOpenPort(port0, port1),
        baudrate=bRate,
        bytesize=8,
        parity=serial.PARITY_NONE,
        stopbits=serial.STOPBITS_ONE,
        timeout=0
    )

    return ser



On Teensy 3.6, exactly same code is running fine and we are performing experiments day and night but Teensy 4.1 shows the error like
Code:
* EXCEPTION HAPPENED.
            ... * Serial ports Serial0, Serial1 are not open.
            ... * Try < dmesg | grep tty* > in Linux shell.
            ... * Check serial and USB connections.
            ... * Error: exiting the program.


I am also using Rx and Tx Pins on Teensy to transfer the analog data to Rx and Tx Pins on Raspberry pi 3

Is there anything wrong with the command
"ser = serial.Serial(port=portName); where port names are '/dev/serial0' and '/dev/serial1'. I don't know if the port names are same for Teensy 4.1 as in Teensy 3.6.

Please suggest some solutions or point what's wrong.
 
sorry never heard of xvfb... So not much help.

Also I am more of a Windows person and not Linux, although I do play around some.

I do not know what /dev/Serial0 and /dev/Serial1 are?

On most linux Setups the teensy will show up with names like /dev/ttyACM0 or ttyACM1... And that
is assuming it was built with a USB type that includes Serial.

My assumption is you probably have a UDEV rules issue. Do you have the most recent one installed:
You can find them up at: https://www.pjrc.com/teensy/td_download.html

Now if you used the standard install of Arduino it should have checked this.

Now if it worked with T3.6 earlier with names like Serial0 and Serial1, wondering if you have a custom udev rules setup for them?
Or other ways to setup an alieas.

Years ago in RPI/BBBk/ODroid... I used to setup aliases for Teensy boards, such that my code could tell which teensy to use for what.

On some machines I would add something like:

Code:
    ln -s /dev/ttyO1 /dev/ttyXBEE
    ln -s /dev/ttyO2 /dev/ttyRCLAW`

To a profile file:

On others would add a custom udev rules.
Like have: This works for the USB2AX in /etc/udev/rules.d/99-usb-serial.rules
Code:
	SUBSYSTEM=="tty", ATTRS{idVendor}=="16d0", ATTRS{idProduct}=="06a7", ATTRS{serial}=="74031303437351D02210", SYMLINK+="ttyUSB2AX"

Note: the vendor and product would be different... But you may want to check to see if you have anything setting up Serial0...
 
I am also using Rx and Tx Pins on Teensy to transfer the analog data to Rx and Tx Pins on Raspberry pi 3

Is there anything wrong with the command
"ser = serial.Serial(port=portName); where port names are '/dev/serial0' and '/dev/serial1'. I don't know if the port names are same for Teensy 4.1 as in Teensy 3.6.

Photos or a clear diagram of how everything is connected would really take some of the guesswork out of trying to help you.

If the connection between Teensy and Raspberry Pi is just 3 wires (TX1-RX, RX1-TX, GND-GND) for ordinary hardware serial (not USB) then the serial device you would use is the name for Raspberry Pi's serial port, not a Teensy-specific name. I don't Raspberry Pi much, but as I recall its serial port is usually named "/dev/ttyAMA0".

You might try "ls -l /dev/ttyAMA0" in a terminal to check whether your user account has permission to open that device. You can find many sites which explain how Unix permissions and groups work.

For this 3-wire ordinary serial setup to work, code on the Teensy side would need to use "Serial1" for communication. If you use "Serial" the communication is by USB. Likewise on the Raspberry Pi side, if Teensy connects by USB rather than 3-wire serial, the device would (probably) be /dev/ttyACM0.

Now, for some *really* blind guesswork.... perhaps '/dev/serial0' and '/dev/serial1' were customized names someone previously created, maybe with symbolic links or custom udev rules? Perhaps you had these on a previous Linux installation, but then moved to a new Raspberry Pi or otherwise reinstalled the software, but didn't copy over that stuff? Ok, will admit, you didn't mention switching systems or custom device name setup, so this is really a pretty long shot guess, but those names are very unusual for Linux so it's hard to imagine what else could have created them.
 
Thanks a lot for your input, Kurt and Paul!! I'll check for that and get back with the observation.
 
I hope this clarifies some stuff, I have included all the relevant code and error messages.
The Teensy 4.1 is connected to the pi by the USB cable along with the RX + TX pins

Code:
    analogEnabled = False
    if userConfig['Analog'].lower() == 'true':
        analogEnabled = True

    # Open Teensy main serial port
    ser = getSerialConnection('/dev/ttyACM0', '/dev/ttyACM1', 1000000)

    # Open analog serial port [if enabled]
    anSer = False
    if analogEnabled:
        anSer = getSerialConnection('/dev/serial0', '/dev/serial1', 1000000)

This above is part of our python main() function that connects to 4 different ports, "/dev/ttyACM0", "/dev/ttyACM1", & "/dev/serial0", "/dev'serial1", the port names are passed to the function getSerialConnection, which is defined as:

Code:
def getSerialConnection(port0, port1, bRate):
    """
    Function to create and return a serial connection to Teensy
    """

    ser = serial.Serial(
        port=getOpenPort(port0, port1),
        baudrate=bRate,
        bytesize=8,
        parity=serial.PARITY_NONE,
        stopbits=serial.STOPBITS_ONE,
        timeout=0
    )

    return ser

As you can see this is the standard Python way of creating a serial object, this was working fine with the Teensy 3.6 but it does not work with the Teensy 4.1

This is the error our program throws:

Code:
   ... RPi Date & Time Synced with time.windows.com: 2022-10-14-12-26-58
   ... Killing the previous Teensy process if running.
   ... Compiling and uploading the *.ino file.
   ... Program uploaded to Teensy board successfully.
   ... Arduino compiler output:
   ... ========================
   ... Picked up JAVA_TOOL_OPTIONS: 
   ... Loading configuration...
   ... Initializing packages...
   ... Preparing boards...
   ... Verifying...
   ... In file included from /home/pi/AutoTrainerModular/StateMachineHeaders.h:10:0,
   ...                  from /home/pi/AutoTrainerModular/AutoTrainerModular.ino:21:
   ... /home/pi/AutoTrainerModular/StateMachines/JoystickMachine.h: In function 'void JoystickMachine()':
   ... /home/pi/AutoTrainerModular/StateMachines/JoystickMachine.h:17:6: warning: unused variable 'xStart' [-Wunused-variable]
   ...   int xStart=0;
   ...       ^
   ... In file included from /home/pi/AutoTrainerModular/StateMachineHeaders.h:11:0,
   ...                  from /home/pi/AutoTrainerModular/AutoTrainerModular.ino:21:
   ... /home/pi/AutoTrainerModular/StateMachines/JoystickLickMachine.h: In function 'void JoystickLickMachine()':
   ... /home/pi/AutoTrainerModular/StateMachines/JoystickLickMachine.h:16:6: warning: unused variable 'xStart' [-Wunused-variable]
   ...   int xStart=0;
   ...       ^
   ... Opening Teensy Loader...
   ... Memory Usage on Teensy 4.1:
   ...   FLASH: code:38124, data:8092, headers:9076   free for files:8071172
   ...    RAM1: variables:44384, code:35448, padding:30088   free for local variables:414368
   ...    RAM2: variables:12384  free for malloc/new:511904
   ... Uploading...
   ... ========================
   ... * EXCEPTION HAPPENED.
   ... * Serial ports /dev/serial0 , /dev/serial1 are not open.
   ... * Try < dmesg | grep tty* > in Linux shell.
   ... * Check serial and USB connections.
   ... * Error: exiting the program.

The arduino compiler output is fine, but the custom errors say that /dev/serial0 & /dev/serial1 are not open

The code that throws that error is:

Code:
def getOpenPort(port0, port1):
    """
    Function to get a working serial port (Teensy or Hardware Serial)
    """

    def portIsOpen(portName):
        """
        Function to check if a serial port is available
        """

        try:
            ser = serial.Serial(port=portName)
            return True
        except:
            return False

    timeRecordSerial = time.time()

    while True:
        if portIsOpen(port0):
            return port0
        if portIsOpen(port1):
            return port1

        if (time.time() - timeRecordSerial > 10):
            print('   ... * EXCEPTION HAPPENED.')
            print('   ... * Serial ports '+port0+' , '+port1+' are not open.')
            print('   ... * Try < dmesg | grep tty* > in Linux shell.')
            print('   ... * Check serial and USB connections.')
            exit('   ... * Error: exiting the program.')

        time.sleep(1.0/10000.0)

This lead me to believe that either the Teensy 4.1 does not have these serial0 & serial1 ports or that the respective ports have different names.
 
Last edited:
This lead me to believe that either the Teensy 4.1 does not have these serial0 & serial1 ports or that the respective ports have different names.

All of the port names used on Raspberry Pi are determined by the Linux distro it runs. None are defined by Teensy. The USB CDC protocol simply does not have any way to communicate the port name. And of course the ordinary 3 wire hardware serial can't communicate anything other than raw serial data. The names used on Raspberry Pi have nothing to do with Teensy. They're only due to the conventions of your Linux operating system and "system level" software like udev.
 
Both the Teensy 3.6 and the Teensy 4.1 were uploaded to on the same version of Raspbian Stretch.
The udev rules that were used are the same for both, it was downloaded from the rules on the Teensyduino download site, are there a separate set of rules that we need for /dev/serial0 & /dev/serial1 to be recognised for communication with the Teensy 4.1?
 
These are the udev rules being used (placed in /etc/udev/rules.d/):
Have also tried placing them in /lib/udev/rules.d/

"49-teensy.rules"
Code:
# UDEV Rules for Teensy boards, http://www.pjrc.com/teensy/
#
# The latest version of this file may be found at:
#   http://www.pjrc.com/teensy/49-teensy.rules
#
# This file must be placed at:
#
# /etc/udev/rules.d/49-teensy.rules    (preferred location)
#   or
# /lib/udev/rules.d/49-teensy.rules    (req'd on some broken systems)
#
# To install, type this command in a terminal:
#   sudo cp 49-teensy.rules /etc/udev/rules.d/49-teensy.rules
#
# Or use the alternate way (from this forum message) to download and install:
#   https://forum.pjrc.com/threads/45595?p=150445&viewfull=1#post150445
#
# After this file is installed, physically unplug and reconnect Teensy.
#
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"
#
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.
#
#
# If using USB Serial you get a new device each time (Ubuntu 9.10)
# eg: /dev/ttyACM0, ttyACM1, ttyACM2, ttyACM3, ttyACM4, etc
#    apt-get remove --purge modemmanager     (reboot may be necessary)
#
# Older modem proding (eg, Ubuntu 9.04) caused very slow serial device detection.
# To fix, add this near top of /lib/udev/rules.d/77-nm-probe-modem-capabilities.rules
#   SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", GOTO="nm_modem_probe_end" 
#

and another one:
"99-com.rules"

Code:
SUBSYSTEM=="input", GROUP="input", MODE="0660"
SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"
SUBSYSTEM=="spidev", GROUP="spi", MODE="0660"
SUBSYSTEM=="bcm2835-gpiomem", GROUP="gpio", MODE="0660"

SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660"
SUBSYSTEM=="gpio*", PROGRAM="/bin/sh -c '\
	chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\
	chown -R root:gpio /sys/devices/virtual/gpio && chmod -R 770 /sys/devices/virtual/gpio;\
	chown -R root:gpio /sys$devpath && chmod -R 770 /sys$devpath\
'"

KERNEL=="ttyAMA[01]", PROGRAM="/bin/sh -c '\
	ALIASES=/proc/device-tree/aliases; \
	if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
		echo 0;\
	elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
		echo 1; \
	else \
		exit 1; \
	fi\
'", SYMLINK+="serial%c"

KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
	ALIASES=/proc/device-tree/aliases; \
	if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
		echo 0; \
	elif cmp -s $ALIASES/uart1 $ALIASES/serial1; then \
		echo 1; \
	else \
		exit 1; \
	fi \
'", SYMLINK+="serial%c"
 
These are the udev rules being used (placed in /etc/udev/rules.d/):
...
Are these different from the ones found on the teensyduino download site?

Yes : Linux udev rules :: pjrc.com/teensy/00-teensy.rules
from : pjrc.com/teensy/td_download.html

Code:
# UDEV Rules for Teensy boards, http://www.pjrc.com/teensy/
#
# The latest version of this file may be found at:
#   http://www.pjrc.com/teensy/00-teensy.rules
#
# This file must be placed at:
#
# /etc/udev/rules.d/00-teensy.rules    (preferred location)
#   or
# /lib/udev/rules.d/00-teensy.rules    (req'd on some broken systems)
#
# To install, type this command in a terminal:
#   sudo cp 00-teensy.rules /etc/udev/rules.d/00-teensy.rules
#
# After this file is installed, physically unplug and reconnect Teensy.
#
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789a]*", ENV{MTP_NO_PROBE}="1"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666", RUN:="/bin/stty -F /dev/%k raw -echo"
KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04*", MODE:="0666"
KERNEL=="hidraw*", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="013*", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1fc9", ATTRS{idProduct}=="013*", MODE:="0666"

#
# If you share your linux system with other users, or just don't like the
# idea of write permission for everybody, you can replace MODE:="0666" with
# OWNER:="yourusername" to create the device owned by you, or with
# GROUP:="somegroupname" and mange access using standard unix groups.
#
# ModemManager tends to interfere with USB Serial devices like Teensy.
# Problems manifest as the Arduino Serial Monitor missing some incoming
# data, and "Unable to open /dev/ttyACM0 for reboot request" when
# uploading.  If you experience these problems, disable or remove
# ModemManager from your system.  If you must use a modem, perhaps
# try disabling the "MM_FILTER_RULE_TTY_ACM_INTERFACE" ModemManager
# rule.  Changing ModemManager's filter policy from "strict" to "default"
# may also help.  But if you don't use a modem, completely removing
# the troublesome ModemManager is the most effective solution.
 
Indeed, delete that ancient 49-teensy.rules and install the latest 00-teensy.rules file.

Physically unplug Teensy, as the new 00-teensy.rules take effect when it reconnects.

The serial0 and serial1 names are coming from the 99-com.rules file, specifically: SYMLINK+="serial%c"
 
The 00-teensy.rules file has at least 3 important differences...

1: Newer Linux distros (made after the 49 rules) usually configure ModemManager with a different filter policy, which is supposedly more secure. But sadly it exposes an very unfortunate ModemManager internal design choice which breaks ID_MM_DEVICE_IGNORE. I'd call it a bug, but the ModemManager devs don't see it that way. ID_MM_PORT_IGNORE was added as a workaround. I'm sure eventually we'll experience even more problems with ModemManager, so if you have that lingering menace installed, try to get rid of it. Sadly, it's harder to delete than you might imagine.

2: The /bin/stty stuff was added. It specifically solves a "unix line discipline" problem people experience when they use their own programs without termios config and never the Arduino Serial Monitor or other software which configures all the termios API stuff.

3: The file was renamed from 49 to 00 to (mostly) solve a race condition which can happen on slow Linux single board computers. I was only every to reliably make it happen on Jetson Nano, but it might happen on Raspberry Pi depending on how quickly a program opens the port after the kernel detects the device.
 
My understanding now is that the ports (created by connecting RX + TX on both pi + teensy) which were being named serial0 & serial1 will now be named either ttyAMA0 & ttyAMA1 or ttyS0 & ttyS1. Is this correct?
Also, any idea about why those udev rules work with the Teensy 3.6 but not the Teensy 4.1?
 
My understanding now is that the ports (created by connecting RX + TX on both pi + teensy) which were being named serial0 & serial1 will now be named either ttyAMA0 & ttyAMA1 or ttyS0 & ttyS1. Is this correct?

Mostly correct. The were always named ttyAMA0 and ttyAMA1. The udev rule was simply creating symbolic links which added alternate names.

Names ttyS0 and ttyS1 are unrelated. Whoever wrote that udev rule file probably also meant to use it on a regular PC, where those names exist.


Also, any idea about why those udev rules work with the Teensy 3.6 but not the Teensy 4.1?

Very likely something else is wrong.
 
To move forward with troubleshooting, I'd recommend programming this code onto your Teensy 4.1.

Code:
unsigned int count = 0;

void setup() {
  pinMode(13, OUTPUT);
  Serial.begin(2400);
  Serial1.begin(2400);
  Serial2.begin(2400);
  Serial3.begin(2400);
}

void loop() {
  digitalToggle(13);
  Serial.print("Serial, count = ");
  Serial1.print("Serial1, count = ");
  Serial2.print("Serial2, count = ");
  Serial3.print("Serial3, count = ");
  Serial.println(count);
  Serial1.println(count);
  Serial2.println(count);
  Serial3.println(count);
  count = count + 1;
  delay(2000);
}

This program has 3 important properties. It sends different and easily identifiable messages on each port, so when you receive the messages you can easily tell which port you're hearing. It sends the messages continuously, so you don't need to perform any action on the Raspberry Pi to cause Teensy to transmit. It sends at a relatively slow baud rate on the hardware serial ports, which should allow you to observe a slight momentary voltage change for each message on the TX1, TX2, TX3 pins.

When this program is running, you will see the orange LED slowly blink.

As a first step, use the Arduino Serial Monitor. Select each port from Tools > Ports, and then open the serial monitor. For the real hardware serial ports, be sure to set the baud rate to 2400 when the port is opened.

Before you start playing with Python code again, first verify you can actually receive the message from every port. Check that the serial name received in each port is the expected source from Teensy. This should fully resolve any lingering questions about which device name on Raspberry Pi is actually connected to each of the serial streams from Teensy.

For more help, remember we can't see your screen. We can't see the hardware connection. If the results are not correct, you might need to show screenshots or take photos and post them here. But hopefully this message at least lets you make a start to resolving these communication problems by getting to at least a known-working condition with Teensy and the Arduino Serial Monitor with Arduino IDE running on your Raspberry Pi.
 
Thank you! That was very helpful.
I ran that code on the Teensy, and this is what I see on /dev/ttyAMA0:
ama0fail.png
However, /dev/ttyACM0 displays the right information

While the program was running, the pi was lagging a lot for some reason, and when I unplugged the RX + TX wires the lag stopped (along with the serial monitor output of course)
 
Is there GND wire from Teensy GND to Raspberry Pi GND? Can you show us photos so we can see how the wires really are connected?
 
Wires from the Teensy:
Black: GND
Green: RX1
Blue: TX1

teensyWires.jpg

Wires on the Raspberry Pi:
raspiWires.jpeg

Code along with serial monitor
whole screen.jpg

An error on my part, I noticed that in the last picture, Arduino IDE thought it was reading data from an Uno. I changed it to Teensy 4.1 but the output is still the same
 
Last edited:
Really looks like it should work.

Try changing both sides to 9600 baud. Or 115200 baud. Teensy should work down to 1144. I don't know so much about Raspberry Pi serial. Perhaps there is a problem with too slow baud rate?

The only reason for a very slow baud rate is the change in voltage is easier to observe with most (slow update) DC voltmeters.
 
Yes! 9600 works, but nothing else does. Even when running at 9600, the first line is always gibberish before printing the expected line (Serial1 count = ...).
The Teensy 3.6 was running at 1000000 baud and that was fine.

Also the Raspberry Pi lagging was a very strange thing that was happening when baud rate was 2400, but at 9600 or above there is no lag at all (even though baud above 9600 does not work).
 
Back
Top