I wanted to create my own custom board with Arduino on-board. So I bought an ATmega328P-AU (the SMD 32pin version) and I soldered it in place with a 16Mhz Crystal and 2x 22pF caps.
There really isn't anything else connected. All power pins are connected too.
My target was to first upload a bootloader, than use tx/rx to upload sketches. I connected my uC to a USBtinyISP programmer but I was getting problems such as invalid identifier etc..
I then scrapped the thing, and programmed an Arduino Uno as an ISP Programmer. I connected my board to the arduino following this tutorial http://www.sparkfun.com/tutorials/247
The first thing that the tutorial asks is to actually program the fuses using AVRDude using the following command WHICH WAS A SUCCESS (finally).
avrdude -P com3 -b 19200 -c avrisp -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m
Then I continued by opening the Arduino IDE, selecting port/programmer/board and clicked on Upload Bootloader and it also worked.
But when I tried to upload bootloader the second time, I started getting the same original error. i.e. Yikes! Invalid Device Signature.
So I said, let me try to run the same identical Fuses code just as I did, and I got device signature 0x00000000
I thought that this might have burnt the chip, so I removed it, soldered a new chip and I tried programming the fuses again and it worked.
But this time I cannot upload the bootloader.
So MY question is this
- How many times can I run the fuses code?
- Do I need to run it in the first place?
- What am I doing wrong?
Please help and thanks a lot