Creating your own Wiring board with a DIP atmega1284p using Duemilanove

From Wiring

Jump to: navigation, search

Note that you do this at your own risk. I don't take any responsability for the use of the information given here.

This page describes how to setup a breadboard with an atmega644p or atmega1284p microcontroller, using an Arduino Duemilanove board as bootloader burner and sketch uploader. You don't really need a Duemilanove, you can use any Wiring or Arduino board (even another breadboard with a microcontroller). You only need to locate the SS, MISO, MOSI and SCK pins of the board/microncontroller, and connect them as described here.

Here [[1]] is another tutorial equal to this one (I recommend reading it as it has more explanations), using a Wiring board as programmer and an atmega328p as target device.

You can also program any AVR microcontroller that is supported by Wiring. See the list in the menu Tools->Board->Atmel.

The setup of the microcontroller involves two steps: burning the bootloader (done once) and uploading a sketch (done every time you want to change the program in the microcontroller)

Each of the two steps involves a different connection scheme between the programming (host) board and the target microcontroller (the one to be programmed). It is important that in the second step you remove the microcontroller from the Arduino board, so that the FTDI USB chip can talk directly to the target microcontroller.


First step: Burning the bootloader

This is the first circuit.

Bootloading1284PwithDuemilanove.png

Here are the connections to be made beetween the host Duemilanove (with Arduino pin numbering) and the target atmega1284p (in DIP pinout, not Wiring numbering).

Duemilanove atmega1284p
10 (SS) yellow
9 (RESET)
11 (MOSI) green
6 (MOSI)
12 (MISO) purple
7 (MISO)
13 (SCK) orange
8 (SCK)
Vcc (5V)
pins 10 and 30 (Vcc)
GND (0 V)
pins 11 and 31 (GND)


Once you've got your circuit connected, connect the USB to the Duemilanove and open the Wiring IDE:

1 - Open the sketch from menu File->Sketchbook->examples->Basics->Wiring ISP

2 - Select the serial port.

3 - Select the Duemilanove to program the ISP sketch in menu Tools->Board->Arduino->Arduino Duemilanove (or the board you're using as host)

4 - Compile and upload the sketch to the Duemilanove.

5 - Select the target micro to be burned. In this case, an atmega644p or an 1284p in Tools->Board->Atmel

6 - Burn the bootloader: menu Tools->Burn Bootloader->w/Wiring ISP

After a while the console will (hopefully) display a "Done burning bootloader" message.


Second step: Uploading sketches

Remember that for this step you must remove the microcontroller from the host board. You can later put it on again if you need it later (keep note of wich side is the mark at one of the ends)

This is the circuit. Note that it has less connections than the previous one. You can make a connector for the host board that is easy to connect to the breadboard or circuit where you have the target microcontroller, as you will be uploading sketches a lot of times.

I'm doing the classic test of blinking a LED. You will need a 330 ohm resistor, and a LED. And for the reset: a switch and a 10 KOhm resistor. The reset is optioinal, though: you can connect directly the RESET pins on both boards, and use the reset switch on the Duemilanove to reset the microcontroller before uploading the sketch.

UploadingSketchesTo1284P.png

Here are the pinouts, in the same numbering as before:

Duemilanove atmega1284p
0 (RX)
14 (RX)
1 (TX)
15 (TX)
Vcc (5V)
pins 10 and 30 (Vcc)
GND (0 V)
pins 11 and 31 (GND)


To use this setup:

1 - Load the sketch at File->Sketchbook->examples->Basics->Digital Output->LEDBlink

2 - Edit the pin used to control the LED. In this case, change the line "int ledPin = 8;" by "int ledPin = 15;". The pin 15 as defined by Wiring is the pin 29 in the DIP chip.

3 - Select serial port

4 - compile and upload the sketch, you will have to push the reset button just at the same time.

Then... you should see the led blinking!


Here is the correspondence between physical pins of the microcontroller (either atmega644p or atmega1284p) and the numbering of the pins in Wiring for this chip. Note that the analog pins have pin number as well as A + number (i.e. A0 to A7). Also the pins that can output PWM signal are marked.

Wiring pin atmega644/1284 pin
Has PWM?
0
14

1
15

2
16

3
17

4
18
PWM
5
19
PWM
6
20
PWM
7
21
PWM
8
22

9
23

10
24

11
25

12
26

13
27

14
28

15
29

16
1

17
2

18
3

19
4
PWM
20
5
PWM
21
6

22
7

23
8

24 A0
40

25 A1
39

26 A2
38

27 A3
37

28 A4
36

29 A5
35

30 A6
34

31 A7
33

Author: Juan Jose Luna Espinosa

Personal tools