Author Topic: Bootloader Problem after first use of "execute" funktion  (Read 7020 times)

adhome1

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
Bootloader Problem after first use of "execute" funktion
« on: February 26, 2008, 11:55:41 pm »
Hallo,

I do have a P89C668. Normaly I start bootloader with this code:
Code: [Select]
#pragma asm
MOV AUXR1,#20H ;set the ENBOOT bit
MOV R0,#8 ;FOSC
MOV R1,#06H ;program status byte or boot vector
MOV DPTR,#0000h ;specify status byte
MOV A,#10 ;
CALL 0xFFF0 ;execute the function
 #pragma endasm
WDTRST = 0x1E;
WDTRST = 0xE1;   // RESET

After programming with Flashmagic I reset by normal powerunplug.
Today I tried the first time the "execute" function in Flashmagic.
The device did reset after programming. Function working (;

But after that, i can not excecute the bootloader anymore. The device is simple not responding after the code.
Normaly, all ports must go on. But there is nothing. No reset by watchdog.
(After Powerunplug, the normal program is running)

Did the execute function change the bootvector?

If you need additional infos please ask.

(Sorry for my bad english. I'm german)
« Last Edit: February 27, 2008, 12:04:35 am by adhome1 »

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2155
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Bootloader Problem after first use of "execute" funktion
« Reply #1 on: February 27, 2008, 07:31:52 am »
To get the device back into ISP mode you must meet the requirements for ISP entry as described in the device user manual. Have you confirmed you are doing that with a scope? What did you find?

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: Bootloader Problem after first use of "execute" funktion
« Reply #2 on: February 27, 2008, 12:20:16 pm »
To get the device back into ISP mode you must meet the requirements for ISP entry as described in the device user manual. Have you confirmed you are doing that with a scope? What did you find?

But, Andy, setting the statusbyte to nonzero overrides the hardware bootloader entry condition - and there is nothing to check with scope on that.

Nevertheless, from the OP's post it's not clear for me, how does he reset the device after programming the statusbyte, nor what are exactly the symptoms...

Jan Waclawek

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2155
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: Bootloader Problem after first use of "execute" funktion
« Reply #3 on: February 27, 2008, 12:30:16 pm »
I interpreted the poster's message as meaning that they were able to execute their code, but not get back into ISP mode. Flash Magic automatically clears the status byte after programming, so if you want to reset back into the bootloader you need to explicitly set the status byte again.

Andy
Embedded Systems Academy, Inc.
support at esacademy dot com

Jan Waclawek

  • Full Member
  • ***
  • Posts: 220
    • View Profile
    • EFTON homepage
Re: Bootloader Problem after first use of "execute" funktion
« Reply #4 on: February 27, 2008, 01:10:29 pm »
I interpreted the poster's message as meaning that they were able to execute their code, but not get back into ISP mode. Flash Magic automatically clears the status byte after programming, so if you want to reset back into the bootloader you need to explicitly set the status byte again.
This is what they appear to do, indeed, i.e. enter the bootloader from the user code via programming the statys byte.

It appears then, that after having entered the bootloader and programmed the part successfully using FM, they used an option in FM to automatically run the user code. I don't have/use '668, but the datasheet does not mention a "reset" option via ISP (such as that in the 'V51RD2's ISP command set) - isn't this some sort of misunderstanding?

Jan Waclawek

adhome1

  • Jr. Member
  • **
  • Posts: 2
    • View Profile
Re: Bootloader Problem after first use of "execute" funktion
« Reply #5 on: February 27, 2008, 11:01:08 pm »
Thanks for the help. I found the problem. With the new firmware i added some code. This results in, that my compiler moved the Bootcode (i posted)
 to the end of the codemomory at FD03

This can of cause not working.

Thanks for the help.