Temporary call Atmel bootloader

Hi,

I'm using a AT89C51ED2. Sometimes the application needs to start the Atmel ISP bootloader, e.g. to enable re-programming the flash. Normally this is done by the following API procedure:

void __api_start_bootloader (void) { __api_wr_BSB (0xFF); __api_wr_SBV (0xFC); // stop application peripherals T2CON=0x00; TL2=0x00; TH2=0x00; BDRCON=0x00; TCON=0x00; SCON = 0x00; TMOD = 0x00; PCON = 0x00; TCON = 0x00; EA = 0; MAP_BOOT; __API_JMP_BOOTLOADER(); }

The problem ist the writing of 0xFF to BSB, because it inhibits the start of my application on the next reboot. I'm looking for a way of starting the bootloader without the need of modifying the BSB. Simply commenting out the "__api_wr_BSB()" line is not possible, because then the bootloader immediately returns to the application.

Any idea?

Jürgen

Reply to
Juergen Loh
Loading thread data ...

Juergen Loh schrieb:

What is the address defined for __API_JMP_BOOTLOADER?

--
Dipl.-Ing. Tilmann Reh
Autometer GmbH Siegen - Elektronik nach Maß.
http://www.autometer.de
Reply to
Tilmann Reh

#define __API_JMP_BOOTLOADER (*((const void(code*)(void)) 0xF800 ))

Jürgen

Reply to
Juergen Loh

Juergen Loh schrieb:

I think the entry point for the boot loader is FC00h. At least it always was for the RD2, and AFAIK the loader is the same.

But then, unless you jump to the soft boot entry at FC03h (which checks BSB and SBV), the boot loader should immediately start (with the automatic baud rate detection).

--
Dipl.-Ing. Tilmann Reh
Autometer GmbH Siegen - Elektronik nach Maß.
http://www.autometer.de
Reply to
Tilmann Reh

Juergen Loh schrieb:

Another thought: what if ENBOOT (in AUXR1) is not set, unless you have set the BSB?

--
Dipl.-Ing. Tilmann Reh
Autometer GmbH Siegen - Elektronik nach Maß.
http://www.autometer.de
Reply to
Tilmann Reh

Hallo Tilmann,

sorry for my late reply. I had to stay in bed with fever for some days. :-(

The ED2 data sheet says that the boot loader's address is from F800 to FFFF. And the boot process diagram says that the boot ROM is started at F800 at startup.

Yes the boot loader starts, but it immediately returns to the application program at 0000 if BSB is 00.

Is there any documentation of the boot loader's entry points like FC03 as you mentioned?

Tschüs, Jürgen

Reply to
Juergen Loh

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.