Pages: [1]   Go Down
Author Topic: USING Arduino Micro (ATmega32U4) as ISP  (Read 1938 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,
I have a from-the-factory 328P on a breadboard. (I also have a couple seemingly unresponsive 328Ps with the Uno bootloader.) I also have an Arduino Micro (with the 32U4) with ArduinoISP loaded to it.

It's not working.

I get
Code:
avrdude: Device signature = 0xffffff [or 0x000000, sometimes]
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
and sometimes
Code:
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as FF
avrdude: safemode: efuse reads as 7

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as FF
avrdude: safemode: efuse reads as 7
avrdude: safemode: Fuses OK
regardless of whether the 328P is connected to the SS, MI, MOSI, SK pins on the Micro board or the 10, 11, 12, 13 pins on the Micro board or nothing at all. So I'm thinking the ArduinoISP code is not set up to use the 32U4 correctly.
Or else I'm using avrdude wrong, but I get the same error when I try burn the bootloader from within the Arduino IDE, so I don't think it's that.

What should I do? Thanks!
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I successfully ran my "board detector" sketch on the Micro.

Described here:

http://www.gammon.com.au/forum/?id=11633

Photo:



I connected the ICSP headers together except for the reset wire as described on the page above. That (the purple one) was plugged into D10 on the Micro.

Results (when plugged into the Uno as the target device):

Code:
Atmega chip detector.
Entered programming mode OK.
Signature = 1E 95 0F
Processor = ATmega328P
Flash memory size = 32768
LFuse = FF
HFuse = D6
EFuse = FD
Lock byte = CF
Clock calibration = 83
Bootloader in use: Yes
EEPROM preserved through erase: Yes
Watchdog timer always on: No
Bootloader is 512 bytes starting at 7E00

Bootloader:

7E00: 11 24 84 B7 14 BE 81 FF F0 D0 85 E0 80 93 81 00
7E10: 82 E0 80 93 C0 00 88 E1 80 93 C1 00 86 E0 80 93
7E20: C2 00 80 E1 80 93 C4 00 8E E0 C9 D0 25 9A 86 E0
7E30: 20 E3 3C EF 91 E0 30 93 85 00 20 93 84 00 96 BB
7E40: B0 9B FE CF 1D 9A A8 95 81 50 A9 F7 CC 24 DD 24
7E50: 88 24 83 94 B5 E0 AB 2E A1 E1 9A 2E F3 E0 BF 2E
7E60: A2 D0 81 34 61 F4 9F D0 08 2F AF D0 02 38 11 F0
7E70: 01 38 11 F4 84 E0 01 C0 83 E0 8D D0 89 C0 82 34
7E80: 11 F4 84 E1 03 C0 85 34 19 F4 85 E0 A6 D0 80 C0
7E90: 85 35 79 F4 88 D0 E8 2E FF 24 85 D0 08 2F 10 E0
7EA0: 10 2F 00 27 0E 29 1F 29 00 0F 11 1F 8E D0 68 01
7EB0: 6F C0 86 35 21 F4 84 E0 90 D0 80 E0 DE CF 84 36
7EC0: 09 F0 40 C0 70 D0 6F D0 08 2F 6D D0 80 E0 C8 16
7ED0: 80 E7 D8 06 18 F4 F6 01 B7 BE E8 95 C0 E0 D1 E0
7EE0: 62 D0 89 93 0C 17 E1 F7 F0 E0 CF 16 F0 E7 DF 06
7EF0: 18 F0 F6 01 B7 BE E8 95 68 D0 07 B6 00 FC FD CF
7F00: A6 01 A0 E0 B1 E0 2C 91 30 E0 11 96 8C 91 11 97
7F10: 90 E0 98 2F 88 27 82 2B 93 2B 12 96 FA 01 0C 01
7F20: 87 BE E8 95 11 24 4E 5F 5F 4F F1 E0 A0 38 BF 07
7F30: 51 F7 F6 01 A7 BE E8 95 07 B6 00 FC FD CF 97 BE
7F40: E8 95 26 C0 84 37 B1 F4 2E D0 2D D0 F8 2E 2B D0
7F50: 3C D0 F6 01 EF 2C 8F 01 0F 5F 1F 4F 84 91 1B D0
7F60: EA 94 F8 01 C1 F7 08 94 C1 1C D1 1C FA 94 CF 0C
7F70: D1 1C 0E C0 85 37 39 F4 28 D0 8E E1 0C D0 85 E9
7F80: 0A D0 8F E0 7A CF 81 35 11 F4 88 E0 18 D0 1D D0
7F90: 80 E1 01 D0 65 CF 98 2F 80 91 C0 00 85 FF FC CF
7FA0: 90 93 C6 00 08 95 80 91 C0 00 87 FF FC CF 80 91
7FB0: C0 00 84 FD 01 C0 A8 95 80 91 C6 00 08 95 E0 E6
7FC0: F0 E0 98 E1 90 83 80 83 08 95 ED DF 80 32 19 F0
7FD0: 88 E0 F5 DF FF CF 84 E1 DE CF 1F 93 18 2F E3 DF
7FE0: 11 50 E9 F7 F2 DF 1F 91 08 95 80 E0 E8 DF EE 27
7FF0: FF 27 09 94 FF FF FF FF FF FF FF FF FF FF 04 04

MD5 sum of bootloader = FB F4 9B 7B 59 73 7F 65 E8 D0 F8 A5 08 12 E7 9F

First 256 bytes of program memory:

0: 0C 94 35 00 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00
10: 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00
20: 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00
30: 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00
40: 0C 94 E4 03 0C 94 5D 00 0C 94 BC 00 0C 94 0A 01
50: 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00 0C 94 5D 00
60: 0C 94 5D 00 0C 94 5D 00 76 02 11 24 1F BE CF EF
70: D8 E0 DE BF CD BF 11 E0 A0 E0 B1 E0 E0 E6 F9 E0
80: 02 C0 05 90 0D 92 AE 33 B1 07 D9 F7 11 E0 AE E3
90: B1 E0 01 C0 1D 92 A1 3F B1 07 E1 F7 10 E0 CA E6
A0: D0 E0 04 C0 22 97 FE 01 0E 94 AA 04 C8 36 D1 07
B0: C9 F7 0E 94 CC 02 0C 94 AE 04 0C 94 00 00 08 95
C0: CF 92 DF 92 EF 92 FF 92 0F 93 1F 93 06 EC 11 E0
D0: C8 01 40 E0 52 EC 61 E0 70 E0 0E 94 45 01 60 91
E0: 1E 01 70 91 1F 01 C8 01 40 E1 50 E0 0E 94 B4 03
F0: 92 E2 C9 2E 91 E0 D9 2E C8 01 B6 01 40 E1 50 E0

Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Stuff about breadboard setups:

http://www.gammon.com.au/forum/?id=11637
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't have the wire, but I checked continuity between the Micro's ICSP header and the dedicated pins on the board—they're the same. So I hooked it up with them, and the 328P's RST connected to D10, and uploaded your sketch. All I got was the very first line—"Atmega chip detector."

One interesting thing is that I did see a faint "heartbeat" on the LED I've got connected to the 328P's pin 19 (Arduino 13), which is, of course, SCK. I did not see any such heartbeat before (when trying to use the Micro as an ISP).
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That first line shows it didn't go into programming mode. Can you post a photo that clearly shows how you have it hooked up?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My camera's not working. Sorry.

What I've got is:
MICRO          328P
5V ——————7 (Vcc) (via breadboard rail)
GND—————8 (GND) (via breadboard rail)
SCK—————19 (SCK)
MI——————18 (MISO)
MOSI—————17 (MOSI)
D10—————1 (RST) (and also 10K pull up from RST to Vcc rail)
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Decoupling cap between pin 8 and pin 7?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a crystal or resonator? Or are you sure it is using the internal oscillator?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah. No, there wasn't, and I don't have a 0.1µF. I did scrounge up two green-ceramic 47nFs (code 473). I put on across 7/8 and one across the power rails (capacitance adds in parallel, right?). Still just getting the first line. I tried a 2.2µF. No luck.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

WHOA! YES! I specifically ordered a "blank" chip from Virtuabotix—but I just put the 16MHz crystal into the circuit and voilà! Sorry not to have tried that earlier. Now to see if it'll actually flash the chip....
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ah yes, it's an old trick. My sketch has a clock output (pin 8 I think).  Pin 9.
« Last Edit: January 28, 2013, 06:55:18 pm by Nick Gammon » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Successfully flashed the fuses—now it's using the internal oscillator! Thank you for your help. Now to what I actually want to do... set up a watch crystal asynchronously! Time to hit the datasheet.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I seem to recall someone doing that, not so long back. a 32.768 KHz crystal or some such thing. Or maybe that was as an input to a timer. One or the other.

One post I found:

http://interface.khm.de/index.php/lab/experiments/sleep_watchdog_battery/

Also: http://arduino.cc/forum/index.php/topic,957.0.html

Logged

Pages: [1]   Go Up
Jump to: