This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2132 : failed to copy arm to flash with IAP

I wanted to write a image to flash with IAP.
the function like this:

typeof IAPCALL (void)iaplocal(int *,int *);

IAPCALL iapcall=0x7ffffff1;

int cmd[5],ret[3];
cmd[0]=51;//cmd id
cmd[1]=0x1000;//flash start addr
cmd[2]=0x40002000;//ram start addr
cmd[3]=256;//size
cmd[4]=10000;//system clock

iapcall(cmd,ret);

i check ret,the ret[0] is 0,that means copy ram to flash success.(I use cmd 50 to prepare flash select before i call this fucntion and i also check the section of flash is blank).
but i compare the data in flash ,the flash is still blank.the data is not writen into flash.

I prefer your help! thanks!

Parents Reply Children
  • How can i disable interrupt?
    Which method will i select,please?
    1:the intrrupt register in LPC2132 VICIntEnable (Interrupt Enable Register. This register controls which of the 32 interrupt requests and software interrupts are enabled to contribute to FIQ or IRQ.)

    VICIntEnClr (Interrupt Enable Clear Register. This register allows software to clear one or more bits in the Interrupt Enable register.)

    2:the interrupt bit in CPSR of ARM7TDMI

    thanks!

  • I disable intrrupt CPSR of arm and VICIntEnable
    VICIntEnClr of LPC2132, It seems no effective.
    I still cann't copy ram to flash with iap.
    I call like following:

    IAPCALL(50,1,8).//select sector 1 to 8,return is ok
    IAPCALL(52,1,8).//erase sector 1 to 8,return is ok
    IAPCALL(53,1,8).//check blank of sector 1 to 8,return is ok
    IAPCALL(50,1,8).//select sector 1 to 8,return is ok
    IAPCALL(51,0x1000,0x40002000,256,10000);//copy data start from 0x40002000 in ram to flash 0x1000,the size is
    256 and system clk is 10000 khz. return is ok
    IAPCALL(56,0x1000,0x40002000,256);//but return compare_error