Project:Nanode/Applications: Difference between revisions

From London Hackspace Wiki
Line 40: Line 40:
Arduino: File > Examples > EtherShield_DHCPTest
Arduino: File > Examples > EtherShield_DHCPTest


4.1 In the source code, change MAC address to something random :) e.g. change the last two digits "??" to the two digit number written in pen on the bottom of your Nanode:
*In the source code, change MAC address to something random :) e.g. change the last two digits "??" to the two digit number written in pen on the bottom of your Nanode:
   static uint8_t mymac[6] = {0x54,0x55,0x58,0x5F,0x01,0x??};
   static uint8_t mymac[6] = {0x54,0x55,0x58,0x5F,0x01,0x??};
4.2 On line 57, change es.ES_enc28j60Init(mymac); to es.ES_enc28j60Init(mymac,8);
*On line 57, change
  es.ES_enc28j60Init(mymac); to es.ES_enc28j60Init(mymac,8);


===EtherShield Library and Examples===
===EtherShield Library and Examples===

Revision as of 15:21, 4 June 2011

Testing Nanode

The ATmega328 microcontroller supplied with the kit has a specially modified version of the Arduino bootloader pre-programmed into it.

Arduino usually has a LED wired to Digital pin 13, but in Nanode, digital 13 is in almost constant use as the SPI Clock.

So in the Nanode bootloader, the LED flashing function has been altered so that it flashes the red LED which is wired to digital pin 6.

If all is well with your Nanode board, the Red LED should start flashing about 2 seconds after the power (from USB or FTDI cable) has been applied.

If it does not flash, check for faults such as missing soldered joints or the LED incorrectly inserted.

Applications

Quick Tutorial- 4/6/11.

1. Download and Install Arduino Environment http://arduino.cc/en/Main/Software Mac users: mount the dmg and drag arduino into Applications folder. Windows users: open the arduino-0022 folder and run Arduino.exe Linux users: open the arduino-0022 folder and run ./arduino

2. Download FTDI Cable Drivers

Plug in the FTDI programming cable.

  • Windows users: When prompted to install drivers, point the installer to the arduino-0022/drivers directory
  • Mac users: mount the arduino installation dmg and double click on the FTDI install package at the bottom of the window.
  • Linux users: if you are using a 'modern' ubuntu or debian install (from my experience) the FTDI cable should be plug and play, type dmesg into terminal to check for the device mount point, mine is: /dev/ttyUSB0

3. Download EtherShield Libraries

Download here: https://github.com/Nanode/EtherShield

  • Change the downloaded folder name to "EtherShield" and place in Arduino/libraries/ folder
  • Mac users: make a folder called "libraries" in Documents\Arduino\ then place the EtherShield folder into the newly created libraries folder.
  • Windows users: place the EtherShield folder into arduino-0022\libraries\
  • Linux users: place the EtherShield folder into arduino-0022\libraries\ (or /usr/share/arduino/libraries/ ?)

4. Run the EtherShield_DHCPTest

Arduino: File > Examples > EtherShield_DHCPTest

  • In the source code, change MAC address to something random :) e.g. change the last two digits "??" to the two digit number written in pen on the bottom of your Nanode:
 static uint8_t mymac[6] = {0x54,0x55,0x58,0x5F,0x01,0x??};
  • On line 57, change
 es.ES_enc28j60Init(mymac); to es.ES_enc28j60Init(mymac,8);

EtherShield Library and Examples

First you need to download and install the EtherShield library from GitHub

https://github.com/thiseldo/EtherShield

Make sure you have Arduino 0021 or better still 0022 installed.

(Remove any previous version of Ethershield library - as this causes code compilation problems).

Note:

To get the EtherShield examples to work you will have to edit the enc28j60 init function to read.

ES_enc28j60Init(mymac,8);

In the webserver example this can be found on line 48.