Hi guys,
I'm working with a Modern Device RBBB, and I'm having issues with Serial transfer with the Arduino using a MAX232N chip. I whipped up a quick schematic to show you how I have it hooked up:
(I forgot to add values to the caps in the schematic - they are all 1uF in my circuit.)
This allows data to transfer between the Arduino and my PC through the serial port, but there are issues with the data being transferred. I also have a FTDI usb->serial converter that I normally use, and that transfers data without a problem, but when using the MAX232, I get data that appears to come into the PC out of order. It sounds confusing, so maybe an example will work out better.
Here's my example: I have a sketch that runs for 60 seconds, during which it outputs a line of data, with a line break at the end (using Serial.println() ). During this time, I increment an unsigned long, so that after 60 seconds, I can have the Arduino output the number of samples that were taken during the 60 seconds. Using the FTDI chip, the output looks something like this:
016801670527051300010001000100010000|59961
016801730528051400010001000100010000|59968
016701690527051300010001000100010000|59976
016601670528051300010001000100010000|59983
017301680528051400010001000100010000|59992
016401750528051400010001000100010000|59999
Samples Taken: 8014
All data are of the same length before the | symbol - the data after | on the same line is the value returned from millis(). This is the desired output of the data - it's exactly as I want it to be.
A problem occurs when using the MAX232 chip, the samples look something like this:
017201690528051500020001000100010000|58839
016501680527051300010002000100010000|58847
016701680528051400010002000300010000|58854
016301650527051400030001000100010000|58862
016
016501670529051400010000000100010000|58169
016701750527051300010001000100010000|58176
01670171052705020001000100010000|58885
017201680528051400010001000100020000|58892
016401730528051400010001000100010000|58899
0174017005250528051400010001000100010000|58207
016801680527051400010001000200010000|58214
016801670528051400010001000100010000|58
016701750528051400010001000100010000|58930
016801670528051400010001000100010000|58937
0168017605270514000100010001000100000000|58245
016601660527051500010001000300010000|58252
017401720528051400010001000200010000|582517401680529051400010001000100010000|58967
016501660528051300010002000100010000|58975
0171016805280514000100010000000300020000|58281
016801690528051400010002000100010000|58290
017101690528051300010001000100020000|582975901730528051300010001000100010000|59004
017001680528051400010001000200010000|59013
016601740528051300010001000100010000|59125
016001660527051300010001000100010000|59132
0175017105280527051400010001000100010000|58440
016801680528051400020001000100010000|58447
01750170052805140001000100010000|59155
017101700528051500010001000100010000|59163
016801660528051300010001000100010000|59170
0171016805280528051400010002000100010000|58478
016601670528051400010001000300010000|58485
01750172052805140001000100010000|59193
016701700528051400010001000100030000|59200
016801660528051300010001000100010000|59208
0167016405280514051100010001000100010000|58515
017201670528051400010001000100020000|58523
01650175052805130001000100010001|59231
016701670528051400010002000200010000|59238
016401680529051400020001000100010000|59246
0169016705280514001400010001000200010000|58553
017101690527051400020001000100010000|58560
01670169052805140001000200020000|59269
017401690528051400010001000100020000|59276
017301680528051400010001000100010000|59992
016401750528051400010001000100010000|59999
Samples Taken: 8014
0010001000100010000|59305
01650176052805130
I've taken some liberties and snipped excess data out of the MAX232 example, but you should get the idea. You will see that some of the data are out of order (millis is lower on a later sample than an earlier sample; The data are not completely written on one line, or in some cases, the data from two samples are on one line). Since this does not happen when using the FTDI chip, I don't believe it's an issue with the Arduino itself, or the sketch that I created - I think the issue is with my MAX232 serial circuit.
Does anyone see why this would be happening? Have I messed up the circuit or is something else amiss? Any help would be greatly appreciated