AVRisp XPII with ATMEGA328p

Hi all,

i'm currently trying to program a virgin ATMEGA328P with an AVRisp programmer. I can't seem to communicate with the chip. I'm using a 32QFN package which is ridiculously tiny,

but i wired up a DIP package on the breadboard as well. it's like the chip doesn't know what it is or what it's device ID is. i'm not sure if the crystal is working (only have a 1mHz scope). would there be an issue with a specific capacitor type needed to oscillate correctly? (i'm using SMD ceramic multilayer).

other than that i'm stumped. I have no idea why the programmer won't recognize the chip. i've tried with using my uno as an ISP and that returned the same result.

thanks for the input.

Are you applying power? MKii only monitors the voltage level, it doesn't provide power.

I have 5V+ going to Vcc and AVref/AVcc - the programmer does detect the 5V but stilll nothing.

Mathurm:
other than that i'm stumped. I have no idea why the programmer won't recognize the chip. i've tried with using my uno as an ISP and that returned the same result.

"Virgin" chips have their fuses set to be clocked internally at 1MHz. The ISP programmer needs to communicate with it's clock set to more 1/4 of that. So your ISP programmer will need to have it's clock set to 250KHz or less to communicate for the first time.

Once you have reset the fuses so your 328p is using a higher clock rate (simplest is just to disable DIV8 bit -- it will then be internally clocked at 8MHz), you then can proceed to program at normal speed with your ISP programmer.

You will have to check your ISP programmer docs to find out how to adjust the clock speed. On my USBasp, for example, it's done by a jumper. Later versions of avrdude have clock speed switches which some ISP programmers will respect (depends on their firmware).

HMM... so if i put the virgin chip in an arduino uno without the bootloader or anything on it, the AVRisp software can read the chip. but without the arduino it cannot.

i'm thinking its my crystal? do the type of capacitors matter? (the value is 0,22uF)

Mathurm:
HMM... so if i put the virgin chip in an arduino uno without the bootloader or anything on it, the AVRisp software can read the chip. but without the arduino it cannot.

i'm thinking its my crystal? do the type of capacitors matter? (the value is 0,22uF)

Read the data sheet... seriously.

The virgin chip comes from the factory with its clock set (via default fuse settings) to the internal oscillator at 1MHz.

Your programmer needs to communicate with it's clock set to no more than 1/4 of the target chip's clock.

Because it's internally clocked, switching xtals or whatever will make no difference whatsoever. Not until you set the fuses to use an external clock source.

So you need to make sure your programmer clock speed is no faster than 250KHz to start getting anywhere.

the AVRisp has a nice slider to set the communication clock. I've set down into the 1kHz range and nothing.

on a side note, i've set up a breadboard circuit using the DIP package, external 16mHz crystal (with the low isp clock), and the capacitors to ground... wired the IC to power and ground and the SCK, MISO, MOSI, and reset pins and cannot read the ID on the virgin chip

however if i put the SAME virgin chip in the uno DIP socket, and power the arduino board off the breadboard power rails, the ISP can read the ID on the chip.

here's the circuit i've used on the breadboard: http://www.open-electronics.org/arduino-isp-in-system-programming-and-stand-alone-circuits/

could the crystal be bad? or would bad caps cause a connection error?

oh hell... I think i may have figured it out. i'll check my circuit when i get home, but i think i used .22uF instead of 22pF caps for the crystal.

that would filter out the crystal oscillations to a cutoff frequency of tens of kHz, worse with any significant resistance....

i'll put the DMM on the caps and report what value they are, hopefully its a silly mistake that is educational for others :blush:

Mathurm:
could the crystal be bad? or would bad caps cause a connection error?

As I said above, if the chip is virgin, it's using the internal oscillator as its clock, and isn't even looking at the external xtal.

Sounds like you've got another circuit problem.

Edit: If you can coomunicate with the chip while installed on the Uno, you might as well set the fuses to their appropriate values while there. Then at least you won't have to worry about the slow clock programming, and you really will be using your external xtal.

found the problem.

it was the caps. somehow i got the wrong value installed. the 805 SMD's aren't labeled so it wasn't too obvious.

circuit error. without the correct value of cap the xtal won't function properly and the chip won't respond.

it's like missing a semicolon in your code :stuck_out_tongue:

Glad you found it.