Tuesday, July 24, 2012

More playing with arduinos.  I bought an Etherten which I plan to use for my data logger project.  It has pretty much all I need on a single board apart from the wireless interface.  I managed to source a board with a Nordic nRF905 on it for the wireless - this is the same chip used in the little monitoring display that was supplied with the solar inverter, it talks using SPI so there should be a good chance of getting it going with the arduino.

The first step was uploading sketches to the Etherten.  This proved more difficult than I thought it would be after getting the leostick working.  The Etherten steadfastly refused to be programmed in NetBSD (in Windows it was fine...).  I tried updating the firmware for the usb->serial bridge chip by mostly following the instructions https://andrewmemory.wordpress.com/2011/04/14/upgrading-the-arduino-uno-8u2-using-flip/ though I just used the raw button to get the file down and had to hold the main reset down and then short the bridge chip reset to get it into programming mode.  That didn't help me.  Next I tried updating the bootloader using optiloader on the leostick, I had to patch the optiloader code:
--- optiloader.ino      2012-07-18 20:53:16.000000000 +0930
+++ ../optiLoader.pde   2012-07-18 20:51:49.000000000 +0930
@@ -50,15 +50,6 @@
 //     9 to power more complex Arduino boards that draw more than 40mA, such
 //     as the Arduino Uno Ethernet !
-// For a leostick the pins are:
-//  0: slave reset (arbitrary allocation)
-// 14: MISO
-// 15: SCK
-// 16: MOSI
-// The pins are only available on the ICSP header, this header
-// also supplies the power to the other board too.
 // If the aim is to reprogram the bootloader in one Arduino using another
 // Arudino as the programmer, you can just use jumpers between the connectors
 // on the Arduino board.  In this case, connect:
@@ -98,11 +89,11 @@
  * Pins to target
-#define SCK 15
-#define MISO 14
-#define MOSI 16
-#define RESET 0
-#define POWER 1
+#define SCK 13
+#define MISO 12
+#define MOSI 11
+#define RESET 10
+#define POWER 9

 // STK Definitions; we can still use these as return codes
 #define STK_OK 0x10

This is due to the leostick not having the programming pins in the "normal" arduino place.  I made up a cable and managed to program the Etherten bootloader but still no joy.  While I was mucking around with this I also found an usb-asp on ebay which is an in circuit programmer for atmel chips which happens to be what the arduinos use.  The programmer and a 10 to 6 pin adaptor came to less than $7 including postage so I bought those.

The good news is that the usb-asp works fine under NetBSD with the native avrdude, I can upload sketches to the Etherten no problems.  Avrdude is complaining that the usbasp needs a firmware update which is another adventure.  I have loaded up the AVRisp sketch onto the leostick but I need to make a cross-over adaptor to connect my cable to the usbasp cable, then I can update the firmware.

No comments: