Upon power up, in default 'NewLog' mode, OpenLog will output 12< (note the less than sign) at which time you can start throwing characters at it. Those characters will be recorded to LOG#####.TXT. Pressing Ctrl+z (ASCII 26 decimal) three consecutive times will cause OpenLog to exit record mode and drop into command mode. Command mode is signified with a > (greater than) sign. You can then enter the following commands.
Tip: Once you're in command mode the list of available commands can be brought up by typing ?.
new file: Creates a new file (named file) in the current directory. Only standard 8.3 file names are supported. "12345678.123" is acceptable. "123456789.123" is not.
append file: Appends text to the end of file. Serial data is then read in from the UART in a stream and is not echoed. This is the most common way to use the logger. To exit this state, send the command Ctrl+z (ASCII 26) and OpenLog will return to the '>' prompt. If the file does not exist it will be created.
write file OFFSET: Writes text to file starting from the location OFFSET within the file. The text is read from the UART, line by line, and echoed back. To exit this state, send an empty line.
rm file: Deletes file from the current directory. Wild cards are supported starting in version 1.2.
size file: Displays size of file in bytes.
ls: This is the letters 'L' and 'S'. Also called list file. Shows the content of the current directory. Wild cards are supported starting in version 1.2.
md directory: Creates a sub directory in the current directory.
cd directory: Change to a sub directory
cd ..: Change to lower directory in tree. This is a bit weird because I'm used to "cd..". There is a space in between cd and .. to allow the string parser to see the cd command.
rm directory: Remove a sub directory
read file +start+ length TYPE: (New in v1.2) Outputs the contents of a file in visible form of a file starting from +start+ and going to length. There are three TYPEs of output, ASCII = 1, HEX = 2, and RAW = 3. You may leave off any of the arguments.
cat file: Writes the contents of a file in hex to the screen for viewing. This is sometimes helpful to see that a file is recording correctly without having to pull the SD card and view the file on a computer.
Remember, on version 1.6 and above, system configuration can be done via the CONFIG.TXT file.
echo on/off: New in version 2.3. This command allows you to turn on or off echo. This command is stored in memory and can be controlled by editing the config file. By turning echo off, OpenLog will not echo typed text on the command prompt. This is helpful if OpenLog is embedded into a system where the system does not read back the echoed characters. If you are playing with OpenLog via a terminal, you probably want to leave echo on so that you can see the text you are sending to OpenLog. Note: During normal logging you will not see the characters sent to OpenLog. This is because it takes too much system resources to echo back the text that is being received.
verbose on/off: New in version 2.3. This command turns on or off verbose error reporting. This command is stored in memory and can be controlled by editing the config file. By turning off verbose errors, OpenLog will respond with only a '!' if there is an error rather that "unknown command: oodf" (for example). This '!' character is easier for embedded systems to parse than the full error. If you are playing with OpenLog via a terminal, you probably want to leave verbose on so that you can see full error messages.
baud: Brings up a system menu to enter a baud rate. 9600 8N1 is the default. Any baudrate between 300bps and 1Mbps is supported. You can put OpenLog in a baud rate of 67715 (very weird, unsupported rate) so be cautious. You can always change the baud rate via the configuration file as well. The baud rate selection is immediate and OpenLog requires a power cycle for the settings to take effect. The baud rate is stored to EEPROM and is loaded every time OpenLog powers up.
Remember: If you get OpenLog stuck into an unknown baud rate, there is a safety mechanism built-in. Tie the RX pin to ground and power up OpenLog. You should see the LEDs blink back and forth for 2 seconds, then blink in unison. Now power down OpenLog and remove the RX/GND jumper. OpenLog is now reset to 9600bps with an escape character of 'ctrl+z' pressed three consecutive times. Note: This feature can be overridden by setting the Emergency Override bit to 1. See configuration file for more information.
set*: Brings up a system menu to select the boot up mode. These settings will occur at the next power-on and are stored in non-volatile EEPROM:
Escape characters explained: Original OpenLog firmware (versions v1.5 and below) required you to press ctrl+z to enter command mode. What we found was that many users had OpenLog attached to the TX pin on an Arduino. When you hit the 'Upload' button in the Arduino IDE, serial characters start flowing to the Arduino board in rapid succession - the Arduino is reprogramming! The problem is that there is a strong chance that one of these reprogramming characters will be ctrl+z (ASCII 26) causing OpenLog (who is diligently logging all these crazy characters as it 'listens' to the TX pin) to drop to command mode. Now when you go to run your sketch, OpenLog is not responding? That's because it's sitting in command mode. Firmware v1.51 and above fixes this issue by setting the escape sequence to three ctrl+z characters. You have to hit ctrl+z three times to get it to drop to command mode. During a bootload of an Arduino, it is highly unlikely (but still possible) to see three such characters stream by. Both the type of escape character and the number of required escape characters are user configurable. '$$$' is a common configuration string for old AT systems. We decided to stick with ctrl+z because that's what we've been using since the beginning. Remember: if things get out of hand and you forget what escape character you've set, or how many you need to hit, you can always do an emergency reset by holding the RX pin to ground during a power up. This will cause OpenLog to default to 9600bps, with escape character of ctrl+z sent three times.
Note for Arduino users: If you are using OpenLog with either the built-in serial library, or new software serial library, you may have noticed that command mode appears to be not working. This is because Serial.println() appears to send both newline AND carriage return. To overcome this use the \r instead of Serial.println():
or separately send the value 13 by using
Serial.print("Your command"); Serial.write(13);
disk: Shows card manufacturer ID, serial number, manufacturer date and card size. Below is an example of a 1GB generic card:
Card type: SD2 Manufacturer ID: 3 OEM ID: SD Product: SU01G Version: 8.0 Serial number: 39723042 Manufacturing date: 1/2010 Card Size: 965120 KB
init: Re-initializes the and re-opens the SD card. This is helpful if the SD card stops responding.
sync: Synchronize, or write the current contents of the buffer to the SD card. This command is useful if you have less than 512 characters in the buffer and want to have them committed to the SD card.
reset: This will cause OpenLog to jump to location zero and re-run bootloader and then init code. This command is helpful if you need to edit the config file then have OpenLog reset and start using the new configuration. It's not a completely clean reset (watchdog would be better but does not currently work), so use some caution.
As of firmware version 1.6 and above, you no longer need to use a terminal to reconfigure OpenLog. Simply edit the config.txt file (capitalization is not important) and change 9600 to 57600 and OpenLog will operate at 57600bps the next time you power it up. This is pretty handy! Rather than hooking up a serial connection and opening up a terminal window, you can now edit many of the settings on OpenLog via an SD card reader and a text editor. See the Config File page for more information.
OpenLog Wiki Pages:
Last edited by shashisamala,