Here is an extraction from my program:
/******************************************************************/
/* Program *data to flash_addr. number of bytes specified by size */
/* Return: IAP error code (0 when OK) */
/******************************************************************/
UINT32 gIAPProgram (void *flash_addr, void *data, UINT32 size)
{
struct iap_in iap; // IAP input parameters
UINT32 result[16]; // IAP results
WDMOD=0x00; // stop watchdog
VICIntEnClr = 0xFFFFFFFF; // disable all interrupts
iap.cmd = FLASH_CMD_PREP_SEC; // IAP
Command: Prepare Sectors for Write
iap.par[0] = get_secnum (flash_addr); // start sector
iap.par[1] = iap.par[0]; // end Sektor
iap_entry (&iap, result); // call IAP function
if (result[0]==CMD_SUCCESS) // an error occured?
{
iap.cmd = FLASH_CMD_CPY_RAM_TO_FLASH;
// IAP Command: Copy RAM to Flash
iap.par[0] = (UINT32) flash_addr; // destination-addr
iap.par[1] = (UINT32) data; // source-addr
iap.par[2] = size; // number of bytes
iap.par[3] = CCLK; // CPU clock
iap_entry (&iap, result); // call IAP function
}
gInit_Watchdog();
VICIntEnable = gEnabledInterrupts;
gCopySram32ToSram32BufferBinary(result,gIAP_Results,0x0000,16);
return (result[0]);
}
UINT8 gIAP_DataBuffer[512];
//somewhere in IAP MainLoop
{
...
#ifdef DEBUG_INFO
CplPortPin(PORT0,Port0_06);
#endif
i=gIAPErase(FlashSector01_START, FlashSector14_END);//
erasing time is ~100ms, independant if 1 or more sectors
#ifdef DEBUG_INFO
CplPortPin(PORT0,Port0_06);
#endif
...
#endif
#ifdef DEBUG_INFO
CplPortPin(PORT0,Port0_07);
#endif
i=gIAPProgram
((FlashSector01_START+OffsetProgrammedData), gIAP_DataBuffer, sizeof
(gIAP_DataBuffer));
#ifdef DEBUG_INFO
CplPortPin(PORT0,Port0_07);
#endif
...
}
Times are measured with scope on portpins
Ralf
sig5534 schrieb:
> > Erase sector 1-14: 100ms
> > Program 512 bytes starting from adress 0x2200: 250\ufffds
>
> Well I'm confused now. I am seeing 400mS to erase one sector and prog
> 1K of flash. Are you waiting to see if the prog is actually done? I
> am doing that, and the IAP_BUSY status does not go down until 400mS.
>
> I can also verify that if the power goes down in 300mS the programming
> does not get completed. The erase does, but not the prog.
>
> So my 1024 bytes to prog is certainly taking much longer than 500uS as
> you suggest.
>
> Any ideas?
>
> Thanks, Chris.
>
>
>
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/lpc2000/
>
> * To unsubscribe from this group, send an email to:
> lpc2000-unsubscribe@yahoogroups.com
> <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
--
Mit freundlichen Gr\ufffd\ufffden / Best regards
Ralf Knorr
___________________________________________________________________________________________
* Author: *
Dipl.-Ing. Ralf Knorr (FH)
Development: Area leader Software
Bury GmbH & Co KG
Robert-Koch-Str. 1-7
32584 L\ufffdhne
Germany
*Phone:* +49 (0) 5732 9706 0
*Fax:* +49 (0) 5732 9706 209
*Email:* knorr@... <mailto:knorr@...>
*Internet:* http://www.thb.de <http://www.thb.de/>
This email and any files transmitted with it are confidential and
intended for the adressee only.
If you are not the adressee you may not copy, forward, disclose or
otherwise use it, or any part of it, in any form whatever.
If you have received this e-mail in error please notify the sender and
ensure that all copies of this e-mail and any files transmitted with it
are deleted.
Any views or opinions represented in this e-mail are solely those of the
author and do not necessarily represented those of Bury GmbH &Co KG or
its affiliate companies.
___________________________________________________________________________________________Message
Re_ Re_ [lpc2000] Re_ IAP_Flash Programming Time
2005-04-29 by Ralf Knorr
Attachments
- No local attachments were found for this message.