Pages: [1]   Go Down
Author Topic: Uploading Bootloader Issues  (Read 569 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 13
Posts: 257
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
avrdude -c stk500v1 -P com3 -p atmega328p -b 19200 -v -v

Post the output here.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6636
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6636
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: