Electronics > Microcontrollers

Are there too many different bootloaders in the Arduino world?

(1/15) > >>

elecdonia:
I’m doing several projects which require a small MCU with true 5V I/O. Atmel AVR devices are a perfect match for my needs. And because the Chinese offer a vast quantity of “Arduino compatible” boards for <$10 USD each, I stocked up. This speeds up breadboarding and debugging. My end products will likely contain “bare metal” AVR devices, but I’m not starting out that way.

I created this topic about bootloaders because some of these Chinese boards I received in Jan. 2023 came with really strange bootloaders:

1) A so-called “revised/upgraded Arduino-compatible 3V/8MHz pro-mini” board labeled “the simple.” By selecting board: “Arduino pro mini” in the Arduino IDE I successfully loaded one sketch into it. The sketch works fine, but afterwards the bootloader on this board totally lost its capability to connect to the Arduino IDE or to AVRDUDE. I’m using an adafruit FTDI friend which functions perfectly with 10 other (older) pro-mini boards, both 3V/8MHz and 5V/16MHz. Only this new “the simple” pro-mini board is acting strange. Fortunately it is still fully accessible with ICSP and a hardware programmer. Looking at it with ICSP I observed its bootloader is still there in flash. It didn’t get overwritten or erased. But it certainly doesn’t work now. This bootloader is 2k bytes, which seems kinda large to me. I’m about ready to load a different bootloader onto it. I use the 512 byte Optiboot along with “minicore” on several of my older pro-mini boards. I think I will try that with “the simple.”

2) I got a Chinese mega2560pro board which works nicely but has the largest bootloader I’ve ever seen on an Arduino-compatible board: 8k bytes. Compare that to most renditions of Optiboot which are 512 bytes. A bit of searching revealed the 256k AVR requires a whole different bootloader known as “STK500v2” in order to handle its gigantic address space. The person who originally developed the STK500v2 bootloader equipped it with a nifty self-contained debugging monitor which could be accessed by opening a serial terminal and typing “!!!” within 3 seconds of resettting the board. Unfortunately any sketch containing !!! would crash the boot loading process. Therefore the STK500v2 bootloader was soon revised to totally disable access to its internal debug monitor. But the debug monitor code is still in there today, occupying most of the 8k bytes. Ghost code? I realize that wasting 8k of flash isn’t a big deal for a 256k MCU. But this whole deal just seems really strange to me.

3) Next I started reading discussions about Arduino bootloaders on several different forums and observed that fully 50% of the threads are about being unable to use the bootloader. The most common fault is “error message says STK500 protocol won’t sync between board and AVRDUDE.”  Well, that’s exactly the message I’m getting from my “the simple” pro-mini clone board. But it worked perfectly… …one time. I wonder if the bootloader on it is some ancient version from the earliest days of Arduino?

If you are still with me I would like to learn which Arduino-compatible bootloaders you love and which ones you hate. Cheers!

westfw:
You an put Optiboot on everything, including the 2560 boards.  Use one of MCUDude's or SpenceKonde's "cores", and/or refactor your thinking to decide that all ATmegaxx8 boards are "Unos."
Here's some history:


* Original Arduino bootloader is ATmegaBoot, which takes 2k and runs at a relatively low bitrate.  It uses stk500v1 protocol.
* It also had some bugs, and modified versions were distributed by Adafruit and Sparkfun.
* The Arduino Mega ships, and it has so much memory that that a fancier bootloader (including a "monitor" capability) is used - stk500v2 boot.  It also permits more than 64kwords to be uploaded, which stk500v1 didn't (at least, theoretically.)
* Optiboot shipped on the Uno.  At 512bytes, it frees up 1.5k for user programs (which no one really cares about, since the m328 has a whopping 32k!)  Inexplicably, upgrading old ATmega8 and ATmega168 boards does not catch on.
* Somewhere between (2) and (6), billions of "clone" vendors spring up and start shipping boards that are basically the same as one of the existing Arduino boards, but have ... who knows what bootloader on them.
* Optiboot is modified to support many more chips.  A cooperative hack between Optiboot and avrdude permits it to support more than 64kwords.
* Arduino adds (pretty good) 3rd-part board capability.  MCUDude implements most of the ATmega chips, SpenceKonde implements most of the ATtiny chips.  All using Optiboot.  (MCUDude adds some features, like a callable vector to write flash.  Optiboot is now at v8.1, and has Optiboot-x for mega0/xtiny and OptibootDX for AVR-Dx.  Arduino is still shipping version 4.4  Sigh.)
* Arduino starts shipping the Nano with Optiboot instead of ATmegaBoot.  If you have old Nanos, you have to set the board for "(old bootloader.)"
* Arduino ships mega0-based boards (Nano Every and Uno WiFi 2) that don't use a bootloader at all.
* "Native USB" platforms need an entirely different bootloader to talk USB.
* Non-AVR platforms need a different bootloader.

--- Quote ---STK500 protocol won’t sync between board and AVRDUDE.
--- End quote ---
AVRDude error messages are not always the best.  "Can't sync" is what you're likely to get for a whole host of problems like: "you set wrong port", "the chip has a different bootloader", "your cable is bad", "Your USB/Serial Driver chip is bad", "Your AVR is bad", "You have something interfering with the serial port on the AVR", "There is no bootloader on the chip", "The bootloader is OK but the fuses are wrong", etc.

NorthGuy:

--- Quote from: elecdonia on February 16, 2023, 03:54:36 am ---My end products will likely contain “bare metal” AVR devices, but I’m not starting out that way.

--- End quote ---

Then your project will not have an Arduino bootloader and you will have to re-do all your Arduino work. If you want to go bare metal, start bare metal. This will save you lots of time and effort.

elecdonia:

--- Quote from: westfw on February 16, 2023, 08:38:22 am ---You can put Optiboot on everything, including the 2560 boards.  Use one of MCUDude's or SpenceKonde's "cores", and/or refactor your thinking to decide that all ATmegaxx8 boards are "Unos."
Here's some history: <snip>
--- End quote ---
Thanks for your suggestions and for providing both the history and context of Arduino bootloaders.

I’m thinking I will standardize by installing Optiboot on all of my Arduino-compatible boards which contain an AVR MCU, and especially on the Chinese clones which come with ??? bootloaders.

I’ve used Optiboot and “minicore” on pro-mini boards and I give both an excellent rating. I may go this way with my larger boards too, since there is also a “mega core” variety available from MCUDude.

elecdonia:

--- Quote from: NorthGuy on February 16, 2023, 02:00:41 pm ---
--- Quote from: elecdonia on February 16, 2023, 03:54:36 am ---My end products will likely contain “bare metal” AVR devices, but I’m not starting out that way.

--- End quote ---
Then your project will not have an Arduino bootloader and you will have to re-do all your Arduino work. If you want to go bare metal, start bare metal. This will save you lots of time and effort.
--- End quote ---
By “bare metal” I am just referring to not using a factory-built pro-mini in my project (although using a pro-mini this way is a reasonable choice for one-off projects). In the past I’ve used the MCUDude cores, typically “minicore” along with Optiboot, by installing these directly onto AVR parts. I also put headers on my boards for connecting a USB to logic-level serial cable. This worked well for me. It provided bootloader access for firmware upgrades without needing a factory-built Arduino board.

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod