Forum Rule: Always post complete source code & details to reproduce any issue!
-
Teensy 4.1 Serial Communication in 8E1 Configuration
Hello,
I'm trying to use Teensy 4.1 to communicate with a device that only uses 8E1 data format in terms of serial communication. I read on PJRC website that Teensy 4.1 doesn't support Serial1.begin(baud, format), so I'm assuming it only communicates in 8N1. Is there a way to still communicate with my target device through some clever coding/software methods? I can only think of somehow appending the parity bit to my outgoing bit stream from Teensy but have no idea how to achieve this. Thank you in advance for reading and helping!
Yubo
-
You should be able to use the format argument. Have you tried it?
Code:
Serial1.begin( 9600, SERIAL_8E1 );
-
Hi,
Thank you for your reply. No, that function doesn't work. Here's what I'm seeing on Teensyduino. This code works on an Arduino Mega.
-
Serial and Serial1 are different technologies. Serial is the emulation over USB. Serial1 is a traditional UART
-
Thank you for your reply. I got rid of Serial.begin(38400, SERIAL_8E1) and the rest of the code seemed to be able to compile. It seemed that this section of the PJRC website might be out of date:
-
Senior Member
Why out of date? It explicitly states Serial1.
-
Hi, yes it is referring to Serial1; however, it also says that Serial1.begin(baud, format) is only supported on Teensy LC and 3.x, not Teensy 4.x. I'm using a Teensy 4.1 and it seems to be compiling just fine. I posted the initial question assuming that Teensy 4.1 does not allow for data format configuration, based on what I read from the website. This is the URL for the website: https://www.pjrc.com/teensy/td_uart.html
-
Senior Member
-
Senior Member+
Paul has a github project to track issues about the website.
Did a quick look, and sure enough, I opened up an issue about this, about a year ago:
https://github.com/PaulStoffregen/We...ates/issues/26
-
Hi Kurt, thank you for looking into this. Just to double check, this means that I can indeed configure the serial data format to be 8E1 using Serial1.begin(baud, format) on Teensy 4.1, correct? My Teensy 4.1 hasn't arrived yet, so I'm only checking whether it compiles on Teensyduino without testing the actual hardware.
-
Senior Member+
Yes you should be able to do 8E1. Don't remember if you need to enable 9 bit support within HardwareSerail or not, probably not.
By default, the support for 9 and 10 bit and more is disabled within the source code as it requires the queues to be changed from 8 bits to 16 bits, which eats up a memory...
-
Hi Kurt, thank you for confirming. It appears that we only need HardwareSerial.h with serial data in the Serial_9X1 format, so we don't need to enable 9 bit support when the data bit is less than 9.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules