0

Arduino to RS-232 - Debugging
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Arduino to RS-232 - Debugging

by osl on Sun Feb 03, 2008 1:37 pm

I'm working on a project where the Arduino is communicating with another device over RS-232. I've purchased a MAX233 clone and breadboarded it up, connecting it to RX and TX, but I'm getting some odd issues.

For the record, 19,200, N81 are the serial port settings I'm using on the computer. I haven't found a way to configure the handshake, data bits or stop bits on the Arduino with the hardware serial functionality, so I'm assuming it's using N81, since that's the most common.

It seems that data from the computer (which I'm using for testing) to the Arduino works fine, but if I echo that same data back to the computer, things get corrupted.

e.g
Computer sends: 0x00
Arduino rcvs: 0x00

But
Arduino sends: 0x20
Computer rcvs: 0x90

(If it would help, I can do a dump of all the byte values and put it in a spreadsheet somewhere)

The data corruption appears to be very predictable (e.g. Arduino: 0x20 always results in Computer: 0x90), but I haven't found a pattern to it yet. It's not like the first, or third or seventh bit is always getting set, or flipped or anything.

I've taken my main project program out of the loop and just set up some Arduino code to echo anything it gets off the serial port back onto it (and display it on an LCD).

I also tried setting up a short Arduino program to send data out and read it back and wired the RS-232 side of the MAX233 to itself, so the same data that went out would come back and this worked fine.

Finally, if I pull the MAX233 out of the circuit and just use the USB link as a serial port, everything works fine, so I don't believe it's my code on either side, but I don't know enough about the Arduino to do a good job of debugging the hardware.

Anyone seen anything like this before? Any thoughts on where I need to be looking for my bug? If I owned an oscilliscope, I should be able to figure this out, but without one, it's become somehwat tricky.

Thanks!
--
Orbital Space Lasers would make the world a better place.
osl
 
Posts: 2
Joined: Sun Feb 03, 2008 1:26 pm

Found it...

by osl on Sun Feb 03, 2008 7:28 pm

Apparently I was picking up some interference from some (supposedly) unpowered components on one of the boards. Pull them out of the circuit, everything works fine!
--
Orbital Space Lasers would make the world a better place.
osl
 
Posts: 2
Joined: Sun Feb 03, 2008 1:26 pm

Please be positive and constructive with your questions and comments.