Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/01/06 15:50
Read: times


 
#110982 - IAP LPC9xx problem
Hello,

I am writing a bootloader with the IAP library from http://www.esacademy.com/. I modified the PGM_MTP from 0FF00H to 0FF03H for the P89LPC9221. It's no problem to read data from the chip, but I am still having problems with programming data and config bytes. I already write the IAP authorization key to the controller before writing, but I must also clear the configuration protection to write to the config registers. Can you help me with that? What's wrong with the code below?

Thanks in advance,
Mark


SET_WE EQU 08H ;enable writing
F1 EQU 0D1H
FMCON EQU 0E4H
FMDATA EQU 0E5H
KEY EQU 0FFH
KEYVAL EQU 96H ;IAP request key value


RSEG ?PR?_iap_write?LPC9xxIAPLIB
_iap_write:
; name = R7, value = R5
LCALL iap_feedwd ; feed watchdog if needed
LCALL iap_disableint ; disable interrupts if needed
MOV R0,#KEY ; IAP authorization key.
MOV @R0,#KEYVAL
CLR F1 ;specify IRAM
MOV FMCON,#SET_WE ;enable HARD write
MOV FMDATA,@R0 ;set HARD key
LCALL IAP_WRITE ; call iap routine
LCALL iap_enableint ; enable interrupts if needed
LJMP iap_exit ; put status in iap_status and exit

List of 3 messages in thread
TopicAuthorDate
IAP LPC9xx problem            01/01/70 00:00      
   Better results if...            01/01/70 00:00      
   Use the keil debugger            01/01/70 00:00      

Back to Subject List