I am unsure there was a need for a bootloader after all

Remember the intended use of the Arduino was as an educational tool for people just learning to use microcontrollers, so a simple interface that was easy to use would have been desirable. As has been mentioned, the bootloader method has the advantage of also providing a serial interface to the computer for use by the user code.

Note that using an ISP programmer runs the serious risk of mis-configuring the fuses, which can render the processor unusable without a high-voltage programmer to correct the error, since the ability to program by ISP can be disabled.

2 Likes

This is not true. The 16u2 is considerably more expensive than the ch340. Otherwise the cheaper knock-off boards would use the 16u2. You can see the price difference on retailer's websites.
Perhaps Arduino stuck with it for consistency and the added features.

1 Like

No.

Yes, those are fair points indeed.

Are you saying someone at Arduino made a boneheaded decision?

What were the prices at the time the board was designed? Was the CH340 even available at that time, or was the choice between the 8u2 / 16u2 and the FTDI chip (if it existed at that time)?
The availability of open-source drivers for the CH340 may also have been a factor.

On the Arduino Uno, the 8u2/16u2 is itself programmable with its own 6-pin ICSP connector, which provides additional flexibility.

I think it's a wonderful part of an amazing system!

I got my 1st Arduino and the Blink Example was running about 15 minutes! I didn't have to buy a development board or a programmer and when I was ready to build something I didn't have to make a PCB for the microcontroller chip.

No, like I said:

I don't think providing developers with a feature rich board is in any way, shape, or form boneheaded.

You weren't paying attention and I am not about to write you a summary.

It would have been immensely more feature-rich if the 16u2 were connected as a programmer in addition to connecting to the Rx-Tx lines. This would preserve all the existing features of the Arduino UNO v. 3 and it would have allowed for the option of having all the Flash RAM available (i.e. no bootloader). And this would be possible for the price of only a few PCB lines - the very low price of exactly 0 Candian rubles. Please let me know if I missed something.

I think this is a fair point. Closed drivers would be countrary to the company philosophy.

KiCad EDA - Schematic Capture & PCB Design Software
You can always make your own.
The libraries shouldn't be that tough to make and you might even find some help here.
I'm toying with a twin 2560 + 8266 board.

Convenience for those who are not as comfortable around electronics as you. For the new user, a cable from their PC to the Arduino board is about as simple as it gets.

At the same time it does not effect folks like you who can simply over write the bootloader code.

I would think of it like training wheels on a bicycle. Great if you need them but annoying if you don't.

Beyond that I think you know very well what the benefits and drawbacks of the boot loader are and you need some attention. I came to this conclusion due to your answer to DVDoug...

You weren't paying attention and I am not about to write you a summary.

Please explain why an always connected programming device on the SPI pins would not ever interfere with other uses of those pins. Your reply "No" really doesn't carry much weight as an argument.

There is also the newest board:

One disadvantage of bootloaders that use USB DFU for upload (thus not requiring any serial to USB IC), is that it's possible to upload a user sketch that trashes the bootloader, requiring a special procedure to "un-brick" the device.

1 Like

I only can talk about a 328P processor which i use in clocks.. When i don't bootload the processor first, i still can upload the program but it runs at about 5% of the speed..
Once bootloaded i can upload a program as many times as i want and they work at the normal speed..
Don't know what the bootloader does with it exactly but it does something..

so on Uno and Mega you can wire the ICSP headers together (soldered on bottom side if it works). Then put "Arduino as ISP" mixed with SerialPassthrough into 16u2 and you can delete the bootloader

1 Like

The fuses on a new processor chip come from the factory set to use the internal oscillator at a slow clock frequency.
Uploading the bootloader sets the fuses, some of which select the oscillator frequency and whether to use the internal oscillator or an external crystal. (note that some board platforms, such as MCUdude's MiniCore, have a selection for "no bootloader", which only sets the fuses when uploading the bootloader via the IDE).
Uploading code via ISP after uploading the bootloader will overwrite the bootloader.

3 Likes

Sigh. Let's talk about the history of the Arduino...

The original "Wiring" board was developed in 2003. There was no USBASP. The "standard" in hobbyist programmers were hacks that connected to the parallel port, or bit-banged the modem signals on an rs232 port. Usually PC-only, and by that time both of those ports were disappearing from PCs, and the OS was getting in the way of bit-banging. The board used an ATmega128 with 128k of flash, so sacrificing <8k to a bootloader didn't seem very painful.

Serial communications with a host was an important feature - one of the goals of the Arduino project was for the board to provide "physical" interaction for programs that ran on PCs. Being able to upload sketches over the same link was a nice benefit. Using a serial port drastically simplified host-side software - even now supporting "native programmers" can be a challenge across the many operating systems that it is desirable to support.

The FTDI chip was just about the only USB/Serial chip that you could get in chip form (and just barely.) I guess big vendors could get "Prolific" chips, but they mostly appeared in ready-to-use USB/RS232 adapter cables.

The Wiring board cost about $60.

The first Arduino board replaced the ATmega128 with an ATmega8, cutting the price in half (or more - suddenly the board was more home-buildable!) It had an rs232 port for communications and upload. The bootloader was reduced to 1k (12.5% of the 8k available.)

Serial ports were still going away, so USB-based Arduinos followed soon thereafter. The FTDI was still about the only available chip, so that's what was used. (it was still a pain to get through hobbyist channels.) Native-USB microcontrollers were nearly non-existent, and also hard to get. The Arduino Diecimila and Duemilanove, in the 2008 timeframe, were catching on, and clones started to appear. Atmega168 replaced Atmega8 (but the bootloader grew to 2k), and shortly thereafter came the ATmega328.

Other CPU vendors started to want in on the action, and started to offer their own "Arduino Killers" for sale at competitive prices. Most notable were the TI Launchpad(s), the NXP MBed (LPC1768), and assorted STM "Discovery" boards. Most of those came with a separate built-in debug/upload chip.

I "imagine" that sometime around then (2008), Atmel started to get pretty friendly with Arduino. "Don't you think your next board should use MORE Atmel chips? We can offer you a good deal..." they probably said. So the Uno came out with an 8u2 as the USB/Serial converter. And Optiboot, which reduced the size of the bootloader to 0.5k.

In theory, this would have been the ideal time to put programmer firmware in the 8u2 as well as USB/Serial. However:

  1. The existing firmware for the 8u2 is about 7k. Perhaps there wasn't room. (yeah, NOW it's a 16u2)
  2. AFIK, there isn't any existing code for 8u2 to do AVR ISP programming.
  3. Connecting an additional three signals between 8u2 and m328 might have been problematic. So far, the "interfering" connections are minimal, and have the serial comm usage as well.
  4. Backward compatibility! Sideways compatibility with (eg) Nano/etc. not to mention all the 3rd party boards with "other" usb/serial chips (which were finally becoming more common!)
  5. It wasn't needed. The goal of the 8u2 was to allow other usb drivers to be loaded, so that an Arduino board could implement a keyboard, gamepad, or midi (three popular examples.) No one saw a reason to get rid of the bootloader.
  6. host-side driver issues. the usb/serial port drivers were usually built in to the OS, "just worked", and were extremely likely to continue to work (despite OS churn.) Things dependent on "libusb"... riskier.

Other individual responses:

why waste space for a bootloader?

Why are you so opposed to using ~2% of the program space for a bootloader, anyway? It's a whopping 512 bytes! If your sketch is with 512 bytes of filling up your ATmega328, then you have more problems than those caused by the bootloader. Get a bigger chip.

ATmega8 running USPASP...

There was actually a group that designed an Arduino compatible using two ATmega8 chips, because that was pretty much all they could get where they lived. I can't find the discussion now. Likewise, there are boards that use ONLY an ATmega chip with USB bootloader (DIgispark and Trinket, for example.) Bigger bootloader, fewer chips. (Leonardo and Arduino Micro use a chip with HW USB.)

AFAIK, the software USB implementations cannot support "programmer" and "serial port" at the same time, ONLY support serial via violations of the USB specs (low-speed devices aren't supposed to support bulk endpoints), and are fast becoming incompatible with newer host USB controllers (having played fast and loose with the USB specs from the beginning.)

CH340 and other alternative USB/Serial Controllers.

Like I said above, the FTDI used to be the only chip-level USB/Serial converter that normal people could buy. It was a ~$5 chip (so was the ATmega8.) In fact, it's STILL a $5 chip. An 8u2 or 16u2 is a $3 chip; presumably one of the things that made it attractive at the time of the Uno design. Competitors have sprung up and have gotten better at cross-OS compatibility (OMG there were SO MANY chips for a while there that claimed to do USB/Serial for Windows Only. Sigh.) Many of them have been used in Arduino derivatives. I think Adafruit is using SiLabs cp210x, and Sparkfun is using the newer FTDI chips (all about $2.)

Boards made in China tend to use CH340 chips. It's about $0.50. But mostly made in China for Chinese manufacturers - you can't buy them through traditional "western" parts distributors, as far as I know. And it wasn't until rather recently that western folk could get such chips at all (and it might be going away :frowning: ) Arduino has had in the past as strong "made in Italy" mindset. I don't think that quite survived their main manufacturer trying to steal their business, but they're still pretty far from "we're going to build the boards in the cheapest way possible."

New boards (Nano Every) have a programmer.

Yeah. SAMD11: ~$1.50. Also simplified programming interface (1 (dedicated) wire!) Also uses a 48pin main CPU to yield "about" the same number of user-available pins as the 28-pin CPU in the original Arduinos. Has voltage converters for signals (3V chip SAM, 5V ATmega4809.) Having extra pins makes it easy to re-think your design decisions.

There's also the Microchip (nee Atmel) Xplained Mini 328p eval board, which is essentially an Arduino-compatible with a full programmer/debugger chip on it. Sells for less than an Uno (but doesn't have headers.) I'm not sure what it's not more popular. (although it's presumably only cheaper than an Uno because it's subsidized as an Eval/Marketing tool for Microchip. You couldn't build your own for the same price. :frowning: )

you dont have to if you dont want to [but the 16u2 could be the programmer]

In fact, there were instructions published for how to wire (and reprogram) the 16u2 to the 328p so that you COULD use the 16u2 as a programmer. It doesn't seem to have caught on at all.

[bricking boards]

Bricking your board is surely much easier with an ISP programmer than with a bootloader.

7 Likes

Could you share a link to your project? It seems like the kind of source I could learn a lot from right now.

I am not 100% sure of what you have in mind, but it sounds feasable. However, before selecing "Arduino as ISP", one should first program the 16u2. Maybe you could give a more detailed/unambiguous description of the wiring in your idea?

First of all, deleting the bootloader is NOT a disadvantage, it frees up memory and it also allows for faster startup of your device - by about 2 seconds. That may not be much for some projects, but it is a lot for some others. And more importantly, deleting the bootloader by no means does "brick" the MCU.

Alright, that explains the choice to use the 16u2.

And this explains why they didn't use the even cheaper IC.

I never stumbled upon that option during my perfunctory google searches. I'll try and see if I can find those instructions.

Yes, but not by simply removing the bootloader. Direct programming allows for better control. But with more power there is more responsibility.

I almost bought one the previous night, but held back because of import duties + Microchip adds VAT. I couldn't see an easy way to reclaim the VAT during importation at first.