9

I have been struggling with making an Arduino for a while (was successful in making a breadboard version using an ISP programmer cable). They say that the Arduino bootloader is made so that no external circuitry is required to program the ATmega8. But when I looked into the schematics there is the normal circuit required for the serial connection. Then what does the bootloader actually do?

Peter Mortensen
  • 1,676
  • 3
  • 17
  • 23
Rick_2047
  • 3,897
  • 5
  • 46
  • 68
  • 1
    no external circuitry is a preposterous claim... to talk to a computer over a serial port you at least need an RS232 transciever, like a MAX232 of some sort; or as the arduino does, you can talk TTL UART directly to a USB interface chip like FTDIs. – vicatcu May 13 '10 at 18:30

4 Answers4

13

The bootloader is a small program in the AVR's flash which is never overwritten and runs on powerup. The job of the bootloader is to read program data from the UART and write it to the internal flash. Without a bootloader, the only way to load code is using ISP.

The AVR ATMega8 comes with no code in the flash. Code can be uploaded via the ISP (in-system-programming) pins, using an AVR ISP programmer (or even another Arduino).

For Arduino, the ISP is used only once (at manufacture) - to upload a small bootloader. On powerup, the bootloader runs and communicates with the serial UART (TX + RX pins). Now, Arduino can be programmed via the serial pins using the STK500 protocol.

As the serial pins are (typically) connected to an FTDI USB to serial chip, the Arduino can also be programmed over USB.

Toby Jaffey
  • 28,796
  • 19
  • 96
  • 150
  • So you are saying that if I have a atmega8 chip with a bootloader burned in it I can remove all the circuitry for the ISP and just connect the proper pins from the serial to the arduino? Also can you tell me how will I connect the serial with the atmega8 – Rick_2047 May 12 '10 at 12:51
  • 2
    Once you have the bootloader, here's a very minimal Arduino circuit. Connect your PC (via a TTL level converter) to the TX/RX/GND pins. http://profmason.com/wp-content/uploads/2008/09/arduinopins.jpg See this question for some more details: http://chiphacker.com/questions/2512/ftdi-basic-breakout-5v/ – Toby Jaffey May 12 '10 at 12:55
  • I just checked out the schematics again, but they include something like max232 or a circuit with transistors, diodes and caps. Why is that? (I am talking about the serial circuit). – Rick_2047 May 12 '10 at 13:16
  • 1
    The max232 converts RS232 level serial (as comes from the 9-pin connector on a PC) to TTL level (5v) signals suitable for talking to the Arduino/AVR. The max232 circuit can be replaced by an FTDI USB to TTL serial chip to connect to a PC. – Toby Jaffey May 12 '10 at 13:21
  • 2
    A little note here: The Arduino bootloader only listens on the serial port for new code for a very short while at startup. Older Arduino bootloaders wait for a few seconds before the start executing code. Newer bootloaders start very quickly and have to be reset by the DTR line from an FT232. If you plan on using a max232, upload the older bootloader. Also check Sparkfun (http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=104) for some great AVR tutorials. – bpijls May 12 '10 at 13:33
  • 2
    It's actual AVR object code. The Arduino beats some rival platforms (eg. Basic Stamp) in that it runs compiled object code not an interpreter. – Toby Jaffey May 12 '10 at 14:14
  • @Joby Taffey - This is a tangential question: The code that is loaded via the Arduino IDE into the Arduno - is it actual AVR microcode, or a special microcode to be interpreted by an interpreter in the bootloader firmware (ala the BASIC Stamp)? – J. Polfer May 12 '10 at 14:14
  • if we require the max232 levels to be converted then does that not mean "external circuitry" which the arduino claims to avoid? – Rick_2047 May 12 '10 at 15:56
  • An RS232/TTL level converter is considered "standard", it's easy to come by unlike an AVR ISP – Toby Jaffey May 12 '10 at 16:03
  • So thats all? I thought there was more to it. Thats quite disappointing. – Rick_2047 May 12 '10 at 16:29
  • @Rick_2047 - Trying to do RS-232 comms without a RS232/TTL level converter doesn't work very well. When I was 12 and learning about tech, I picked up a MV1200 Basic interpreter chip from a company in back of circuit cellar that said you didn't need to use one, and it worked very poorly until I hooked an RS232/TTL converter up with an inverter inbetween. – J. Polfer May 12 '10 at 20:45
  • I hooked a MAX233 (version that doesn't need any external caps) to a ATMega328 pre-programmed with the bootloader. It waits a very short time and I have to try a few times to press reset at the same time. I am going to connect DTR throught the MAX232 to the AtMega328 and see if that auto-resets it. – BrianK Apr 29 '13 at 15:18
3

You can buy ATmega328 chips with the boot-loader on them here.

Leon Heller
  • 38,774
  • 2
  • 60
  • 96
1

They probably mean that if you buy a pre-built, assembled Arduino Uno, you don't also need to buy a programmer. Like with a lot of other electronics starterkits. You can program the Arduino Uno board with just a usb (A > B) cable.

However if you are going to build an Arduino of your own, you of course will need an external circuit (for example an AVR ISP programmer) or the Max232 or FTDI kind of stuff.

0

The idea behind the Arduino bootloader is that you don't need any specialty hardware or circuits to re-program them, compared to the initial programming of it, or older microcontroller, which often need a dedicated programmer (like PicKit2 for PIC MCUs). The bootloader allows programming over a basic serial connection.

Of course, at the time, you needed the serial link, typically a rs232 converter from TTL to RS232. Then serial ports being phased out, usb to serial became ubiquitous, allowing for that to replace a max232 or similar. And now, the use of USB enabled Atmel microcontroller allow even that to be unnecessary, so a single ic with minimal passive parts could provide the Arduino functions and USB to Serial. Now you only need a usb cable and a few passive to upload a sketch. The initial programming of the bootloader still requires traditional ICSP programming.

Passerby
  • 72,580
  • 7
  • 90
  • 202