Go Down

Topic: Uploading Bootloader Issues (Read 678 times) previous topic - next topic

Xenobius

Dear All,

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).
Code: [Select]
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
X

baselsw

But to answer your questions:

Quote
How many times can I run the fuses code?

many!
Quote
Do I need to run it in the first place?

Yes, the atmega328p chip is empty. Which means that the fuses are probably set to the internal oscillator (1/8MHz). So by setting the fuses you can use your external crystal (16MHz).
Quote
What am I doing wrong?

Let us find out... Begin by trying the following line for me. With "ARDUINO AS ISP"
Code: [Select]
avrdude -c stk500v1 -P com3 -p atmega328p -b 19200 -v -v

Post the output here.

Xenobius

During the soldering process, I actually used flux to assist and it works like a charm. I can solder anything with that. I also used a multimetre to test each individual pin for shortages and all is perfect.

I programmed the fuses as I said and it worked the first time only and stopped... To my surprise, I refreshed the soldering and it worked!
I mean I can understand that this might have been a dry joint, but this was freshly soldered, and it worked once and not 30 seconds later!

I cannot understand or explain but basically I managed to put ADABoot on the chip.
Now I am trying to use the FT232R Beakout, Connected the ATmega328p to GND/3.3v and connected RX chip to TX breakout and TX chip to RX breakout.
I keep getting out of sync...

Thanks

westfw

Quote
I managed to put ADABoot on the chip.
  :
I keep getting out of sync...

You are setting the board type to "Duemilanove w/ATmega328" rather than "Uno", right?

Xenobius

Umm.. I programmed my UNO as an Arduino ISP. And it worked.
But for the bootloader, I didn't have this option as I did it using AVRDude.

Here are the two commands that I managed to run so far.

Code: [Select]
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
avrdude -P com3 -b 19200 -c avrisp -p m328p -v -e -U flash:w:ADABoot_328.hex -U lock:w:0x0F:m


Now I will try to use the FT232RL to program a simple sketch.

Am I missing some step?
Thanks

westfw

Yes, I mean AFTER you've programmed the bare chip, using ArduinoISP, with Adaboot, and you're trying to upload sketches after serial rx/tx, you should identify the board as a duemilanove.  The board type is determined more by the bootloader that is running than by the actual hardware, and running Adaboot makes the target a duemilanove rather than an Uno.

Xenobius

Thanks buddy for that! I was getting to it. In fact I got there and I got this :p

avrdude: stk500_getsync(): not in sync: resp=0x00

Im trying to understand what's missing.
I have GND, RX, TX, VCC all connected to FT232RL and I have a resistor/capacitor connected from FT232 to Reset as in this image

http://www.buildcircuit.com/wp-content/uploads/2011/12/FT232RL-connections.jpg

Nick Gammon

Some tips here for do-it-yourself boards.

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

The "raw" chip comes with divide-by-8 clock fuse set. That needs to be changed or the bootloader won't work.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy