1

I am trying to troubleshoot a Software Uart Connection from my Arduino Nano, and I do not understand this output. The setup is simple, I have a Software Serial connection on pins 2 and 3. I send 170, which I expect to be 10101010 of course with a low start bit and high stop bit.

I hook up to the TX line with my Oscope and check the waveform, but its not as I expect.... I only see 101010

#include <Arduino.h>
#include <SoftwareSerial.h>
#define SW_RX 2
#define SW_TX 3
#define SW_BAUD 9600
SoftwareSerial Serial2(SW_RX,SW_TX);
void setup(){
 Serial2.begin(SW_BAUD);
 delay(1000);
}
void loop(){
 Serial2.write(170);
 delay(100);
}

Can someone help me to understand this output?

Oscope Image

Schematic

asked Nov 4, 2022 at 23:25
1
  • 1
    it is helpful if you start thinking in hex because the conversion to binary is direct, without any math ... you sent 0xAA ... try 0x55 ... 0x40 ... 0x02 ... what do these values reveal about the problem you are trying to solve? Commented Nov 4, 2022 at 23:42

1 Answer 1

3

It is working exactly as expected. The scope trace shows 10010101011:

  • 1: idle state of the serial port
  • 0: start bit
  • 0: first data bit
  • 1010101: other data bits
  • 1: stop bit.

Keep in mind that the data bits are sent least-significant first.

answered Nov 4, 2022 at 23:42
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.