Help with OpenLog - not writing last byte(s) to file

Any tips, hints, pointers to documentation, or anything would be appreciated:

I have an Openlog https://www.sparkfun.com/products/13712. I did not flash it with latest firmware. I just ordered it a few weeks back.

Connected to a RedBoard https://www.sparkfun.com/products/13975

I connected all OpenLog pins to the Redboard as follows

OL Pin RB Pin

GRN RESET

RXI TX

TX0 RX

VCC 3.3V

GND GND

BLK GND

I’m connecting my RedBoard to my computer via the USB port. I’m using a Kingston USB card (https://www.amazon.com/gp/product/B0051 … UTF8&psc=1) I formatted it fresh with FAT32.

I’m running the provided sketch OpenLog_Text_Sketch. (By the way I learned that I can’t upload a sketch to RedBoard when the OpenLog RX/TX pins are connected. The OpenLog RX/TX circuitry seems to interact with the USB port. So each test cycle I power down, disconnect RX/TX, power up, upload sketch, power down, connect RX/TX, power up, wait for the sketch to complete, then check the memory card. )

Bottom line, the CONFIG.TXT and LOGnnnnn.TXT expected files are created on the memory card, however, the last few hundred (perhaps up to 512??) bytes are not written. It seems like the OL software isn’t flushing the last few bytes from the buffer and closing the file. If I just do a serial.println(“this is a test”), for example, a 0-byte file is created on the SD card.

Any tips, hints, pointers to documentation, or anything would be appreciated… Thanks in advance,

Chris

You have to close the file to write the final buffer. I do that by sending 3 ^Z characters, as instructed in the user guide.

Thanks. None of the sample code has the 3 ^Z characters. Where in the user guide are those 3 instructed?

Thanks again!

https://learn.sparkfun.com/tutorials/op … ommand-set

Escape Characters Explanation:The reason OpenLog requires CTRL+z hit 3 times to enter command mode is to prevent the board accidentally being reset during upload of new code from the Arduino IDE. There is the chance that the board would see the CTRL+z character coming through during bootloading (an issue we saw in the early versions of the OpenLog firmware), so this aims to prevent that. If you ever suspect your board has been bricked due to this, you can always do an emergency reset by holding the RX pin to ground during power up.

The user documentation could be better written than is presently the case.

I added serial.write(26); serial.write(26); serial.write(26); and it started working.

Thanks!