Your code is not much different than mine, but I have a few more
things in there for checking busy.
void attrib_RAM FlashVaderData(void) {
Disable_INT(); // Disable INTs
// Prepare to erase
flashParams[0] = IAP_CMD_PREPARE_SECTORS; // prepare sector
(s)
flashParams[1] = CFG_FlashDataBlock_Sec; // start sector
flashParams[2] = CFG_FlashDataBlock_Sec; // end sector
callIAP();
IOSET=IO_USB_ACK; // toggle USB line
// Erase
WaitTillFlashReady();
flashParams[0]=IAP_CMD_ERASE_SECTORS;
flashParams[1]=CFG_FlashDataBlock_Sec;
flashParams[2]=CFG_FlashDataBlock_Sec;
flashParams[3]=CCLK/1000;// CCLK in KHz
callIAP();
IOCLR=IO_USB_ACK; // toggle USB line
// Prepare to program
WaitTillFlashReady();
flashParams[0]=IAP_CMD_PREPARE_SECTORS;
flashParams[1]=CFG_FlashDataBlock_Sec;
flashParams[2]=CFG_FlashDataBlock_Sec;
callIAP();
IOSET=IO_USB_ACK; // toggle USB line
// Program
WaitTillFlashReady();
flashParams[0]=IAP_CMD_COPY_RAM_TO_FLASH;
flashParams[1]=CFG_FlashDataBlock_Adr; // Dst FLASH adr
flashParams[2]=CFG_RamDataBlock_Adr; // Src RAM adr
flashParams[3]=1024;
flashParams[4]=CCLK/1000;
// CCLK in KHz
callIAP();
IOCLR=IO_USB_ACK; // toggle USB line
WaitTillFlashReady();
Enable_INT(); // Enable INTs
}
Essentially here are the 4 steps and their timing:
IAP_CMD_PREPARE_SECTORS (<4mS)
IAP_CMD_ERASE_SECTORS (400mS)
IAP_CMD_PREPARE_SECTORS (<4mS)
IAP_CMD_COPY_RAM_TO_FLASH (<8mS)
I am simply toggling a line IO_USB_ACK on the board and sampling with
the scope.
So all of my time is spent in doing the erase task on this single
sector - 400mSec. That's the problem.
Why do you think yours is 100mS and mine is 400mS?
Thanks, Chris.Message
Re: Re_ Re_ [lpc2000] Re_ IAP_Flash Programming Time
2005-04-29 by sig5534
Attachments
- No local attachments were found for this message.