Pages

Nanode gets new boots

I’ve been playing around with a couple of Nanode boards for a while now after having an early beta version. Check out the link for full details and specs. The latest version has a few options and I am using one in standard form to connect my CurrentCost electricity monitor to my local lan to broadcast updates. The second Nanode has been modified to use 3.3V instead of 5V and to include the 32K SRAM chip on the underside of the board. This then enables the Nanode to have a lot more storage space than is currently available on the Atmega328 and to also be able to work with a MicroSD card without having to include level shifting resistors.

One frustration I have found with the stock bootloader included with the Nanode kits is that there is no indication that anything is happening when you are uploading a new sketch. The first thing I wanted to do was fix this. I’ve based my updates on the Arduino Optiboot boot loader as this has been cut down and optimised for the Arduino by shrinking its code size and increasing the upload speed, amongst other things.

The Optiboot code allows a LED to be flashed upon restart and to be flashed when data is being transfered. As the existing code was configured to use the Arduino LED on digital I/O pin 13, it was a simple matter of changing the defines for the LED pin.


// nanode LED connected to PD6 - I/O 6
#define LED_DDR DDRD
#define LED_PORT PORTD
#define LED_PIN PIND
#define LED PIND6

Make sure that the line #define LED_DATA_FLASH is not commented out too.

Using a modified makefile to compile the code using WinAVR produces a .hex file that can then be burnt into the Atmega328.

To integrate the bootloader into the Arduino IDE its a matter of creating the nanode directory in the sketchbook/hardware/ directory. The directory tree should be like this:


sketchbook
+--hardware
   +--nanode
      +--bootloaders
      |  +--nanodev5
      +--cores
      |  +--Arduino
      +--boards.txt

The bootloader .hex file is in the nanodev5 directory, the cores/Arduino contains a copy of all the files from arduino-0022hardwarearduinocoresarduino.

The boards.txt would look like this:

# Optiboot Nanode support
# based on Optiboot from http://optiboot.googlecode.com by Peter Knight, 2010
#
# Nanode support by Andrew Lindsay
##############################################################

nanodeatmega328o.name=[Nanode] Nanode V5 w/ ATmega328
nanodeatmega328o.upload.protocol=stk500
nanodeatmega328o.upload.maximum_size=32256
nanodeatmega328o.upload.speed=115200
nanodeatmega328o.bootloader.low_fuses=0xff
nanodeatmega328o.bootloader.high_fuses=0xde
nanodeatmega328o.bootloader.extended_fuses=0x05
nanodeatmega328o.bootloader.path=nanodev5
nanodeatmega328o.bootloader.file=optiboot_nanodev5.hex
nanodeatmega328o.bootloader.unlock_bits=0x3F
nanodeatmega328o.bootloader.lock_bits=0x0F
nanodeatmega328o.build.mcu=atmega328p
nanodeatmega328o.build.f_cpu=16000000L
nanodeatmega328o.build.core=arduino

############################################################

If all is well then you should see a new board, [Nanode] Nanode V5 w/ ATmega328 on the IDE Boards menu.

You should now be able to burn the bootloader from the Arduino IDE using your preferred programmer.

I’ll get round to packaging this up for the benefit of those that dont have te AVR toolchain installed and are not able to compile their own boot loaders. However, you’ll still need a programmer such as the USBTinyISP, in order to burn it into your Atmega328.

Did I mention the extra RAM? What can it be used for? With a modified bootloader it should be possible to upload code to the SRAM and trigger a reset that then causes the bootloader to check for a valid code image and program the sketch as if it had been received through the serial interface. I already have a simple upload sketch that uses TFTP to transfer a .hex file and writes it into the SRAM. More about this later…

икониПравославни икониикони на светци

Bookmark this post: bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

2 comments to Nanode gets new boots

  • Hi Andy, I’ve enjoyed reading your blog lately. I’ve also done some initial planning and research for an Arduino Ethernet Bootloader for the Nanode and Arduino Ethernet – based on the code recently posted to GitHub by Massimo Banzi on the Arduino Developers Mailing List. We will be keeping design notes at http://wickedboot.wickeddevice.com. I’d really like to collaborate with you if you’re interested, especially on the Nanode side of it. Shoot me an email at victor (dot) aprea (at) wickeddevice (dot) com.

    Cheers,
    Vic

  • saturno

    Hello Andy,

    A Google search brought me to this page (and that’s not the first time it happened ;-))
    I was searching if anyone have successfully hooked up a CurrentCost energy monitor to a Nanode; surprise, surprise – it has.

    For about a year and half, I have my CurrentCost connected to “The Bridge”.
    As you know this is a rather static configuration, because “the bridge” could not be (easily) re-configured to upload the data to whatever-service it’s owner wants. (Yes, I already read your post about re-proposing the bridge. Until now I wouldn’t want to go that way…)

    So, I’m trying to create a weather station to be placed outside my house to log temperature, humidity and pressure. This will transmit the data to a Nanode inside the house that probably could receive the CurrentCost data.
    Can you give some hints about connecting the CurrentCost to a Nanode?

    Regards,

    Luis