Pages: [1] 2   Go Down
Author Topic: Bootloading Atmega328p-pu with USBTiny AVR Pocket Programmer  (Read 5888 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

Sorry ahead of time for the large message, but I know that details are usually appreciated in helping debug issues.
This is Part 1 of a few Parts, because of the exceeded size limit smiley-grin
I am having problems boot loading and loading sketches to the Atmega328p-pu chip.
Let me start by defining a few things:
I am using a windows 7 (64bit) platform
Arduino IDE 1.0
Avrdude 5.10
Pocket AVR programmer (https://www.sparkfun.com/products/9825
FT232RL USB to Serial breakout board (https://www.sparkfun.com/products/718)

And I followed the procedure to build a breadboard for boot loading and programming from: http://itp.nyu.edu/physcomp/Tutorials/ArduinoBreadboard
I quadruple checked my setup numerous times to make sure it was correct.
Note:  I did have to pin test the AVR programmer 6-pin connector and found that it has to be inserted in the opposite direction as shown in step 6.3 http://itp.nyu.edu/physcomp/uploads/arduinobload_plugin.jpg.  The supplied 6-pin has to go in the opposite direction from what is shown in this image.

Step 6.4 "Time to Burn" does not work and lead me down the following path:  Using AVRdude directly for the boot load.

I had issues getting the drivers all installed, but in the end, I basically followed the procedure details outlined by BeagleBoy at the top of the comments list at: https://www.sparkfun.com/products/9825
It did not work fist time and had to uninstall and reinstall a couple of times, but in the end, I have the following results in DeviceManager when both the Programmer and USB FT232RL are plugged in:
Device Manager:  (Partial list)
- LibUSB-Win32 Devices
  - USBtiny
- Ports (Com & LPT)
  - USB Serial Port (COM4)
- Other Devices
  - Unknown device

To try using the Arduino IDE 1.0 to program the boot loader, I do the following:
Tools/Board:  Set to Arduino Uno
Tools/Serial Port:  Com4 is selected and recognized, i.e. the FT232R is seen.
Tools/Programmer: Set to USBtinyISP
Files/Preferences:  select verbose output for both compilation and upload.
Then, running Tools/Burn Bootloader, I recieve the following message:

Code:
C:\Program Files (x86)\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xde:m -Ulfuse:w:0xff:m

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                    : lpt1
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 53 53]
avrdude: AVR device initialized and ready to accept instructions

Reading | CMD: [30 00 00 00] [53 73 73 73]
CMD: [30 00 01 00] [73 73 73 73]
################CMD: [30 00 02 00] [73 73 73 73]
################################## | 100% 0.01s

avrdude: Device signature = 0x737373
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

I think that the bottom line is that the Device Signature is wrong.  I have tried a couple of chips and each returns 0x737373 for the signature.  I also noticed that in the message above it says "avrdude: programmer operation not supported".  Not sure if this is also an issue or not.
My largest issue is WHY do I always get a 0x737373 return from any of the Atmega328p-pu chips that I put in?
Shouldn't it be reading 1E 95 0F for this chip???

Next step in next message below...
Logged

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

Part 2/3:
So I accept the fate of my chips having a different signature than expected, so I go and change the expectation to move forward.
If I go to Arduino-1.0/hardware/tools/avr/etc/avrdude.conf and edit the following section to change the signature that Arduino AVRdude uses for the check, as below.

Code:
#------------------------------------------------------------
# ATmega328P
#------------------------------------------------------------

part
    id = "m328p";
    desc = "ATMEGA328P";
    has_debugwire = yes;
    flash_instr = 0xB6, 0x01, 0x11;
    eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
 0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode = 0x86;
    # avr910_devcode = 0x;
#    signature = 0x1e 0x95 0x0F;    
signature = 0x73 0x73 0x73;
    pagel = 0xd7;

With this change I then get the following result from boot loader:

Code:
C:\Program Files (x86)\arduino-1.0\hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\arduino-1.0\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cusbtiny -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xde:m -Ulfuse:w:0xff:m

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                    : lpt1
         Using Programmer              : usbtiny
avrdude: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 00 53 53]
avrdude: AVR device initialized and ready to accept instructions

Reading | CMD: [30 00 00 00] [53 73 73 73]
CMD: [30 00 01 00] [73 73 73 73]
################CMD: [30 00 02 00] [73 73 73 73]
################################## | 100% 0.01s

avrdude: Device signature = 0x737373
CMD: [a0 03 fc 00] [73 f3 f3 ff]
CMD: [a0 03 fd 00] [ff ff ff ff]
CMD: [a0 03 fe 00] [ff ff ff ff]
CMD: [a0 03 ff 00] [ff ff ff ff]
avrdude: erasing chip
CMD: [ac 80 00 00] [ff ff ff ff]

avrdude done.  Thank you.

This all occurs way to fast and it is not boot loading.


So, I give up on boot loading from Arduino IDE and go directly to the Avrdude.....
See next message for the steps I followed next....
« Last Edit: October 10, 2012, 10:21:06 am by dgrigg123 » Logged

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

Part 3/3:
Here is the step by step sequence of my activities, so please follow along.  I tried to be as detailed as possible.

I try to run the AVRdude command shown at: https://www.sparkfun.com/products/9825, which is:
avrdude -c usbtiny -B 1 -patmega328 -U flash:w:main.hex
However, avrdude replies that "atmega328" not found.
So, I change to:
avrdude -c usbtinty -B 1 -pm328p -U flash:w:main.hex
However, I get...initialization failed, rc=-1
I read that this may be due to a high baud rate, so I change to:
avrdude -c usbtiny -B 32 -pm328p -U flash:w:main.hex
Now, avrdude is reporting the same thing that Arduino IDE boot load did, i.e.:
avrdude: Device signature = 0x737373
avrdude: Expected signature for ATMEGA328P is 1E 95 0F

So, I follow the same logic as before to change avrdude's expected signature and go to C:\WinAVR-20100110\bin\avrdude.conf and edit the following section to change the signature that Arduino AVRdude uses for the check, as below.

Code:
#------------------------------------------------------------
# ATmega328P
#------------------------------------------------------------

part
    id = "m328p";
    desc = "ATMEGA328P";
    has_debugwire = yes;
    flash_instr = 0xB6, 0x01, 0x11;
    eeprom_instr = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
 0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
 0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode = 0x86;
    # avr910_devcode = 0x;
# signature = 0x1e 0x95 0x0F;
    signature = 0x73 0x73 0x73;
    pagel = 0xd7;
    bs2 = 0xc2;


Now, when I run,
avrdude -c usbtiny -B 32 -pm328p -U flash:w:main.hex
I get:
avrdude: Device signature = 0x737373
avrdude: NOTE: FLASH memory has not been specified, an erase cycle will be performed.
To disable this feature, specify the -D option.

So I do this and command:
avrdude -c usbtiny -B 32 -pm328p -D -U flash:w:main.hex

Now avrdude complains that "main.hex" No such file or exists, and it is in Safemode with questions:
lfuse was 73, now ff, change back?
lfuse was 7b, now ff, change back?
lfuse was 3, now 7, change back?
I say no to each, as yes causes things to hang up.

I find a copy of "optiboot_atmega328.hex" and use it instead.
Now I command,
avrdude -c usbtiny -B 32 -pm328p -D -U flash:w:optiboot_atmega328.hex
Awsome...things start to Write and read, but still to Device signature 0x737373
and the resulting message for the process is:

Code:
C:\>avrdude -c usbtiny -B 32 -pm328p -D -U flash:w:optiboot_atmega328.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x737373
avrdude: reading input file "optiboot_atmega328.hex"
avrdude: input file optiboot_atmega328.hex auto detected as Intel Hex
avrdude: writing flash (32768 bytes):

Writing | ################################################## | 100% 46.03s



avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against optiboot_atmega328.hex:
avrdude: load data flash data from input file optiboot_atmega328.hex:
avrdude: input file optiboot_atmega328.hex auto detected as Intel Hex
avrdude: input file optiboot_atmega328.hex contains 32768 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 43.63s



avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0x00
avrdude: verification error; content mismatch

avrdude: safemode: lfuse changed! Was 73, and is now 0
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: hfuse changed! Was 7b, and is now 0
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: efuse changed! Was 3, and is now 0
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

All looked good, except the verification process, AND it does not look like the fuses were set properly, AND I still have this annoying Device signature issue.
In the end, even though this occurs, I guess this is why I cannot load a Blink sketch through Arduino IDE, as I get the following error in Arduino IDE trying to upload the sketch...

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:
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

Sorry for the long winded explanation, but I wanted all the details out there for whomever can help me here.
Otherwise, I just go and spend the extra $1 for a pre-boot loaded chip and succumb to failure as a boot loader.

Thanks for any advice and help.

 
« Last Edit: October 10, 2012, 10:21:28 am by dgrigg123 » Logged

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

As an added note:
I tried to set the fuses only, using
avrdude -c usbtiny -p m328p -C -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m

however, it just did not seen to take.

Logged

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

OK,
I found my issue with the Bootloading part.
There is an error in the picture in the instructions at:
http://itp.nyu.edu/physcomp/uploads/arduinobload_wires.jpg
If you look closely at this picture, it shows the MOSI from the Breakout Board going to Pin 16 of the Atmega.  THIS SHOULD BE GOING TO Pin 17 instead.

Now, with..
avrdude -c usbtiny -B 32 -pm328p -U flash:w:optiboot_atmega328.hex
I get the following result.

Code:
C:\>avrdude -c usbtiny -B 32 -pm328p -U flash:w:optiboot_atmega328.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "optiboot_atmega328.hex"
avrdude: input file optiboot_atmega328.hex auto detected as Intel Hex
avrdude: writing flash (32768 bytes):

Writing | ################################################## | 100% 45.89s



avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against optiboot_atmega328.hex:
avrdude: load data flash data from input file optiboot_atmega328.hex:
avrdude: input file optiboot_atmega328.hex auto detected as Intel Hex
avrdude: input file optiboot_atmega328.hex contains 32768 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 43.57s



avrdude: verifying ...
avrdude: 32768 bytes of flash verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


However, I am still not able to load a sketch to the chip using ArduinoIDE 1.0
I get the following....
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          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

A little progress, but no sketches yet.  Any ideas?
I can try uploading sketches through avrdude maybe.
Logged

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

OK,
I can upload the Blink.cpp.hex using avrdude through the AVR Pocket Programmer, BUT I still cannot get it from the Arduino 1.0 interface through the FT232R USB breakout board.
Either way, I seem to have a path that works, not the most convenient, but works.

Now, however, the LED seems to blink about 10 times slower than the 1 sec delay in the program.

Now, can someone tell me why this is?

Thanks,
Logged

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

OK, I'm learning.

Set the fuses to:
avrdude -c usbtiny -B 16 -p m328p -U lfuse:w:0xFF:m -U hfuse:w:0xDE:m -U efuse:w:0x05:m

And the LED blinks at the proper rate, using my external 16MHz crystal.

Still need any input on my issue using Arduino IDE through the FT232R.

Thanks
Logged

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

On the road to determine why I get "stk500_getsync(): not in sync: resp=0x00" when I try to load a sketch from Arduino 1.0 IDE interface....

I still get this message when trying to upload a sketch.
However, if I load the following modified Blink sketch, using still avrdude to upload through the Pocket Programmer...

Code:
void setup() {     
  Serial.begin(9600);   
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(13, OUTPUT);     
}

void loop() {
  digitalWrite(13, HIGH);   // set the LED on
  Serial.println("High");
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // set the LED off
  Serial.println("Low");
  delay(1000);              // wait for a second
}

I can then see if I receive Serial (COM4) messages through the FT232R Breakout board, on COM4.
And I do.
So I can read Serial messaging through the FT232R, but I just cannot upload a sketch.

Go figure.
Logged

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

I can use the "Upload using Programmer", if I have the usbtiny selected in the Arduino IDE. 
So I guess for now I can give up on using the FT232R breakout to load sketches.  Otherwise, I will just use it for reading serial output for debug.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 543
Posts: 27348
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

It sounds like you may have a data speed mismatch between what the bootload is using and what the PC/IDE is using.
If you put the Uno optiboot booloader on the chip, and then select Uno as board type, that  may fix things for you.
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

CrossRoads,

Thanks for the reply.  I was starting to think I was alone in the world.
With Optiboot loaded on the chip, I have Uno selected but still cannot successfully load a sketch from Arduio IDE through the FT232R, even though the FT232R shows up as COM4 and COM4 is selected and I can get serial Read/Write through the FT232R on COM4.

When I load a sketch using avrdude, I have to use the "-B 32" or "-B 16" flag, as a "-B 1" setting results in a "initialization failed, rc=-1" error in avrdude.
I don't know how to control these types of options when Arduino IDE uploads sketches, as Arduino is simply using its own avrdude also.  I might be wrong, but it seems like if I can dictate the bit clock period when Arduino transfers, that maybe it would work.
Also a question of mine, in general, my COM4 is set to 9600 baud but in the "boards.txt" the uno.upload.speed=115200.  Is that a right?  I tried to lower this to 19200 but no change.

Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 543
Posts: 27348
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

I'ved only programmed via the IDE, I'll leave the avrdude questiosn to someome with experience.
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: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Also a question of mine, in general, my COM4 is set to 9600 baud but in the "boards.txt" the uno.upload.speed=115200.  Is that a right?  I tried to lower this to 19200 but no change.

The baud rate a specific bootloader uses is 'hard coded' into the bootloader code, it is not changeable, so the IDE looks at the boards.txt file and uses the baud rate value from the selected board entry in that file for the board selection choice you had set in the IDE.

Lefty

Logged

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

Lefty,

Thanks, but I am a little confused by your comment.  Help me understand please.

In my current situation I want to simply sketch-load rather than boot-load.  (I'm not sure if there is really a fundamental difference in this designation in the IDE, but my brain is wired to think like that for the moment.)  But for the sake of argument, I can do neither from the IDE through my FT232R, so I understand that the issue is likely the same either way.  
So when you say "The baud rate a specific bootloader uses is 'hard coded' into the bootloader code", are you meaning that the baud rate a specific device, in my case the FT232R, used for either boot or program loading is hard coded?
Secondly, you said "the IDE looks at the boards.txt file and uses the baud rate value from the selected board entry in that file for the board selection choice you had set in the IDE".  
So, is it important that the baud rate listed in the boards.txt match what is hard coded in the bootloader device?

 
Logged

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

Lefty,

Thanks, but I am a little confused by your comment.  Help me understand please.

In my current situation I want to simply sketch-load rather than boot-load.  (I'm not sure if there is really a fundamental difference in this designation in the IDE, but my brain is wired to think like that for the moment.)  But for the sake of argument, I can do neither from the IDE through my FT232R, so I understand that the issue is likely the same either way.

With the present IDE release there are two very different ways to upload a sketch to an Arduino board (or standalone target chip). The first is the way that was always been available in the IDE and that is to use a serial link from a PC com port (or PC USB virtual com port) to a arduino board that has both a USB serial converter chip (either a FTDI or AVR based USB serial converter chip) and ALSO has had a bootloader program burned into the 'target' chip (as all purchased arduino board have). The bootloader that was burned into the chip uses a baud rate value to use that is specific to that version on bootloader. So that is why you must select the board type in the IDE that properly matches the baud rate and board clock speed  that the board you attach to the PC.

The second newer method to upload sketches to a arduino board with the IDE is using the IDE file menu option of 'upload using programmer' option. This method uses whatever hardware programmer device you select in the IDE to use the ISP protocol method to burn a sketch into a board that is attached to the hardware programmer. This method because it's not using serial com to talk to the board does not require that their is a bootloader program already installed into the target arduino chip you wish to upload to.

So when you say "The baud rate a specific bootloader uses is 'hard coded' into the bootloader code", are you meaning that the baud rate a specific device, in my case the FT232R, used for either boot or program loading is hard coded?

The IDE tells the PC com port what speed to use when doing a serial upload operation based on the speed that the board selected option tells it to use. The arduino board's bootloader when started at power-up or auto reset expects the com port speed to be at the specific speed that bootloader expects it to be at.
Secondly, you said "the IDE looks at the boards.txt file and uses the baud rate value from the selected board entry in that file for the board selection choice you had set in the IDE".  
So, is it important that the baud rate listed in the boards.txt match what is hard coded in the bootloader device?

Yes, it must match unless you are using a hardware programmer that uses ICSP method to burn the sketch.

Lefty


 
Logged

Pages: [1] 2   Go Up
Jump to: