read data from sd through rs232

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
mcofano
 
Posts: 3
Joined: Sun Mar 25, 2012 5:20 pm

read data from sd through rs232

Post by mcofano »

Hello, I'd like read a file on SD (data logger shield mounted on arduino Uno) from another arduino Uno through rs232. Here the code on first arduino UNO (with data logger shield). This transmits:

Code: Select all

....
File dataFile = SD.open("datalog.txt");
      
     if (dataFile)
     {
       // read from the file until there's nothing else in it:
       while (dataFile.available())
       {
           Serial.write(dataFile.read());
       }
       // close the file:
       dataFile.close();
     }
.....
here the code on second arduino (the 2 arduinos are connected through rs232). This receives:

Code: Select all

.....
while (Serial.available()>0)
                {
                   inChar=Serial.read();
                   
                   dataString += inChar;

                 }
.....
I can see, on serial monitor where the data logger is runnning, the right data reading from sd (about 10 records), but in the other serial monitor (the receiver) I can see only first record and some characters of second record.

where I'm wrong? There is a method for reading record by record the file on SD?

Thanks for your help

Regards
Marco

mcofano
 
Posts: 3
Joined: Sun Mar 25, 2012 5:20 pm

Re: read data from sd through rs232

Post by mcofano »

Hello,

can someone help me?

Thanks

Marco

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: read data from sd through rs232

Post by adafruit_support_bill »

Sounds like you might have a buffer overrun problem. You don't mention the baud-rate, but you are most likely reading from the SD at a much higher data rate than you can transmit via serial.

To see if that is the case, you can add some delay between serial writes. At 9600 baud, you will need approximately 1 ms per character.

mcofano
 
Posts: 3
Joined: Sun Mar 25, 2012 5:20 pm

Re: read data from sd through rs232 - solved

Post by mcofano »

Thank you. I've also changed the baudrate from 9600 to 57600.

Marco

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”