Question on difference between bootloaders?

"Flashing a chip" and "running a bootloader" are two different instances. You may flash a chip with "any recommended crystal value" connected to it, afaik (provided you are using a standard programming method).

CrossRoads:
Found the summary I was doing.

You can see I was toying with a new board type:
the existing 328 types with 20 IO
the existing 1284 types with 32 IO
a new 1281 type with 54 IO, "milliduino"
the existing 250 types with 86 IO

I should make one up & try it ...

Good chart, lots of info and takes a bit to digest.
Flash is there, needs a column for Ram and EEprom.

xl97:
I have what I believe to be a FLASHED chip with Optiboot on it. Since it 'auto detects' the chip signature.. and there is no 8Mhz version.. (and you cant choose anyways.. Optiloader just 'goes'..and runs when a chip is detected)... this chip is set-up to use 16Mhz.

which Im assuming will NOT work in the final/target board that is set up with an 8MHz external resonator..

It will work. Trust me. The bootloader will run at half the normal speed, but that's just fine. Once the bootloader has finished running it passes control to your sketch, which will run at the speed you expect just the same as on any other 8MHz board.

You could recompile Optiboot for an 8MHz processor. You will find (I've tried it) that at 8MHz the "normal" baud rate of 115200 is unreliable, so you'll need to slow it down to 57600. But now the 8MHz version of Optiboot is (aside from some very minor cosmetic issues) exactly the same as the 16MHz version. The instructions to communicate at 115200 baud, if carried out at half speed, correspond precisely to 57600 baud.

The only problem you have is that there is no standard Arduino which uses Optiboot at 8MHz, and that means that you cannot use one of the existing definitions in boards.txt. But that's very easily overcome, as described above. If you really really do not want to alter boards.txt, then you'll need to start over (although the 16MHz jig will still be ok).

pito:

  1. if you flash an "optiboot for 8MHz and 57k6" and run the chip @16MHz the upload baudrate will be 115k2 - ok
  2. if you flash an "optiboot for 16MHz and 115k2" and run the chip @8MHz the upload baudrate will be 57k6 - ok

ok.. (Im trying here.. bear with me) :slight_smile:

I want to use an 8MHz Optiboot bootloader ON an 8MHz board.. (but I only have a 16MHz board that I can FLASH the chip with)

So if I use 16MHz board JUST TO FLASH THE BLANK CHIP.... that is intended to be used with a FINAL 8MHz pcb/board..

I would create this entry:

optiboot_8MHz.name=Optiboot @ 8MHz
optiboot_8MHz.upload.protocol=arduino
optiboot_8MHz.upload.maximum_size=32256
optiboot_8MHz.upload.speed=57600
optiboot_8MHz.bootloader.low_fuses=0xff
optiboot_8MHz.bootloader.high_fuses=0xde
optiboot_8MHz.bootloader.extended_fuses=0x05
optiboot_8MHz.bootloader.path=optiboot
optiboot_8MHz.bootloader.file=optiboot_atmega328.hex
optiboot_8MHz.bootloader.unlock_bits=0x3F
optiboot_8MHz.bootloader.lock_bits=0x0F
optiboot_8MHz.build.mcu=atmega328p
optiboot_8MHz.build.f_cpu=8000000L
optiboot_8MHz.build.core=arduino
optiboot_8MHz.build.variant=standard

correct?

Im still not clear on the different BOARD entries I would make then to fill these needs (out of curiosity)

ALL OF THE BELOW WOULD BE A 8MHz based Optiboot bootloader

8MHz board to FLASH with >>> 8MHz final circuit // same as above posted? no difference?
16MHz board to FLASH with >>> 8MHz final circuit // same as above posted? no difference?

As mentioned in a prior post here..

Likewise you can burn a bootloader binary made for an 8MHz board onto a chip running at 16MHz. To test it with the 16MHz crystal you just need to upload at twice the normal baud, and to do that you make a new entry in boards.txt as described above.

if I wanted to take my 8MHz bootloader.. take my 16MHz hardware.. and flash it to a blank chip..

if I wanted to 'test' that chip.. Id need to also do something different?

Im open to whatever.. (with-in reason!) :slight_smile:

I made two board entries for review.. I would have added them if 'signed-off' on as being OK. :slight_smile:

Im trying to grasp it all!..

and get a true understanding (as well as?) instead of just following blindly.

(maybe I shouldnt even be asking this..LOL)..

but lets take OPTIBOOT out of the equation (even though its a better bootloader that many prefer)..

and go back to the plain old Ardiuno IDE.. and using Arduino as programmer option for a second..

I have my Arduino Duemilanove wired up to the 1ISoG board.. (!ISoG = the 16MHz jig, hardware/board)..

I flash Duemilanove with the Arduino as ISP sketch.. ...wire up board..

make sure com port is right... choose - Arduino Pro/Pro-Mini @+3.3v & 8MHz entry from BOARDS menu..

and then choose BURN BOOTLOADER..

results?

Pito made reference to what may be my problem/hang-up on understanding..

flashing the bootloader to a chip != running a bootloader at specific clock speed?

If the external clock/resonator on the board used ONLY to flash the bootloader with ISNT a concern/issue..

then maybe excluding Optiboot (for now) is better, more clear?

pito:

that being said.. 'is' moving toward +3.3v based boards the trend? (future?)..

Yes.

Oo-er. That's perhaps overstating it. Fast processors have used lower voltages for many years, and even 3.3V is rather high for a modern chip.

But 5V still has plenty of advantages in an Arduino. Minimalist boards based on the 32U4 chip can run off 5V USB power without a regulator. Many components require 5V or run better at 5V: audio amplifiers, buzzers, large LED displays, power transistors, relays...

xl97:
correct?

Spot on. :slight_smile:

xl97:
I flash Duemilanove with the Arduino as ISP sketch.. ...wire up board..
make sure com port is right... choose - Arduino Pro/Pro-Mini @+3.3v & 8MHz entry from BOARDS menu..
and then choose BURN BOOTLOADER..

This will also work. However you'll need to remove your chip from the 16MHz jig and install it in the 8MHz circuit before you can test it (or create yet another new entry in boards.txt).

SRAM, EEPROM, yes I noticed that was missing as I looked at it again. Will update when I get a little free time.

pito:
"Flashing a chip" and "running a bootloader" are two different instances. You may flash a chip with "any recommended crystal value" connected to it, afaik (provided you are using a standard programming method).

The processor must be running, so the set fuse values must correspond to the crystal used during programming. Is so happens that the fuse values for 8MHz and 16MHz are the same, so in this case we can ignore the fact that we're using the "wrong" clock during programming.

well I had a long post.. but then it seemed I had more questions..(trouble)

I think I need some help clarifying..

Difference between using Optiloader (the sketch).. using Arduino as ISP.. and choosing (for example) Uno with using the Optiboot bootloader?

If I make a new boards.txt entry.. similar to the Uno (but with some edits)... and still follow along with the same process as is I was burning a Nano or Duemilanove..... but instead choose this NEW entry I made..

its more or less the same as using Optiloader sketch.. (but instead of auto-detect stuff) I am manually choosing the bootloader 'option/entry' I want.....yes?

Is there any different between using Optiloader sketch vs choosing UNO form the boards .txt menu option and buring with Arduino as programmer?

I like that Optiboot seems to install the default BLINK sketch.. shows its 'working'.. and that the bootloader 'took' correctly...

Using the Arduno as ISP/ and burn bootloader option.. seems to give me more control over the specific bootoader option I want to burn/apply...

So if I stick with the Optiloader (sketch) way... there isnt much I can do....right? (get that out of my head.. not the ONLY way to get/use the Optiboot bootloader....right?.. as I can manually apply/burn the UNO bootloader using the other steps...NOT the OPtiloader (sketch) approach)..

I think I get getting mixed up a bit on that...thats just different approaches for BURNING the bootloader...

Again to be clear.. doesnt matter that the board Im using as the bootloader, flashing JIG has a 16MHz crystal on it..
as long as the settings for the BOARD entry I make/use are all 'set' to be used in a 8MHz environment in the end.....correct?

that means:
optiboot_8MHz.maximum_size=30720
optiboot_8MHz.upload.speed=57600
optiboot_8MHz.build.f_cpu=8000000L

all need to be like above....? (as well as name vaule and all prefix names changed)

a complete entry would be:

optiboot_8MHz.name=Optiboot @ 8MHz
optiboot_8MHz.upload.protocol=arduino
optiboot_8MHz.upload.maximum_size=32256
optiboot_8MHz.upload.speed=57600
optiboot_8MHz.bootloader.low_fuses=0xff
optiboot_8MHz.bootloader.high_fuses=0xde
optiboot_8MHz.bootloader.extended_fuses=0x05
optiboot_8MHz.bootloader.path=optiboot
optiboot_8MHz.bootloader.file=optiboot_atmega328.hex
optiboot_8MHz.bootloader.unlock_bits=0x3F
optiboot_8MHz.bootloader.lock_bits=0x0F
optiboot_8MHz.build.mcu=atmega328p
optiboot_8MHz.build.f_cpu=8000000L
optiboot_8MHz.build.core=arduino
optiboot_8MHz.build.variant=standard

yes?

Now.. I would use this option in my BOARDS menu if I was trying to burn an 8MHz bootloader to a FINAL circuit that will use an 8MHz clock...correct?....

Even if the board I was using to flash the chip was a 16MHz or a 8MHz board (as the intermediate JIG flashing board).. wouldnt matter.. as the FINAL board is still a 8MHz clocked circuit.....right?

I would not (as I thought earlier) have 2 different BOARD entries based on the clock/oscillator of the JIG board that will be used in flashing...(so Im clear)

  • end board is still 8MHz board
  • intermediate board used to flash blank chip is 16MHz... still same BOARDS entry?
  • intermediate board used to flash blank chip is 8MHz... still same BOARDS entry?

(Im not talking about testing the boards.. purely flashing at this point only)..

I think Im just confusing myself more and more..LOL.. lots of info to digest here..

I was hoping it was easier than this! :slight_smile:

but ultimately.. flashing the chip using Optiloader (sketch).. gave it 16MHz clock..

I forget.. can I just put this in the 8MHz board and it'll work at half speed? (and hence the same...without problems?)
or do I need to go back.. make a new BOARD entry using the Optiboot bootloader (ie: edited UNO entry).. change the upload speed, to be half...and change the f_cpu to: 800000000000L ..... and re-flash (manually choosing that form BOARDS menu and Arduino as ISP)..
so that when I do remove the chip from the 16MHz JIG board..and put in the 8MHz resonator board.. there will be no problems?

(I need a nap!)

tim7:

pito:
"Flashing a chip" and "running a bootloader" are two different instances. You may flash a chip with "any recommended crystal value" connected to it, afaik (provided you are using a standard programming method).

The processor must be running, so the set fuse values must correspond to the crystal used during programming. Is so happens that the fuse values for 8MHz and 16MHz are the same, so in this case we can ignore the fact that we're using the "wrong" clock during programming.

ahh.. ok.. so it doesnt matter that Im using the 16MHz JIG board to flash these blank chips? (as fuses are the same)

and I 'should' keep on using the Optiloader (sketch)??

or I should go back to Arduino as ISP.. and choose a new BOARDS.txt entry based of edited UNO entry..with these changes in it:

optiboot_8MHz.maximum_size=30720
optiboot_8MHz.upload.speed=57600
optiboot_8MHz.build.f_cpu=8000000L

and again.. it doesnt matter than Im using the 16MHz JIG board to flash bootloader with,.. as these settings are really here for the END (final) 8MHz PCB board the newly flashed chip is going in?

Im 'sorta' (faking) my own 8MHz version of the Optiboot bootloader by doing this..yes? (I know not a legit, recompiled version like you said.. but close)

on the other hand though...

if the 16MHz JIG BOARD has no bearing this scenario at all..... then maybe just choosing the Arduino Pro/Pro-Mini from the board menu is more straight forward and purpose made for 8MHz..

westfw:

Otherwise they do much the same thing.

ATmegaBOOT supports EEPROM. Optiboot doesn't (and in fact will do bad things if you try to write EEPROM using it.)

So, no using EEPROM.h with a Uno or just if bootloaded with Optiboot?

And I shouldn't bootload a Nano (Gravitech) or Duemilenove with Optiboot?

How does the bootloader impact any libraries the sketch uses?

I run optiboot on both my Nano and Duemilenove boards, no problems.

Lefty

How does the bootloader impact any libraries the sketch uses?

It shouldn't impact it at all. On the Arduino, the bootloader is implemented as a completely separate entity. Arduino code never uses any functions from the bootloader, and the bootloader attempts to start the sketch with the AVR in a close to a "just reset" state as possible.

One possible exception is that in v4.6 (not actually released on any Arduino), a patch was added that permits the sketch to determine the "reset cause" (ie powerup vs RESET)
http://code.google.com/p/optiboot/issues/detail?id=66&can=1
http://code.google.com/p/optiboot/source/detail?r=4c68314d6b15eae1bad09dd4591e630f367cd679

I guess I have information overload at this point! lol..

blank ATmega328p_AU (smd) chips

the only 'jig' I have is a 16MHz board: One Square Inch of Goodness | The Custom Geek

However.. the END board this chip is getting installed into will be running/using an external 8MHz resonator.

Still unclear if I need to make a new BOARDS.txt entry... to somehow get a version of Optiboot on the chip?

Or

if I just choose Arduino Pro/Pro-Mini @ +3.3v / 8Mhz??

That would best match the END board specs (+3.3v @ 8MHz)..

but DOES NOT MATCH the JIG/BOARD I am using the 'flash' this chip?

I've sorta been all over the map here.. LOL..

does the clock/crystal/oscillator in the board used to FLASH the chip matter at all? (I think it was stated no..but am unclear)

using a 16MHz board to flash a chip that is going into a 8Mhz board is really confusing me here... as to the exact steps a noob like myself should take here. :slight_smile:

thanks!

Would you mind my asking you how do you plan to use the "goodness" board for flashing the bare blank 328p-au chip?

@Pito-

sure..

the board came pre-assembled WITH-OUT the ATmega328P-AU soldered on... (just the open/bare pads)

I have just been holding the chip down with my finger or weight or some kind and flashing the bootoader.

haha..ok.. hoping to get some time to jump back on this project tomorrow/this weekend.. :slight_smile:

still not clear

what will happen if I take this ATmega328P-AU chip that is flashed with Optiboot (so Im guessing 16MHz) using the Optiloader sketch that was uploaded to my Arduino Duemilanove 2009 board....

the ATmega328P-AU chip was a blank.. and was placed (held in place by hand) in the 1ISoG board (jig)...

what will happen if I put this chip in a PCB that has a 8MHz resonator? (not not a 16MHz crystal like the board had was used to flash bootloader to the chip and Optiboot is only 16MHz bootloader)

not work?

only work at half speed? (half of 16MHz = 8MHz would be ok then)

or should I just try using the Arduino bootloader and use the Pro/Pro-Mini.. which is spec'd at 8MHz.....??

Q: will I have a problem choosing the 8MHz Pro/Pro-Mini bootloader option when Im using a 16MHz board to flash? (no because the fuse settings are the same?)

thanks!

what will happen if I put this chip in a PCB that has a 8MHz resonator?

It should work (the bootloader only) at half speed. So uploading sketches should work at 57600bps, for example.
This should have no effect on sketches, which could pick up a correct clock rate (8MHz) from a boards.txt modification, and run "correctly" at that speed.