Reading Data Max Size? #108

WoodFisherStudios opened this Issue Mar 30, 2012 · 4 comments


None yet
4 participants

Hi Nathan, So I've been having an issue with any decent amount of data off of the card and am wondering if it is perhaps buffer related or something else. 64 characters seems to be the most read off of the card and for some reason the 28th character is dropped as well. To demonstrate this easily for you, in the read me example I changed
. OpenLog.println("Hi there! How are you today?");
To OpenLog.println("12345678911234567892123456789312345678941234567895123456789612345678971234567898");

And this is the output.

OpenLog online
Random file created: log373.txt
Text written to file
Reading file contents:

File read complete

The file created contains the 80 characters in the sequence that was printed to log373. I've tried changing baudrate, playing with delays and emptying the buffer.


nseidle commented Mar 30, 2012

I haven't tried any of this yet, but I figured I would try to give you some direction.

What version of OpenLog are you using? I'll try to add this check to the ReadExample. For the time being use the '?' from a terminal direct to OpenLog to see and let me know.

What baud rate are you using the example sketch at? The default is 9600bps.

Looking at the OpenLog read function, it looks sound and should have some very large limits (might have one at 65,535 bytes).

I believe the culprit is the ReadExample sketch, not OpenLog. The example sketch has to read incoming bytes from OpenLog (via a software UART) then write them out to the serial buffer on the Arduino (via a hardware UART). This is prone to jam up without careful planning and I didn't test the example sketch thoroughly. I would recommend creating a read buffer and a write buffer within the "for(int timeOut = 0 ; timeOut < 1000 ; timeOut++)" loop of 32 bytes or so. This may fix the issue.

Here's some untested code to show you what I'm thinking.

char inBuff[32];
for(int timeOut = 0 ; timeOut < 1000 ; timeOut++) {
  int n = OpenLog.available();
  if(n > 0) {
    for(int x = 0 ; x < n && x < 32 ; x++) //Read the incoming characters into a local buffer
      inBuff[x] =;

    for(int x = 0 ; x < n && x < 32 ; x++)    
      Serial.write(inBuff[x]); //Take the character from OpenLog and push it to the Arduino terminal
    timeOut = 0;

There's probably a cleaner way to do this, but that's all I can muster before the coffee kicks in.

Please let me know if you make any progress or need help with the buffers.

Thanks Neil, I'll play around with it tonight. I've had the same issue on version 2.5 and I uploaded the new firmware version 3.11 and had the same issue.


ToniCorinne commented Jun 3, 2013

Closing out this issue from lack of activity.

ToniCorinne closed this Jun 3, 2013

Note on this buffer solution, it works well when using 2 hardware ports or hardware and software serial ports but it won't work between two software serial ports as one of them is always being read from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment