ATMEGA168A-PU signature problem

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
loDag
 
Posts: 10
Joined: Wed Oct 23, 2013 3:58 am

ATMEGA168A-PU signature problem

Post by loDag »

I bought a microcontroller ATMEGA168A-PU with arduino bootloader, I'm trying to learn how to program microcontrollers with the book "Make: Avr Programming" written by Elliot Williams.
The book uses an ATmega168, but I found these on offer and thought were OK ...
As a programmer i use AVR-ISP500-TINY produced by Olimex , which I have used to program the ATtiny85.
With the ATMEGA168A-PU I have problems, give me the following error:

avrdude: initialization failed, rc = -1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATMEGA168 is 1E 94 06


I have checked the contacts are correct with a multimeter and it seems all right.
It may be that avrdude does not support this microcontroller?

On the list there are only m168 and m168p


sorry for the english and thanks!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ATMEGA168A-PU signature problem

Post by adafruit_support_rick »

loDag wrote:avrdude: initialization failed, rc = -1
This means that the programmer is not communicating with the target microcontroller. How are you connected to the micro? Do you have an external clock source (e.g. crystal)?

loDag
 
Posts: 10
Joined: Wed Oct 23, 2013 3:58 am

Re: ATMEGA168A-PU signature problem

Post by loDag »

Thank you for replay,
No i don't have external clock, i use a development board made ​​by me, I checked that the contacts are well connected with 6-pin connector of the programmer with the multimeter, and it seems all right.
AVCC must be connected to VCC (I have to fix this thing) ? could this be the problem?
If I measure the voltage is about 3.8 V

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ATMEGA168A-PU signature problem

Post by adafruit_support_rick »

The -PU are old parts. They may not be set to use the internal oscillator. Try adding an external crystal or resonator and see if it starts to work.

User avatar
phild13
 
Posts: 247
Joined: Mon Sep 10, 2012 1:05 pm

Re: ATMEGA168A-PU signature problem

Post by phild13 »

I bought a microcontroller ATMEGA168A-PU with arduino bootloader
A chip with an Arduino bootloader already installed requires an external 16Mhz crystal or resonator in order to be reprogrammed. This is because the chip is already setup for the Arduino. Empty chips (ordered from digiKey, Mouser etc) without a bootloader use the internal 8Mhz clock and can be programmed without any additional components. It is pretty simple to stick a chip on a breadboard, add a resonator or crystal and caps, connect the pins from the USBtinyISP or other programmer and reprogram the chip with a bootloader.

Since your using a ATMEGA168A, the device signature should be for a 168 as shown here:
ATmega168A 1e9406
ATmega168PA 1e940b
ATmega168P 1e940b
ATmega168 1e9406

Device signatures can be found on the data sheet (look for section on signature bytes) for the processor. The -PU is the package type (28 pin pdip) according to the data sheet.

You need to connect pins
1 - reset,
7 - VCC (+5V),
8 - GND,
17 - MOSI,
18 - MISO,
19 - SCK,
20 - VCC (+5V)
22 - GND
Connect pins 9 and 10 to an external 16Mhz crystal and caps and other side of caps to GND or use a resonator.

While it is a good idea and recommended to connect pin 20 to VCC (+5V) and pin 22 to GND, I don't think you have to connect them just to have a minimalist circuit to reprogram the chip, but I could be wrong.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ATMEGA168A-PU signature problem

Post by adafruit_support_rick »

PhilD13 wrote:I bought a microcontroller ATMEGA168A-PU with arduino bootloader
D'oh! I missed that the OP said that! I was just guessing that's what he had. I need to read more carefully...

loDag
 
Posts: 10
Joined: Wed Oct 23, 2013 3:58 am

Re: ATMEGA168A-PU signature problem

Post by loDag »

Thank you, now I try and I'll let you know.
Maybe I have problems even with the programmer, I do not understand how it works, I hope not to have broken :), there's the manual but I did not understand very well and I can not find any tutorials that explain how it works.
Before the tests with the ATMEGA168A I was able to programming an ATtiny 85 with avrdude and with the Arduino IDE, now it is giving me problems ...

In the end I bought an ATmega168 and I programmed usbasp with no problems at least I can get on with reading the book ...

Thanks again and see you soon!

Locked
Please be positive and constructive with your questions and comments.

Return to “USBtinyISP”