How can you program an AVR using UART for the first time?

Can you program an AVR, for the first time, using only the UART and GND, RXD, and TXD pins?

I think I was told that it is not possible to program a never before programmed AVR uCro. this way. How can you program an AVR for the first time using this way?

Thanks

most AVR chips can be programmed by downloading a hex file to the serial port of the AVR. But only if a “bootloader” program is permanently installed in the AVR. Atmel does not ship chips with that pre-installed. So you can

  • buy a chip with a bootloader pre-installed from a vendor such as Priios

  • get someone to install the bootloader for you, using the “ISP” programming method

  • buy an ISP programmer (Atmel and many other vendors)

  • buy a JTAG programmer (Atmel and others)

most of these options are shown on the pages of avrfreaks.net.

stevech:
most AVR chips can be programmed by downloading a hex file to the serial port of the AVR. But only if a “bootloader” program is permanently installed in the AVR. Atmel does not ship chips with that pre-installed. So you can

  • buy a chip with a bootloader pre-installed from a vendor such as Priios

  • get someone to install the bootloader for you, using the “ISP” programming method

  • buy an ISP programmer (Atmel and many other vendors)

  • buy a JTAG programmer (Atmel and others)

most of these options are shown on the pages of avrfreaks.net.

Thanks for the info. So now what is this bootloader program?

Where can I get it?

What is the size of it?

Is it open for usage for all or it is owned by somebody or somecompany?

What language is it written? C or assembly?

Is there any flow chart indicating its operation?

Is there any kind of tutorial to teach you how to write your own bootloader?

Does one bootloader works for all kind of AVR?

I would appreciate your help. Thanks

on avrfreaks.net there are quite a few. By far, the best free one is BLIPS in the projects section of that forum. BLIPS includes the AVR side code you change a few constants for to match your AVR chip and crystal. And there’s the PC side if BLIPS.

I’m kidding here - I donated BLIPS to the public domain so there is a little bias. But check it and all the others out on the forum.

AVRs, like a lot of microcontrollers, can self-program — that’s really all a bootloader is, a program that reads in a larger program in whatever way is convenient (like through a UART) and writes the new program into the flash, being careful not to overwrite itself in the process :slight_smile: There are a couple of AVR features to make this easier, like a small chunk of flash that isn’t erased by the normal bulk-erase command, and the BOOTRST fuse. The AVR data sheet has a chapter on bootloader support. You do still need to get the boot loader onto the chip using one of the other programming methods.

Hi everyone,

Thanks for your responses. I found them helpful. The reason that led me to ask this question was that I want to install an AVR on PCB with minimum cost, footprint. If I use the ISP programming method, then I have to install a 10 pin header. That makes it kind of ugly and addes to foot print. One other method of programming an AVR is by using the usual RS232 adapter. But that is also big and ugly. In reality, when you are using the RS232 adapter. You are not using all its pin. So to avoid using RS232 adapter on pcb, I thought, I would use just the three pins of RS232 (GND, TXD, RXD) and thus use just a three pin header instead of the bulky RS232 adapter. But now you folks are saying that it is not possible. So what is the best programming method, of a never before programmed AVR, that minimized the use of footprint on PCB and not bulky. I hope I made myself clear. Thanks for your help

Regards

.

The ICSP method only actually needs six pins (reset, clock, data in, data out, power, and ground), and power and ground are probably available on some other connector already, so you could make your programming connector as small as 4 pins.

Why not program the AVR on a separate dedicated programmer target board, then move the programmed chip onto the application board? I guess this may not be feasible if your application is a professionally assembled smt design or something

You don’t need to use the standard 100mil headers for ISP. On one of my boards, I brought out the ISP pins for 2 micros plus a JTAG chain, all on a 2mm header to save space. I then made an adapter cable for programming. My latest board used an ATTINY44 in a DIP (yeah, I know, not very tiny :slight_smile: and I made a programming adapter out of a DIP clip and a 6-pin header.