PaulStoffregen / AltSoftSerial

Software emulated serial using hardware timers for improved compatibility
http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
328 stars 131 forks source link

Problems with Arduino Nano #42

Closed JonVogel closed 6 years ago

JonVogel commented 6 years ago

I'm attempting to use the AltSerial library on an Arduino Nano. However, I'm not getting consistent data transmit and receive results. I'm currently performing a loopback test where I read what I write with pins 8 and 9 tied together. The results seem to always have the 4th and 5th bits set, regardless of the data I send:

send data 00000000 rcv data 00110000 send data 00000001 rcv data 00110001 send data 00000010 rcv data 00110010 send data 00000011 rcv data 00110011 send data 00000100 rcv data 00110100

When the data value gets large enough, it starts receiving two bytes of data for every byte written:

send data 00001001 rcv data 00111001 send data 00001010 rcv data 00110001 rcv data 00110000 send data 00001011 rcv data 00110001 rcv data 00110001 send data 00001100 rcv data 00110001 rcv data 00110010

I'm using the alt serial port at 9600 baud, but get corrupted results with 300 baud and 115200 baud.

I tested this with an Arduino UNO and have the same issue.

Thanks,

Jon Vogel

JonVogel commented 6 years ago

I'm stupid. I should use "write" instead of "print".