Teensy 4.1 Serial8

paoloboatto

Active member
I'm using Teensy 4.1 without problems, but recently I used Serial8 for the first time and I'm having some issues. The port is connected to a level translator (Texas Instruments TXB0102DCUR) that usually works fine. The level translator is connected to the PC through a USB serial converter. I send 2 chars from a serial terminal, but only the first char is always read correctly. I tried different baud rates without success. The port is initialised with default parity setting and the timeout is set to 200 ms. Is there a special setup for Serial 8?
 
We really need to see your code to determine what is going on. Post it using the </> button on the form.

I usually use ADUM1201 for serial level shifters. They were designed for just that use.
They are available here.
 
Why are you using a non-inverting logic level shifter rather than a genuine RS232 line driver?

RS232 signals are in theory -15V to +15V (although in reality most drivers are lower voltage) and are the inverse of the TTL uart signals.

While you can normally get away with switching between 0V and +5V it's not in spec for RS232 and certainly not guaranteed to work.
As for the inverted signals, when initialising Serial8 it is possible to specify inverted signals by using Serial8.begin(<baud>,SERIAL_8N1_RXINV_TXINV);

But generally it's simpler to use MAX3232 or similar part and us RS232 for serial links.

Alternatively use something like an FTDI ttl-232r-3v3 cable. This is a 3.3V TTL uart to USB converter and so can be connected to the teensy without any extra parts.
 
Is there a special setup for Serial 8?

First to answer your specific question, there is nothing special about Serial8 on Teensy 4.1. It works the same way as Serial1 to Serial7.

With any of the serial ports, you have a lot of opportunities for things to go wrong. It's also a lot of ways this sort of forum question can be answered with deep dives into details like level conversion which may or may not be relevant to your situation. We try to help here, and when your question lacks detail like the specs or part number of the USB serial converter connected to your PC... we have to do a lot of guessing.

Please consider showing us photos of the hardware connection and the code you're using for testing. If you have used the same hardware on Serial1 and similar code (edited for Serial8 vs Serial1), please say so clearly. Or show photos of both. Also show the code which worked and code which failed. Even if this seems unnecessary, when something like this which ought to work is failing, usually it's some small detail that's easy to keep overlooking. If you only give us words, often the words say the correct thing. But when we can actually see with photos and a copy of the actual code used (not fragments, copy and paste the whole code from Arduino IDE) we can usually help much better. Especially when it's some "minor" detail that's easy to overlook when you've checked the same thing over and over, show us as much and as clearly as possible so we have a better chance of noticing whatever is keeping it from working.
 
Back
Top