How to program AVR or 8051 with Serial Port?

Hi,

I'm working on my final year project. I'm going to use AT89C51AC3 or ATmega1280. Last term in Embedded Systems course, we used an evaluation board(uses MSC1200Y3) that can be programmed over USB. I searched web site of Texas Instruments and find a application note that explains how to make it(In-System Serially Programming).

I'm wondering that can I make it too with Atmel's microcontrollers?

I have to design PCB, not going to use an evaluation board. So I have to program the microcontroller that I will select. Both microcontrollers have ISP feature. I want to know if i can make programmer over the board that I'm going to design. (For example, when a button is pressed the uC will be in programming state, when another button is pressed, the uC will be in running state.) Or do i have to use an external programmer? I have to program the microcontroller without removing from the board board.

Thanks...

Reply to
xelon
Loading thread data ...

For RS232 you need a bootloader - the AC2 has that, builtin, so go to the Atmel web site, and Download their FLIP SW - that is the downloader for all their serial devices ( which includes CAN and USB loaders ) on other variants.

-jg

Reply to
Jim Granville

Do I have to use a programmer board(ISP or sth)? If not, is there any documentation to build the board which can program the microcontroller via RS-232 also?

Reply to
xelon

Download the Flip SW and read the data sheets ? These will show how you pgm via RS232.

-jg

Reply to
Jim Granville

I already downloaded FLIP, but there is no documentation. Just a software to send an hex file to board. But I'm asking that how to make a (PCB) board that have programming feature. Is it possible? If it is, how?

I don't have any programmer, or a board yet.

Thanks

Reply to
xelon

The datasheet of the Atmel explains how the serial downloading is done. A little controller such as an AVR will do.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
 Click to see the full signature
Reply to
Rene Tschaggelar

You need to get the bootloader on the chip before you can serial program it. My suggestion is to build or buy a Jtag programmer first.

Reply to
linnix

Download the At89C51Ac3 datasheet,

formatting link

and also AT89C51AC3 Bootloader data sheet :

formatting link

Page 56 of the data sheet has the start of the section, and states "Atmel provide also a standard UART Boot loader by default."

Thus the device can self-pgm, via a RS232 port, conditional on a couple of pins described in the datasheet. All your PCB has to do, is provide a RS232 connection ( usually via MAX202 or similar ) to the PC, and a means to force those pins for Loading, and then you use Flip to actually send the code.

Page 8 of the Bootloader doc, gives the AutoBaud ranges for given Xtals.

-jg

Reply to
Jim Granville

Thanks all

I think I have to read the datasheet of both microcontrollers to learn this feature.

Reply to
xelon

It means booting from UART by default, not having the boot loader by default. Atmel provides the code, but you have to load it somehow.

It would make thing simple otherwise, but that's not true in general. We asked for pre-programmed avr with bootloader. Atmel said we have to Jtage it ourself. Even with it pre-loaded, the bootloader gets messed up occasionally. Ideally, we want the bootloader in rom, not flash.

We gave up and got a Jtag programmer eventually.

Reply to
linnix

That may be true for AVR, but the AT89C51AC3, and AT89C51CC03, for example, have the loaders built in.

Check the order codes in the data sheet, if you are unsure.

In fact, the CC03 (CAN) has two order codes, one for CAN loader, and one for UART. The AT89C51ED2/RD2 claims to have the Bootloader in ROM.

Maybe that is better suited to your task ?

-jg

Reply to
Jim Granville

Cretain Atmel and Philips 8051's have built in RS232 (You add the level shifter) bootloader. I am not sure about the AVRs.

Some micro have a JTAG interface with a debugger. This allows programming and emulation. A little better than program and pray debugging.

Reply to
Neil

I guess you are right about the C51. We tried to get some Atmega169 with bootloader installed, but Atmel won't do it for less than XXK units (didn't bother to ask). Anyway, the bootloader, fuse bits and configurations get lost sometime. The only way to restore the chip is to Jtag it. With C51 in PLCC or DIP, you can take the chip out to reprogram it. With 169, it's difficult to do with TQFP64 and impossible to do with MLF64. The newer chips are MLF only. I would not build a board without Jtag for these.

Reply to
linnix

linnix wrote: ...

...

You don't need anything as complex as a JTAG programmer to get a bootloader installed. The simplest design needs just four resistors to connect to the parallel port of your PC. This can set the fuses as well as program the flash.

formatting link

Although a bootloader can be convenient I expect most designs do not use them and just put a 5 pin header on the PCB to allow connection of an In System Programmer (ISP).

Also look up AVRdude and Ponyprog and AVRISP.

You should also look at

formatting link
for lots of information about AVR microcontrollers.

kevin

Reply to
kevinjwhite

Parallel port cable is one type of Jtag programmer. My point is that you need to build the access port on your target for it. We are running the 169 at 2.5V, so a simple parallel cable won't work.

Jtag (Join Test Action Group) also test the PCB connections, but not Atmel's ISP.

Mostly positive information, omiting the negative but important "buyer beware" data.

Reply to
linnix

I'm confused a lot. For ATmega1280 do i need a programmer? If yes, can you advice me one?

Reply to
xelon

Yes, you do. You can just build a parallel port header for jtag, as long as your target board run at 5V. You cannot assume that there will be a boot loader for UART, unless you ask someone else to preload it.

Reply to
linnix

xelon, I used to flash the code (*.hex) into the microcontroller ATmega128 through RS232 in my last project. Atmel is having the boot loader program in its data sheat. you can use it for your project. By using any one of the programmer, you have to downloaded your boot loader program into the microcontroller. After that all the communication to the microcontroller is through RS232 only.Every time microcontroller start up, first the flow control is given to the bootloader program. The boot loader is waiting for the your application program image (in *.hex file format) and it write that image to the coressponding memory location in page by page (may be 256 byte). After completion of this process, the flow control is tranfered to your application program (0x0000).

Reply to
Tamilmaran S

Yes, you need to Jtag/Isp the bootloader first and occasionally reload it.

Sound like you have to reload the flash everytime upon booting. The Atmega169 version check PB4 and PB6 to switch between bootloader and apps. Don't know if the binary works for other chip or not. You need IAR to recompile it.

Reply to
linnix

No need, actually you have to modify the boot loader program for accepting the updated version of the application program. In our project, we had waiting for any updated version of the application program for 30 sec. With in this time the host system sends any *.hex file, the boot loader writes the image to the correct location, otherwise after that time limit the control is automatically transfer to the 0x0000 location where the current version of the application program reside there.

Reply to
Tamilmaran S

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.