Using the ATmega1284P with the Arduino IDE & WIZ820io

If your project runs out of resources, be it IO, RAM or flash when using the ATmega328 found in the standard Arduinos you might think of upgrading to the very well endowed ATmega2560P as used in the Arduino Mega but as maniacbug points out there is another option that might make more sense in a lot of situations, the ATmega1284P.   Compared to the 328P the 1284P has 9 more digital IO pins, 2 more analogue pins, an extra interrupt, an extra UART and 3K more EPROM but where it really shines is the 128K flash (compared to 32K on the 328P) and a huge 16K of RAM, dwarfing the 2K on the 328P and even beating the 2560P with its 8K. It isn’t hugely more expensive than a 328P either and quite a bit cheaper than a 2560P.

I’d had this in the back of my mind since maniacbug’s post, especially when I hit RAM issues when building my Nanode based web based infrared remote control but I needed ethernet for that and although I considered using a spare W5100 ethernet shield I’ve got I never got round to it.  Recently however the new Wiznet WIZ820io SPI ethernet module (W5200 based) kept cropping up and after seeing @andrewdlindsay and @stuartpoulton mentioning their work on a 1284P based board using the WIZ820io I had to have a play.  They aren’t the easiest things to get hold of in the UK yet but I was lucky enough to find someone selling a few on eBay for £19.95 posted so snapped one up.

Getting it all running is very easy.

First off, grab maniacbug’s mighty-1284p core for the Arduino and unzip it into a directory named hardware in your sketchbook location, eg. ~/sketchbook/hardware/mighty-1284p/

Start the Arduino IDE and you will find some new entries under the Tools > Board menu. The one we are interested in is “Mighty 1284p 16MHz using Optiboot

 

Bootloader

The next thing we need to do is get a bootloader onto the 1284P, I used an Arduino as an ISP programmer for this as I do with the ATtiny, just connect it up as below:

Arduino ATmega1284P
5V Pin 10
GND Pin 11
D10 Pin 9
D11 Pin 6
D12 Pin 7
D13 Pin 8

You will also need a 16MHz crystal across pins 12 and 13 with a 22pF ceramic capacitor from each of those to ground.

Load the ArduinoISP sketch (the example one supplied with Arduino 1.0.1 now seems to work OK) onto your Arduino then go to the Tools > Board menu and set the board as “Mighty 1284p 16MHz using Optiboot” then use Tools > Burn Bootloader to burn the bootloader to the 1284P.

You can disconnect the Arduino now but leave the crystal and caps connected.

 

Loading sketches

Now we need an FTDI connector for uploading sketches to the chip, connect a 6 pin header as follows:

FTDI ATmega1284P
DTR Pin 9 via 0.1uF capacitor
& a 10K pull up between
the capacitor and pin 9
RXI Pin 15
TXO Pin 14
VCC Pin 10 & Pin 30
CTS Not used
GND Pin 11 & Pin 31

Also stick a 0.1uF capacitor across VCC and GND. If any of that isn’t clear you can also refer to maniacbug’s schematic. I note he has the FTDI CTS pin tied to ground as well but I’ve never found that necessary with either of my FTDI leads and have always left it unconnected.

Connect an FTDI lead/adapter and you can now upload a sketch in the normal manner. Note the pin mappings for the IO pins is shown on maniacbugs blog post.

You might notice in my picture something different on the FTDI connection, I’m actually using a little board I made for one of my previous projects, it has a 3V3 regulator and smoothing caps plus the capacitor and pull up resistor required for the reset line. I only used it because it was handy and because I need 3v3 for the WIZ820io anyway. If you wanted to make one it is the small board in the left of this stripboard layout (note the pins change order on the output), it’s proved useful for quick prototyping a number of times.

 

The WIZ820io SPI ethernet module

This is where we need 3V3, the WIZ820io module does have 5V tolerant IO but it needs to be powered from 3.3V so you will need either a 3V3 FTDI lead, some sort of regulator setup like I have used or use a regulator to power the 820io module.

Other than that it’s very easy, connect up as follows:

WIZ820io ATmega1284P
GND GND
VIN 3.3 3V3
nSS Pin 5
MOSI Pin 6
MISO Pin 7
SCKJ Pin 8

You can use the standard Arduino ethernet library by swapping a couple of files but this sounds messy to me, better to use this modified version. That’s it, I said it was easy!

 

5 thoughts on “Using the ATmega1284P with the Arduino IDE & WIZ820io

  1. Hello, first of all thank you for sharing knowledge. The part based in Wiz 5200 seems hard to find. One distributor in a neighbour country to us have one module based in the Wiz 5300. Do you think it can work with the clone of this project I am thinking.
    Thank you in advance

  2. Hi Nathan, there seems to be a groundswell of interest in this module, but as you say – they’re a bit tricky to get hold of. I couldn’t find any in the UK when I looked a couple of months ago, but HobbyTronics ordered some in and I’ve now had a first play with mine. You did better than me on price though 😉

    Cheers, Stu

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.