New optiboot; beta testers welcome...

westfw:
Needs more linux testing.

Hello. These are my 2bits for Linux.

Your precompiled .hex works perfectly with my UNOr1 under Xubuntu 11.04: I can use ArduinoISP without using additional components (caps, res, etc..).

I then tried to compile the bootloader from sources and it seems to me that everything was OK (output is in the attachment)
Thank you for your work and ask me if you need some more feedbacks

test (11.7 KB)

No, one character which doesn't fit in the protocol is enough:

Ah. Depending on where it is. The bootloader will accept (nearly) any "command" characters without exiting, but as you say is very particular about getting the EOP in the correct place...

The reason that ArdunioISP wasn't working was that garbage characters (received at the wrong bitrate) were causing the bootloader to keep trying, instead of going on and starting the sketch (ArduinoISP itself.) I think your patch would make that worse, assuming the watchdog is still always reset in getch(). Normally, getting to the sketch promptly when the character stream doesn't look like bootloader commands is a good thing. Any ideas on resolving this incompatibility?

westfw:
I think your patch would make that worse, assuming the watchdog is still always reset in getch(). Normally, getting to the sketch promptly when the character stream doesn't look like bootloader commands is a good thing. Any ideas on resolving this incompatibility?

The watchdog is reset in getch() even when waiting for but not getting a new character, but there is a configurable time limit based on timer overflow. One timer overflow takes about 4.2s@16MHz, so the app would start after this timeout.

It's too late to think about it today, I'll be back in a week.

Michael

Thanks for the explanations. For me the new bootloader seems to be working fine. I have also tested it with ArduinoISP, without disabling auto-reset.

  • Compiled under Windows-7 64-bit with the IDE v0022 tools
  • Uploaded optiboot_atmega328.hex to an Arduino Uno, via Optifix running on another Uno
  • Uploaded optiboot_atmega328.hex to an Arduino Uno, via IDE and ArduinoISP running on another Uno
  • Uploaded optiboot_atmega328.hex to a 5v 16MHz Ardunio Pro
  • Uploaded optiboot_atmega328_pro_8MHz.hex to a 3.3v 8MHz Ardunio Pro
  • All boards now report Firmware Version: 4.4 to AVRdude, and correctly accept sketch uploads from the IDE

The 8MHz and 16MHz Pro boards were tested using an FTDI USB-to-serial interface. As with previous version of Optiboot, for the 8MHz boards I needed to reduce the baud rate to 57600 in the Makefile and in boards.txt.

Using this bootloader fixes the problem (well, for me, anyway) of not being able to upload sketches on the occasional ATmega328P chip that I and one or two others have experienced. See this post for a description of the problem.

As the Uno (with default Optiboot) seems to have trouble flashing through ArduinoISP because of autoreset problems, could I slice the PCB trace that enables autoreset and then flash using it?

could I slice the PCB trace that enables autoreset and then flash using it?

Yes, that would defeat the board's auto-reset function. However you would have to re=enable the trace path for when you want to do future uploads of other sketches onto the board, or learn how to time manual resets at the proper time to allow uploads to work.

Lefty

@montymintypie: If you install the latest version of Optiboot provided by @westfw you should not need to do anything special (like cutting the RESET trace) for the Arduino ISP Sketch to work.

retrolefty:
However you would have to re=enable the trace path for when you want to do future uploads of other sketches onto the board, or learn how to time manual resets at the proper time to allow uploads to work.

@Coding Badly, I have no way to update my Uno as of yet, so I plan to purchase an additional 328 for the purpose (also for a standalone project I have), which is why I need to run ArduinoISP on my current Optiboot.

@retrolefty, as the trace is designed to be cut (it's one of those bare pads) I can easily re-solder the joint to enable the functionality again. :slight_smile:

You don't need to disable auto-reset in order to upload a new bootloader. Look for WestfW's Optifix sketch. You'll need to update the binary data at the end of the sketch, but it's very easy to do.

Look for WestfW's Optifix sketch

Does Optifix update the processor on which it is running or does it update other processors?

AFAIK it's not possible to rewrite the bootloader memory internally. But if anybody wants to try out the new Optiboot v4.4 and they have two Arduino boards, the Optifix sketch avoids the need to disable auto-reset on the board acting as programmer. Once one of the boards has Optiboot v4.4 installed it will run ArduinoISP properly (again without fiddling about disabling the reset signals). Although for this purpose IMHO Optifix is easier to use than ArduinoISP + AVRdude.

I hope WestfW doesn't mind me beating this particular drum. It's all his work.

I'm traveling at the moment, but I'll try to post an updated (with optiboot 4.4) optifix soon...

How do I read the Optiboot version?

How do I read the Optiboot version?

It's in the last two bytes of flash memory. You can see it in the .HEX file and read it with an ISP programmer (including ArduinoISP.) To read it from a sketch, you'd need to update the protection fuses as per the source repository...

(The existing optiboot doesn't have a version number. Not even in the source code. There was only the version attached to the .ZIP file in the optiboot repository, and/or the version of the Arduino distribution. Adding the extra version number was one of the enhancements in this new version.)

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.

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

Sweet! Couple things, (a) Had to comment out the line #define USEFLASHLIB 1 to get it to compile, and (2) It reports

Bootloader at 0x7E00 is not readable

even though I've burned the bootloader from earlier in this thread. Should it find a version number?

Bootloader at 0x7E00 is not readable

If you burned the bootloader using the existing boards.txt settings for Uno, it read-protects the bootloader from sketches, making the bootloader version number unreadable. The code changes to fix this are submitted via source, but are not part of the bootloader itself. (you COULD change the xxxx.bootloader.lock_bits from 0x0F to 0x2F in boards.txt and reburn the bootloader, but I'm not sure it's worth it.)

Aha, thanks. I may play with it a bit. Again, nice work!

Hello. I've found the news right now and then I've tried to use these sketchs but I am having some issues trying toi compile them.

FuseBytes:
I got:
"pgm_read_byte" was not declared in this scope
at line 83

OptiLoader:
I got:
variable or field "read_image" declared void

I use:
Arduino IDE 0022 + Arduino Tiny Cores
OS: Xubuntu 11.04

EDIT:
I didn't download all of your mod-IDE software... only the sketches, so maybe this could be the explanation of the errors... maybe...