ATmega1284p & Arduino as ISP

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, don't hate on the Arduino as ISP. I have a "real" STK500 compatible programmer on the way from Sparkfun. So I've had some fun over the past couple of days. This is my first board that I've designed. I've etched it myself. It is awesome. I want to make sweet love to its IC sockets. After some hair tearing I figured out enough to get the Arduino as ISP to recognize and read from the 1284p. However it is giving me the ident code for the 328p. I got the chips from Digikey, I have two and I tried both. My digikey invoice reads:

ATMEGA1284P-PU-ND 8.13000 16.26 T
MCU AVR 128K ISP FLASH 40-PDIP

I wouldn't think Digikey would get non-legit parts.

So I did a -F and tried to write the bootloader to flash, it went through and did the write OK but when it ran the verify it found first mismatch at byte 0x000 0xff != 0x0c

Fuses OK.

Any ideas?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Such an idiot. The Duemillanove I am using has a 328P in it. But why is it reading the chip in the Duemillanove and not the 1284p?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK So I pulled out an Uno Meg2560 and I've hooked ICSP to ICSP with a short ribbon cable. I have a 10k resistor on the Arduino as ISP 5v/Reset(a Duemilanove with a 328p). I am using the most up to date avrdude. I have the baud set down to 19200 to talk to the Mega.

Without the resistor on the reset I get an address of 0x7fffff. With the resistor I get 0x0000ff. Expected is 1E 98 01.

My command is: > avrdude -p m2560 -P com9 -c avrisp -b 19200 -n -v

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is absolutely nothing wrong with using an Arduino to ISP external boards.

However you do need to make up your mind what you are doing.

There are several tutorials with pictures that show how to use a Duemilanove as a programmer.

Edit:corrected the programmer_type

avrdude -c stk500v1 -P com9 -b 19200 -p ATmega1284P

Do you get Unos with a mega2560 ? I thought they were only mega328P

If you use avrdude with a Duemilanove at 57600 baud you will talk to the ATmega328P bootloader not the ISP application.

The order of avrdude arguments does not matter. It does matter that you give the correct arguments.

David.

Last Edited: Thu. Jan 19, 2012 - 07:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm. Yeah I'm thinking I just flashed the 328P with the bootloader for the 1284P? I can still upload sketches to it but it is no longer functioning as an ISP.

I cranked the baud to 57600 because in one of the conf files I saw that the 1284p was flagged as -dbaud 57600. I assumed this meant the default baud rate for this particular chip was 57600. I changed the baud rate in the Arduino as ISP sketch to 57600 as well.

I haven't yet gotten any working response out of the arduino when I flag it as -c arduino. The only time it works at all is with -c avrisp.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh and yes, they do make an Uno version of the mega. Or at least one that has the new board graphics that the Unos come with...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Damn, I think I just shot my self in the foot by forcing a flash before I knew what was going on... that was my only 328p chip too. Everything else I have is Uno and the ISP sketch doesn't work with them. I guess I'll have to wait until I get my programmer in the mail tomorrow. Nuts.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have edited my earlier post. (had mistyped the -c type)

The ISP application runs at 19200 baud.
Bootloaders tend to run at faster baud rates.

Your target board must be connected as in the ArduinoISP tutorial.

You cannot harm your Arduino. It cannot overwrite its own bootloader (unless you connect to the 6-pin header)

Bear in mind that your new pcb may have a wiring mistake. What messages do you get from ArduinoISP sketch?

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I have already found a wiring mistake and did a quick hack job on it. That's why I busted out the Mega, to make sure the problem was with the new board and not with the programmer. Good to know I didn't fubar my 328p.

I changed the baud rate of the ISP sketch to 57600. I have now reset it to the default 19200. I haven't wired it exactly as they do in the ISP tutorial, instead I have used the ICSP header. The pins they use are equivalent are they not? I just remembered I built a TinyISP the other day so I could have flashed the 328p back if I needed to...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm. So this is the Atmega1284-P-PU. It's speed is listed at 20Hz on the Digikey site. Does that mean it's max speed is 20Hz or that this 16Hz crystal I have in the circuit could be causing me problems?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I haven't wired it exactly as they do in the ISP tutorial, instead I have used the ICSP header.

No, they are different. God invented tutorials (with pictures) so that people could follow them.

If you want to develop your own theories of life, the universe and everything, go for it. Just do not expect help.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David - I am not running it from the Arduino IDE, I am running avrdude from the command line.

I just pulled out a SPANKING new, just cracked the seal MEGA ADK. I plugged it up, and now I don't have to hit the reset button anymore before I try to read, the built in LED on 13 just stays lit? It also gives me a different device signature each time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MISO->MISO , MOSI->MOSI, SCK->SCK, SS !-> SS, instead it goes to RESET on the board being programmed.

I did check the MISO, MOSI, SCK pins when I started out to make sure they were going straight through so that I could use the ICSP header (mainly because on the board I built I don't have headers for the pins so there wasn't an easy way to run jumpers, the ICSP header seemed the logical choice...). I will try working up something.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David -- That got it. I used the ribbon cable to connect to the ISP header on my board and then ran some jumpers out of there to the Arduino. Your help is much appreciated!