Serial Defaults to 1?

Status
Not open for further replies.

SpencerWF

New member
Hello,

I've got a 3.2 setup to transmit serial communication through Serial1 with the following commands

uint8_t message[3] = {0x00, 0x01, 0x00};

Serial1.begin(4800, SERIAL_8N1_RXINV_TXINV);
Serial1.write(message, 3);

The output looks like this:

Teensy32_InvertedTransmit_0x00_0x01_0x00_2.jpg

I thought with SERIAL_8N1_RXINV_TXINV that 0 = LOW and 1 = HIGH and default (not transmitting) would be the same as 0. It seems like in-fact 0=HIGH, 1=LOW and default (not transmitting) is the same as 1 (LOW). Is there a reason for this functionality? If I need default (not transmitting) to equal 0 is it best I bitbang the output myself?

The same output without SERIAL_8N1_RXINV_TXINV looks like this:

Teensy32_Transmit_0x00_0x01_0x00_2.jpg

Any assistance in clarifying this is greatly appreciated.

Cheers,
Spen
 
mark = 1, space = 0 for normal TTL serial. Inbetween characters the line is held in the mark state. Start bits are space,
stop bits are mark.

TXINV just swaps those (which is like RS232 apart from not being bipolar).
 
Any assistance in clarifying this is greatly appreciated.

It's not just Teensy. Virtually all UART chips and microcontrollers with TTL level signals use logic high for the inactive state. It's a de-facto standard that goes back at least 40-some years (maybe much longer?)

The voltage levels used by RS-232 are an actual standard. It's well understood the TTL level signals are inverted from RS-232, as most of the earliest transceiver circuits were based on a single transistor which inverted the signal.


Is there a reason for this functionality?

For modern parts, the reason mostly amounts to keeping compatibility with countless prior parts.

Before CMOS became mature in the late 1980s, there was indeed a technical reason. With NMOS or NPN-only bipolar transistor chips, logic low used a lot more power than logic high. Virtually everything from that era was designed using active low signals.
 
Status
Not open for further replies.
Back
Top