Author Topic: IAP routines  (Read 4829 times)

GIGI

  • Guest
IAP routines
« on: April 07, 2004, 04:41:04 am »
I would like to use IAP routine to erase the FLASH memory of a LPC932 microcontroller.
But they don't work.
Then I "blank check" the memory with Flash memory and the program says me that  the memory isn't blank.

Do I need to set some other particular registers or flags to use the IAP routine at memory 0xFF00 ?

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: IAP routines
« Reply #1 on: April 09, 2004, 09:55:05 am »
If you look in the Technical Library on this web site you will find an IAP library for the LPC932 which you can either use or compare with what you have to see if you are missing any steps.

Embedded Systems Academy, Inc.
support at esacademy dot com

Mar

  • Guest
Re: IAP routines
« Reply #2 on: July 02, 2004, 02:56:45 am »
We are using the P89LPC31 microcontroller and we want to use the IAP functions.
 We have followed the procedure described in the IAP library in this web site but it seems that once we make the "LCALL" to the IAP function, the microcontroller ends up receiving a RESET.
 
 We want to read the BOOT_VECTOR, and we have tried two ways of doing it, with the same results:
 (Watchdog is disabled and the brownout detection enabled using the Flash-Magic programme.)

 1.

 MOV  R7,#2
 CLR     EA                               ; disable interrupts
 LCALL  IAP_READ
 SETB  EA

(where IAP_READ=0xFF0B)
 
 2.

 MOV  R7,#2
 MOV  A,#3
 CLR     EA                               ; disable interrupts
 MOV    ACC,#3
 LCALL  PGM_MTP
 SETB  EA

( where PGM_MTP=0xFF00)
 
 Do we need to do something else? Is there anything wrong in our code?

 Thanks in advance.

Graham

  • Guest
Re: IAP routines
« Reply #3 on: July 04, 2004, 05:22:35 pm »
Sir,

The entry point for the IAP routines in FF03h. A call to FF00h will cause te jump to the reset vector. This change occurred in V2 code to toughten up the processor against unintended code walk-up from poor resets.

Andy - you may need to check your web library to ensure it makes use of the correct entry point.

Also, why are you calling any address that is not the documented entry point? You open yourself up to ANY code changes made to the IAP support routines.

Rather, use function 3 as your second example shows (note that you load the accumulator twice, where only once is required).

Can I suggest that you grap the latest copy of the data sheets from the Philips web site? I can't help feeling that your confusion, and therefore approach, is caused by having out of date data sheets.

Best regards,
Graham

support at acqura dot com

mar

  • Guest
Re: IAP routines
« Reply #4 on: July 05, 2004, 01:17:30 am »
Thanks! We have tested it (PGM_MTP=0xff03) and it works!

We can't find a data sheet in the Philips web site with that modification (still talk about 0xff00), but we are already in touch with them.

Thanks a lot again,
  Mar.

Andy Ayre

  • ESAcademy Staff
  • Sr. Member
  • *****
  • Posts: 2172
    • View Profile
    • Embedded Systems Academy, Inc.
    • Email
Re: IAP routines
« Reply #5 on: July 06, 2004, 08:28:30 am »
Thanks Graham - I'll double-check our IAP library. I wasn't aware of the change.

Embedded Systems Academy, Inc.
support at esacademy dot com