EmbeddedRelated.com
Forums
Memfault Beyond the Launch

How to program AVR or 8051 with Serial Port?

Started by xelon February 18, 2006
linnix wrote:

> Jim Granville wrote: >>Page 56 of the data sheet has the start of the section, and states >>"Atmel provide also a standard UART Boot loader by default." > > > 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.
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
xelon wrote:
> 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... >
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.
Jim Granville wrote:
> linnix wrote: > > > Jim Granville wrote: > >>Page 56 of the data sheet has the start of the section, and states > >>"Atmel provide also a standard UART Boot loader by default." > > > > > > 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. > > That may be true for AVR, but the AT89C51AC3, and AT89C51CC03, for > example, have the loaders built in.
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.
> > 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
linnix wrote:
...
> 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.
... 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. http://elm-chan.org/works/avrx/avrx_lpt.png 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 www.avrfreaks.com for lots of information about AVR microcontrollers. kevin
kevinjwhite@comcast.net wrote:
> linnix wrote: > ... > > 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. > ... > > 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.
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.
> > http://elm-chan.org/works/avrx/avrx_lpt.png > > 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).
Jtag (Join Test Action Group) also test the PCB connections, but not Atmel's ISP.
> > Also look up AVRdude and Ponyprog and AVRISP. > > You should also look at www.avrfreaks.com for lots of information about > AVR microcontrollers.
Mostly positive information, omiting the negative but important "buyer beware" data.
> > kevin
I'm confused a lot. For ATmega1280 do i need a programmer? If yes, can
you advice me one?

xelon wrote:
> I'm confused a lot. For ATmega1280 do i need a programmer? If yes, can > you advice me one?
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.
xelon wrote:
> 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...
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).
Tamilmaran S wrote:
> xelon wrote: > > 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... > > > 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.
Yes, you need to Jtag/Isp the bootloader first and occasionally reload it.
> 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).
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.
linnix wrote:
> Tamilmaran S wrote: > > xelon wrote: > > > 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... > > > > > > 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. > > Yes, you need to Jtag/Isp the bootloader first and occasionally reload > it. > > > 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). > > 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.
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.

Memfault Beyond the Launch