ICSP and ATMega328p...

Hi All!

I have recently had some boards made up, of course the usual checking and re-checking of schematics was done. And now that I have the hardware I’ve even beep-tested pins etc (it was hard - im using the 5mm x 5mm variety!).

But onto the problem!

Using a 6pin ICSP header and my trusty BusPirate i cannot communicate with the 328 at all!

I was under the impression that the 328 comes from the factory running off its internal 8Mhz oscillator, divided by 8… so at ~1Mhz.

Once I establish communication (hopefully this isn’t a similar story to the SparkFun slugs) I will be setting it to use a 20Mhz crystal, and then putting its firmware on (no bootloader).

In my experimenting I have setup an Arduino FIO (without bootloader) with a very simple “toggle the pin” program. This runs nicely at 8Mhz, and then at 1Mhz (8/8) and then at 125kHz! but now that it is running at 125kHz I have lost ICSP communication with it!

I have a feeling that the buspirate and/or avrdude is talking too fast (I’ve used the -x speed=0 flag) for the slow clock speed to keep up, but what do I do now!

Ive been trawling the web for FTDI bit-bang info, as avrdude seems to be able to slow that right down…

From the symptoms, I have a feeling that the same thing is happening to my new board, and the FIO.

Does anyone else have a similar story (and possibly a fix :lol:)?

I’d really appreciate any help!

Cheers!

Attie

PS:

I just found this, and I’m going to give it a go! Ill post the result :slight_smile:

http://doswa.com/blog/2010/08/24/avrdud … i-bitbang/

I have good news!

I have managed to recover the FIO using the previosuly mentioned information.

After I was a bit silly and set the clock source to 125kHz / 8, I had to hack the source (ft245r.c:189) to make use of a REALLY low baud rate (300 bps)

But its all good :slight_smile:

Hopefully tomorrow when I get my hands back on the new PCB I will have the same tale!

:smiley:

Hi all

Unfortunately I am having no luck at the moment. The guy who developed the PCB has screwed up and we are now trying to rectify the problem.

Fingers crossed!

Hi Guys,

I’ve not had any replies, but if anyone was wondering what happened…

The guy who redesigned our breadboard prototype into a PCB failed to realise that the MISO pin is bi-directional (IN when the 328 is running in SPI master mode, and OUT when its being programmed using the ICSP header for example!).

He had attached the output of an AND gate to the MISO pin, and indended our data to flow into the MISO during programming. :frowning:

A good lesson for me (as I had a brief look over the schematics too!) and hopefully for you all too! (if you didnt know this already)

:slight_smile: