Pages: 1 [2]   Go Down
Author Topic: Bootloading Atmega328p-pu with USBTiny AVR Pocket Programmer  (Read 5525 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 34
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Lefty,

Thanks.  This clears up some details for me.
As you explained, the second newer method is working fine for me.  However, as to the first method, I bootloaded the optiboot.hex bootload to my Atmega328p-pu which I understand to be the bootload for a typical Uno.  I also set the fuses according to the Uno.  And I have the neccesary 16Mhz exteranl clock and all.
 By doing so, I would assume that selecting the "Arduino Uno" as my board type in the IDE would satisfy the necessary conditions to allow uploading of a sketch to work.  This is what I have tried, but fails.
Am I still missing something?
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26467
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Please confirm  you have a 10K reset pullup resistor to +5, 100nF cap between FTDI's DTR pin and the reset pin, and preferably a small diode from reset pin (anode) to +5 (cathode).
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Lefty,

Thanks.  This clears up some details for me.
As you explained, the second newer method is working fine for me.  However, as to the first method, I bootloaded the optiboot.hex bootload to my Atmega328p-pu which I understand to be the bootload for a typical Uno.  I also set the fuses according to the Uno.  And I have the neccesary 16Mhz exteranl clock and all.
 By doing so, I would assume that selecting the "Arduino Uno" as my board type in the IDE would satisfy the necessary conditions to allow uploading of a sketch to work.  This is what I have tried, but fails.
Am I still missing something?


Does your target circuit contain the needed auto-reset circuitry that the IDE first triggers to force the bootloader to run and listen for a valid upload request? If not you will have to try and use a well timed manual reset switch for the upload to work. When I try and use a manual reset I press and hold down the reset switch, then press upload on the IDE and when I see the compiled sketch size reported in the IDE output window I release the switch.

Lefty
Logged

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

CrossRoads and Lefty,

I think you both are coming to a similar conclusion which I will test.
As previously noted, this shows pretty much exactly my layout http://itp.nyu.edu/physcomp/uploads/arduinobload_wires.jpg except for the screw up in the MOSI line.
On the FT232R I am not using the RTS or DTR line at all going to the Atmega328 chip.  However, the Reset on the Atmega328 is pulled to 5V with a 10k and a manual reset button as shown.

Should the FT232R's RST line run to the Atmega328 reset, pin1?
And should I go ahead and add the 100nF cap between DTR and RST on the FT232R?

I think I get it that I have no reset running over to the Atmega328, as it IS running over from my breakout board to the Pocket Programmer, as shown in the image.

Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

CrossRoads and Lefty,

I think you both are coming to a similar conclusion which I will test.
As previously noted, this shows pretty much exactly my layout http://itp.nyu.edu/physcomp/uploads/arduinobload_wires.jpg except for the screw up in the MOSI line.
On the FT232R I am not using the RTS or DTR line at all going to the Atmega328 chip.  However, the Reset on the Atmega328 is pulled to 5V with a 10k and a manual reset button as shown.

Should the FT232R's RST line run to the Atmega328 reset, pin1?

No, do connect the FT232R's reset pin to anything, just leave it as a no connection.

And should I go ahead and add the 100nF cap between DTR and RST on the FT232R?

No. You need to go from DTR on the FT232R to a series wired cap, then cap to the reset pin of the 328.

Lefty


I think I get it that I have no reset running over to the Atmega328, as it IS running over from my breakout board to the Pocket Programmer, as shown in the image.


« Last Edit: October 12, 2012, 05:28:45 pm by retrolefty » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26467
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, need the reset connections described for software reset during serial sketch download.
Diode keeps weird things from happening with reset button push/release.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

OK,
I hooked up a 100nF cap in series from the FT232R DTR to the 328 pin1 Reset.  A 10k is still pulling up 328 pin1 to 5V.  Still same error from IDE...
Code:
avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\arduino-1.0\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : \\.\COM4
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv: . [00]
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.
Logged

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

I also added a diode IN4148 from Reset to 5V. Leaving the 100nF cap in series from DTR to Reset and 10k pullup.
 Same result.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26467
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are Tx & Rx swapped by any chance?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

No, not swapped.  Again, I can successfully receive Serial data from the 328 through the FT232R on COM4 onto the Serial Monitor in Arduino IDE.  So, they must be correct.  Plus I double checked anyway.
 
Logged

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

Hi,
can some one explain maybe in short, what is actually going on, bootloading arduinos?
2 Usb connections! I finally got it working, but why so complicated?
When I bought the avr pocket programmer I thought thats all I would need, connect it to the ISP connector of the chip e.g.ATmega328P, add a resonator and programm it.
Instead of using an IDE I thought I`ll be using the Arduino Software.

I got it working, but don`t have a clue how.

Thanks for any explainations,

John  smiley
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
can some one explain maybe in short, what is actually going on, bootloading arduinos?
2 Usb connections! I finally got it working, but why so complicated?
When I bought the avr pocket programmer I thought thats all I would need, connect it to the ISP connector of the chip e.g.ATmega328P, add a resonator and programm it.
Instead of using an IDE I thought I`ll be using the Arduino Software.

I got it working, but don`t have a clue how.

Thanks for any explainations,

John  smiley

Well you have paid your dues that's for sure. But as you imply you really haven't mastered the art until you can do it twice in a row separated by six months.  smiley-grin

Lefty
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 524
Posts: 26467
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
can some one explain maybe in short, what is actually going on, bootloading arduinos?
The 2 USBs are for 2 interfaces into the memory area.
When you install the bootloader via the ISP interface, the Flash area is being accessed pretty directly by the programmer. Same for File:Upload Using Programmer, when a sketch is loaded and the bootloader is wiped out; the Flash is accessed by the programmer.
When you install sketch via the serial interface, the bootloader is running as a sketch and receiving the data and putting it into Flash.

There is way more detail you can read about in the '328P datasheet, Section 27 and 28.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

Thanks,
`ll have to look up section 27-28, but I still don`t understand, why I`m not simply programming the bootloader. It`s only a little programm, executing instruction after instruction. I also wonder why this proramm is nowhere to be found, it`s got to be a .hex file. Ok, there are different ones for different controllers.
As far as my understanding on µcontrollers goes, the `328 must receive and give commands over its serial interface through its usb from the Ardu sw, to and through the programmers usb to the programmer, which not only talks back and forth to the Ardu sw, but also flashes the `328`s memory with data from the bootloader.hex. So 2 usb`s communicating, and the `328 communicates with Ardu sw while being programmed, with data comming from Ardu sw.
Maybe Ardu sw is telling the prorammer where the boot.hex is?
I found out about how to install the bootloader from this source: http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard
Is there any Arduino publication about it? I mean this is so far out, ... I`ve never even heard of anything like it, if someone would have told me, I would not have believed it.
Very complicated. 
Thanks anyway

John
Logged

Pages: 1 [2]   Go Up
Jump to: