Build a simple Webserver with Pollin AVR-NET-IO using the Arduino software stack

0. Programmer

I'm using an Arduino as ISP to flash the webserver to the AVR-NET-IO. See my previous post Dump ATMEGA32 on AVR-NET board using avrdude for how to convert the Arduino to a programmer and how to wire the connections between the Arduino (programmer) and the AVR-NET-IO. Do not connect AVR-NET-IO's own power source when it is connected to the Arduino (programmer).

1. ATmega32

The AVR-NET-IO uses the ATmega32 microcontroller about which the Arduino IDE does not know anything. Thankfully, Eric Conner has written a definition file for the ATmega32 needed by the Arduino IDE.

1.1. Download definitions from https://github.com/eaconner/ATmega32-Arduino and follow the instructions to install the mega32 variant files.

1.2. Patch the pins_arduino.h file to contain the following additional lines:

static const uint8_t SS   = 4; // D4
static const uint8_t MOSI = 5; // D5
static const uint8_t MISO = 6; // D6
static const uint8_t SCK  = 7; // D7

I have the file in the following directory:

%USERPROFILE%\Documents\Arduino\hardware\mega32\variants\mega32\pins_arduino.h

2. ENC28J60 network chip

The Pollin board also contains an ENC28J60 network chip. This cannot be addressed by the Arduino Ethernet library directly but there is a wonderful replacement library available from Norbert Truchsess at

https://github.com/ntruchsess/arduino_uip

Install the library as described in the installation instructions on the above link.

I have the library files in the following directory:

%USERPROFILE%\Documents\Arduino\libraries\UIPEthernet

e.g. the file %USERPROFILE%\Documents\Arduino\libraries\UIPEthernet\Dhcp.cpp

3. Webserver

3.1. Start Arduino IDE, open from the menu Examples / Ethernet / WebServer .

3.2. Change the include directive

#include <Ethernet.h>

to

#include <UIPEthernet.h>

4. Compile and Upload

4.1. In Arduino IDE menu select: Tools / Programmer / Arduino as ISP

4.2.  Select Tools / Board / ATmega32-External 16MHz

4.3. File / Upload using Programmer (this sometimes aborts with error message "Not int sync". Simply give it a second try.

4.4. Make sure to disconnect the Arduino (programmer) from the AVR-NET-IO before you connect AVR-NET-IO's own power source.

Leave a Reply