EmbeddedRelated.com
Forums

How to program AVR or 8051 with Serial Port?

Started by xelon February 18, 2006
Tamilmaran S wrote:
> 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.
That's a good alternative solution. But we would like to avoid the 30 seconds delay. We don't mind using 1 port bit to toggle (two bits are unnecessary). Also, we don't want to waste the high load driver (port B) for it. If we have time, we would try to recompile the bootloader. But we can't afford too much time dealing with it now, since this is just a side project. But the way, we use bootloader because we want to disable the Jtag during runtime, so we can have 4 more A2D channels (port A sharing with Jtag). Unfortunately, we are concerned that once we disable jtag, it would be tough to get it back.