Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Flashing Firmware

psimona edited this page · 43 revisions

Updating Firmware on OpenLog v3

From time to time there will be new features released for OpenLog. These instructions will guide you through how to update the firmware using an FTDI Basic and the Arduino IDE (OpenLog v3 now compiles under Arduino v1.0).

There are two pieces of software on the OpenLog: a bootloader and the firmware.

Figuring out the right bootloader:
All OpenLogs sold during and after March of 2012 have a bootloader that is compatible with the “Arduino Uno” board under the Arduino IDE. All OpenLogs sold prior to March of 2012 have a bootloader that is compatible with the “Arduino Pro or Pro Mini 5V/16MHz w/ ATmega328” board under the Arduino IDE. If you’re not sure, start with “Arduino Uno” – it won’t hurt anything.

Figuring out the right firmware:
All OpenLogs can run the latest version of firmware (and all older versions if you really want to go there).

To compile and load the latest version of firmware onto your OpenLog:

  1. Get an FTDI Basic and a crossover board
  2. Download the Arduino IDE version 1.0.6 (check under previous releases)
  3. Download the OpenLog firmware either directly here or by checking out the repository (more advanced and not necessary for most people)
  4. Get the new beta version of SerialPort lib from Bill Greiman’s beta library. Unzip ‘SerialPortBeta20120106.zip’ and ‘SdFatBeta20120108.zip’ directly to Arduino’s “libraries” directory (usually something like C:\arduino-1.0\libraries) and close and restart Arduino. To verify these are installed correctly, you should now see ‘SerialPort’ and ‘SdFat’ under the File→Examples menu.
  5. Open the OpenLog_v3 sketch and compile.
  6. Connect the FTDI basic to your computer, then plug the crossover board into the FTDI, and finally plug the OpenLog into the crossover board.
  7. Select the appropriate board under the Arduino Boards menu. You will want “Arduino Uno” for OpenLogs created after March 2012 and “Arduino Pro or Pro Mini 5V/16MHz w/ ATmega328” for all others. If you’re not sure, start with “Arduino Uno” – it won’t hurt anything.
  8. Select the right COM port to connect to the FTDI Basic
  9. Upload the code
  10. High five your nearest neighbor

Why do I need a crossover board? aka Why in the world did you do mess up TX and RX like that?
Most of the data logging projects (such as logging the temperature of your compost pile over 3 months) take place away from a computer. Therefore, OpenLog will probably not be connected to a computer – instead, it will likely be connected to a microcontroller. We made OpenLog so that it can plug directly onto an Arduino Mini Pro.

Why are you using beta versions of SerialPort and SdFat?
These awesome updated libraries from Bill allow us to arbitrarily declare how big the TX and RX buffers should be. For OpenLog the TX buffer needs to be very small (nearly 0) and the RX buffer needs to be as large as possible. Using these two libraries together we can greatly increase the performance of OpenLog.


The following are outdated instructions for updating firmware version 2

From time to time there will be new features released for OpenLog. These instructions will guide you through how to update the firmware using an FTDI Basic and the Arduino v0022 IDE. Note that Arduino v1.0 is not yet supported.

  1. Get an FTDI Basic and a crossover board
  2. Download a new copy of the Arduino IDE version 0022 into a different directory than your normal Arduino installation. For example ‘c:\arduino-0022-openlog\’. Note that Arduino v1.0 is not yet supported. Please use v0022.
  3. Download the OpenLog firmware either directly here or by checking out the repository (more advanced and not necessary for more people)
  4. Replace the file located here: C:\arduino-0022-openLog\hardware\arduino\cores\arduino\HardwareSerial.cpp with the HardwareSerial.cpp found in the OpenLog firmware zip file that you just downloaded. More information below.
  5. Open the OpenLog_v2 sketch in this special version of Arduino-OpenLog and compile. (If you experience problems, make sure that Arduino isn’t referencing a newer SdFat library in your home/Arduino/libraries folder)
  6. Connecting the FTDI Basic, then the crossover board, then the OpenLog
  7. Select the “Arduino Pro or Pro Mini 5V/16MHz w/ ATmega328” under the Arduino Boards tab
  8. Select the right COM port to connect to the FTDI Basic
  9. Upload the code
  10. High five your nearest neighbor

Why do I need a crossover board? aka Why in the world did you do mess up TX and RX like that?
Most of the data logging projects (such as logging the temperature of your compost pile over 3 months) take place away from a computer. Therefore, OpenLog will probably not be connected to a computer – instead, it will likely be connected to a microcontroller. We made OpenLog so that it can plug directly onto an Arduino Mini Pro.

Why am I replacing the HardwareSerial.cpp?
The HardwareSerial.cpp file controls how the serial receive interrupt is handled. OpenLog has to receive characters as fast and as cleanly as possible so OpenLog has its own serial receive interrupt. Be sure not to confuse your normal installation of Arduino with this modified form of Arduino only to be used for OpenLog compiling. Compiling regular Sketches using this special version of Arduino will drive you mad because the serial interrupts will not work.


The following are outdated instructions for updating firmware version 1

Here is the instructions for loading the much older Version 1 OpenLog firmware:

Version 1:

  • Is currently the most stable
  • Works with cards up to 2GB
  • Works only with FAT16
  • Doesn’t drop characters at 57600
  • Requires these instructions and steps to update the firmware

Version 2:

  • Known to be buggy
  • Works with cards up to 8GB
  • Works automagically with SD, SDHC, FAT16 and FAT32
  • Drops characters at 57600
  • Easy to update firmware through Arduino, loading as a sketch
  • The Arduino IDE makes it much easier for folks to make changes

Once you get setup to flash OpenLog, it’s so easy and quick, you’ll be developing faster than ever before. But it does take some work up front.

Most general way:

Make a correct connection between the PC and the openLog: Get a MAX232, and connect it to the openlog, find a PC with RS232 port, either an old desktop PC or use some USB to Serial adapter. Link the RX, TX and GND of these components toghether following the pinout indicated by the datasheets (pay attention the the cables and on-the-fly cabling).

Once you get this setupped, take “putty” (or any other simple terminal program, putty is without install) and look for the real/emulated serial port at which COMx happened to be allocated, set the speed at 9600bps (defauld one) and make the connection. Hit some times ctrl+z (depending on the firmware 1 or 3 should be enough) at some time you should get “>” which is the prompt; press “?” plus enter and you should get the menù.

Now, to flash the new firmware, put in the same directory the file avrdude.conf, avrdude.exe, libusb0.dll and main.hex (you can find them downhere in the page). Open a command prompt and cd-your way to this folder. Write on the command line (cut and paste) this line:

avrdude.exe -p atmega328p -P COM1 -c stk500v1 -b 57600 -Cavrdude.conf -U flash:w:main.hex

but DO NOT press enter.

Now, be sure the openLog is connected the the pc via the setup done before and ower it down, now you have a window of 500ms (an eternity in computers) where you have to 1)power up the openLog 2)hit enter at the command prompt to issue the reflash command.

If the timing is right, the flashing process is started and you should read some fancy words and some “###” running inside the command line window.Good! after to process is terminated (no more than 30 seconds) you can power cicle the unit and reconnect via terminal program, and check with the “?” command the new version.

If your timing was not right, simply, powerdown the unit, reload the command on the command line and repeat the procedure until you succeed. I’m not assuring, but it’s really higly unlikely that you can damage the unit while you try to reflash.

STK500 Bootloading method

This comes from the SparkFun tutorial on STK500 bootloading under the Serial bootloading an Arduino board section.

I’m sorry, I use Windows, so much of this will be oriented for WinAVR, Programmer’s Notepad, and avrdude compiled for Arduino 0017 for Windows.

Things you will need:

  • OpenLog
  • Serial connection – we recommend the FTDI Basic as it is the easiest to hook up over USB
  • Power – pull power from an Arduino or from a Breadboard with Power Supply
  • Wires – Strip some wire and jam it into the breadboard

The steps to upload new firmware to OpenLog:

  1. Download avrdude.exe, avrdude.conf, libusb0.dll and the latest firmware HEX (right click and save-as) from the Downloads page. Stick these files into an easy to navigate directory like C:\openlog.
  2. Wire up the serial connection. Remember TX from the FTDI Basic goes to the RX pin on OpenLog. Read more in the datasheet.
  3. Attach the contraption to your computer over USB and turn on the power. You will need to check the Device Manager to find out which one it is on. Remember this COM port number. (Grr, this needs a tutorial)
  4. Now open up a terminal on that COM port with the correct baud rate – the default for OpenLog is 9600bps. I use hyperterminal in Windows XP but Vista doesn’t have a terminal program (way to go Microsoft!) so you may want to check out TeraTerm Pro (just download it).
  5. Once you have the terminal open, you should see ‘12<’. Good! This means that OpenLog is open for business and ready to receive characters. If you don’t see these characters, check that TX and RX are correctly wired. Make sure you have LEDs turned on, if not check your power connections.
  6. Once you’ve proven your serial connection, close the terminal window. You can’t have a connection open while you run avrdude.
  7. Open a command prompt in windows (click Start, then Run, type ‘cmd’ and press enter)
  8. At the command prompt type:
    c: Enter
    cd\openlog Enter
    avrdude.exe -p atmega328p -P COM3 -c stk500v1 -b 57600 -Cavrdude.conf -U flash:w:main.hex Enter
    If you get a can’t open device COM3 error then you have the wrong COM port selected. Replace COM3 with COM(whatever your com port number is). You should see something like:
    Writing | ################################################## | 100% 13.17s
    avrdude.exe: 22836 bytes of flash written
    avrdude.exe: verifying flash memory against main.hex:
    avrdude.exe: load data flash data from input file main.hex:
    avrdude.exe: input file main.hex auto detected as Intel Hex
    avrdude.exe: input file main.hex contains 22836 bytes
    avrdude.exe: reading on-chip flash data:
    Reading | ################################################## | 100% 9.73s
    Yay! You’ve upgraded OpenLog
  9. Once the complete, open up a terminal again, open the COM port and you should see ‘12<’. Good. Press ctrl+z three times to drop to command mode. Now type ‘?’. This will bring up the help menu and will display the version of OpenLog firmware at the top. Something like OpenLog v1.51. Congrats! You’re done!

The major things to know:

  • If you don’t have FTDI Basic or the DTR trick, manually reset OpenLog and catch the bootloader at power up. Press return at the command prompt at the same time you power up OpenLog. avrdude should then begin the download. Either power cycle your breadboard or pull/insert one of the power lines (VCC or GND) and OpenLog should reset and then wait for bootload command for a fraction of a second.
  • avrdude.exe compiled for Arduino 0017 has the DTR line wiggle built in. Toggling DTR causes Arduinos, and OpenLog to reset. I do not believe the stock avrdude has this feature built in. Therefore, you will need to use the avrdude that comes with Arduino.
  • In any case you should have a very recent version of avrdude to support the processor. Check for updates.
  • Some users have reported that libusb0.dll needed to be put inside the Win32 directory. Please let us know if this is required for you or not.
  • avrdude for linux doesn’t do the DTR toggle so you will have to reset manually.
  • If avrdude says it doesn’t recognize the AVR type you also need to get the avrdude.conf file from Arduino in order to support ATmega328.

From a Windows setup, Programmer’s Notepad outputs:
> "make" program_serial
C:\arduino\hardware\tools\avr\bin\avrdude -p atmega328p -P COM3 -c stk500v1 -b 57600 -CC:\arduino\hardware\tools\avr\etc\avrdude.conf -U flash:w:main.hex

For linux, the line is:
avrdude -p atmega328p -P /dev/ttyUSB0 -c stk500v1 -b 57600 -U flash:w:main.hex

Replacing the trailing -U flash… with -t you can enter a “terminal mode” which can diagnose some problems. See the avrdude documentation for more details.

If you try to flash your OpenLog and get this error:

>"make" program_serial
D:\software\Arduino\arduino-0017\arduino-0017\hardware\tools\avr\bin\avrdude -p atmega328p -P COM18 -c stk500v1 -b 57600 -V -CD:\software\Arduino\arduino-0017\arduino-0017\hardware\tools\avr\etc\avrdude.conf -U flash:w:main.hex
avrdude: ser_open(): can't open device "COM18": The system cannot find the file specified.
make: *** [program_serial] Error 1
> Process Exit Code: 2
> Time Taken: 00:00

In the command above the COM port is COM18. On some computers the FTDI COM port will be assigned high numbers that will not work with the avrdude. Open the Device Manager on your Windows machine and find the COM port. Assign another number COM port number less than 10 like COM3 for example. Override the port if already in use but make sure you do not have any other devices connected to it (like a cable plugged in to a COM port).

OpenLog Wiki Pages:

Something went wrong with that request. Please try again.