Uno bootloader fixer

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Zokol
 
Posts: 1
Joined: Thu Apr 07, 2011 4:17 am

Re: Uno bootloader fixer

Post by Zokol »

Thanks for the Optifix, works great.
It took me few days to realize that i have ATmega328-PU, not 328P chips, so signature code was different and signature check did not like that. Changed signature bytes in code to 0x9514 and it finally worked.

Edit:
I used Arduino Uno and this circuit: http://arduino.cc/en/uploads/Tutorial/BreadboardAVR.png

Bharat
 
Posts: 1
Joined: Fri May 06, 2011 7:25 am

Re: Uno bootloader fixer

Post by Bharat »

Hello Freinds

Can any one guide me to bootload the New Atmega328 chip using 8Mhz internal Oscilator
using Ardunio UNO board as ISP and using optifix Sketch targeting chip on breadboard.

As far as i knw inorder to use 8Mhz internal oscillator, Fuses has to be set
and can obtain those settings from the following site http://www.engbedded.com/fusecalc/

What i dnt knw is hw can i use those settings and use optifix to burn bootloader into my new ATmega328P chip to make it work with out using external oscillator ?

I have to thanks a million to Bill Westfield for gr8 fix ...

and i wud be gald if anyone can help me change the fuse settings in optifix
(to get target chip work with internal 8Mhz Osc)
or any other possible options for my problem ?

Thanks in advance :)

User avatar
__tango
 
Posts: 9
Joined: Tue Jul 05, 2011 1:17 pm

Re: Uno bootloader fixer

Post by __tango »

Just an FYI for those who want to use an Arduino MEGA to program their UNO using optifix.

I was able to use optifix to fix the bootloader on my UNO, using an Arduino Mega2560 as the programmer. It required the changes to the SPI pins in the optifix.pde code (to account for the different SPI pins):

Code: Select all

--- optifix.pde.orig    2011-07-05 10:20:20.000000000 -0700
+++ optifix.pde 2011-07-05 10:20:24.000000000 -0700
@@ -44,11 +44,13 @@
 
 /*
  * Pins to target
+ * UNO:  SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). 
+ * MEGA: SPI: 53 (SS), 51 (MOSI), 50 (MISO), 52 (SCK),
  */
-#define SCK 13
-#define MISO 12
-#define MOSI 11
-#define RESET 10
+#define SCK 52
+#define MISO 50
+#define MOSI 51
+#define RESET 53
 #define POWER 9
 
 // STK Definitions; we can still use these as return codes
And the physical wiring was slightly different than listed on http://arduino.cc/en/Tutorial/ArduinoISP (I had to go from:

Code: Select all

MEGA -> UNO
-------------
53   -> RESET
51   -> 11
50   -> 12
52   -> 13
5V   -> 5V
GND  -> GND
One curious thing is that when using avrdude to check the firmware revision, nothing changed between the old version and the new version (using the command listed here: http://arduino.cc/forum/index.php/topic,64105.0.html:

Code: Select all

/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -patmega328p -cstk500v1 -P /dev/tty.usbmodem1a21 -b115200 -v
But it works now, so i'm happy. :)

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: Uno bootloader fixer

Post by westfw »

nothing changed between the old version and the new version
The older versions of optiboot (included in the optifix sketch) didn't have a real version number. It would happily lie through its teeth about all of the readable "parameters." ("hardware version: 3. firmware version: 3.3. Voltage: 3.3" Very compact!)

Thanks for writing up the instructions for using MEGA as a programmer; that's likely to help a lot of people who have ended up with "one each, Uno and Uno MEGA."

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: Uno bootloader fixer

Post by westfw »

I have uploaded an optiLoader4_4.zip sketch to Google Docs.
OptiLoader is a superset of the earlier optifix sketch. Like optifix, it provides zero or one-button reprogramming of an Uno bootloader with the latest optiboot (4.4 in this case) while bypassing any auto-reset issues. In addition, it automatically detects chip type and will program an appropriate optiboot into ATmega168 and ATmega8 as well.

Documentation is a bit slim at the moment, but there isn't much too it. Wire as described in the ArduinoISP documentation, and run the sketch. It's designed to re-run via the reset button, to easily program multiple Arduino clones. Run a serial monitor at 19200 if you want to see what it's doing. If you put optiboot on mega8 or mega168 chips, you'll also need to have an updated boards.txt...

I've also uploaded fusebytes.zip, which pretty-prints assorted "deep" information about your Arduino. Including the optiboot version number if present and readable.

Discuss here: http://arduino.cc/forum/index.php/topic,64105.15.html

30kviews
 
Posts: 2
Joined: Thu May 12, 2011 7:33 am

Re: Uno bootloader fixer

Post by 30kviews »

Hi there, a relative newbie to replacing the 328; i have not been able to find the necessary libraries "optiloader.h" Would appoureciate any help; hope not too much of a dumb question.

thank y

30kviews
 
Posts: 2
Joined: Thu May 12, 2011 7:33 am

Re: Uno bootloader fixer

Post by 30kviews »

yeah, thanks, never mind, i answered my own stupid question.

Midhun
 
Posts: 7
Joined: Wed Sep 07, 2011 2:31 am

Re: Uno bootloader fixer

Post by Midhun »

I've bought an atmega328 with arduino bootloader but i cannot program it using the arduino uno. It does not show any error during compiling but when I try to upload the sketch it shows some error message like

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

When I try to upload the sketch(the basic "Blink" sketch), the SMD led on pin13 flashes for sometime then goes off.

Please tell me what I've to do to upload sketches to the Atmeg328.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Uno bootloader fixer

Post by adafruit_support_bill »

@Midhun - please don't double post. See the response in your other thread on this topic.

Toma
 
Posts: 6
Joined: Tue Aug 30, 2011 4:08 am

Re: Uno bootloader fixer

Post by Toma »

Thanks, westfw, for sharing fusebytes.zip. I was just searching through forums to find something more reasonable about Arduino.

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: Uno bootloader fixer

Post by westfw »

BTW, there are new versions of optiLoader and fusebytes, now on github at https://github.com/WestfW/
The main change is modifications to work with the Arduino 1.0 SW release.

User avatar
westfw
 
Posts: 2008
Joined: Fri Apr 27, 2007 1:01 pm

Re: Uno bootloader fixer

Post by westfw »

I can't figure out how the Arduino's auto-reset feature ever allows ArduinoISP to work.
also BTW, I had this explained to me. The idea is that ArduinoISP operates at a different serial speed (19200) than the bootloader (115200 for optiboot), and the bootloader commands sent to AVRDude that are meant to go to ArduinoISP look like invalid commands to the actual bootloader, which in turn is supposed to cause it to abort and run the sketch in time for ArduinoISP to accept the same bootloader commands.

However, one of the ways that optiboot saved enough space to fit in 512 bytes was to happily group all the commands it didn't recognize into "things I don't support", which it would happily answer "yes, I did that!" rather than aborting. So the above scheme didn't work.

This has been fixed in my latest version of optiboot, discussed here: http://arduino.cc/forum/index.php/topic,64105.0.html
While it retains the behavior of ignoring unrecognized commands, it rejects characters with reception errors (wrong speed) before they are even considered...

User avatar
pagework
 
Posts: 1
Joined: Sun Nov 20, 2011 11:13 am

Re: Uno bootloader fixer

Post by pagework »

Thanks ever so much for the fix. I am burning away happily.
Uno to a Mintduino layout on a breadboard with blank 328p.

This really is the bee's knees.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”