Sample code for how to erase/write LPC1768, LPC11U24, LPC1114, LPC812 and LPC824 internal flash memory. This program uses IAP call of MCU's ROM routines. The IAP library also supports read/write of EEPROM in LPC11U24.

Dependencies:   mbed IAP

Sample code for how to erase/write LPC1768, LPC11U24, LPC1114, LPC812 and LPC824 internal flash memory. This program uses IAP call of MCU's ROM routines.

No filesystem interface available. This program is just an interface to flash erasing and writing. User need manage where to store the data in the flash area.

This IAP library supports read/write of EEPROM in LPC11U24.

More information available in
http://mbed.org/users/okano/notebook/iap-in-application-programming-internal-flash-eras/

Files at this revision

API Documentation at this revision

Comitter:
okano
Date:
Tue Mar 10 04:27:11 2015 +0000
Parent:
5:806960ca964e
Child:
7:e140563d4aad
Commit message:
modified to handle new "iap.read_serial()" function.

Changed in this revision

IAP.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/IAP.lib	Fri Jan 16 08:00:33 2015 +0000
+++ b/IAP.lib	Tue Mar 10 04:27:11 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/okano/code/IAP/#cee1a2a734c9
+http://developer.mbed.org/users/okano/code/IAP/#c8bf974ecb33
--- a/main.cpp	Fri Jan 16 08:00:33 2015 +0000
+++ b/main.cpp	Tue Mar 10 04:27:11 2015 +0000
@@ -43,6 +43,7 @@
  *        revision 3.0  09-Jan-2015   LPC812 and LPC824 support added
  *        revision 3.1  13-Jan-2015   LPC1114 support added
  *        revision 3.1.1 16-Jan-2015  Target MCU name changed for better compatibility across the platforms
+ *        revision 3.1.2 10-Mar-2015  merged with pull requests. reinvoke_isp() added and modified read_serial() to return a pointer.
  */
 
 #include    "mbed.h"
@@ -69,10 +70,20 @@
 int main()
 {
     char    mem[ MEM_SIZE ];    //  memory, it should be aligned to word boundary
+    int     *serial_number;
     int     r;
 
     printf( "\r\n\r\n=== IAP: Flash memory writing test ===\r\n" );
-    printf( "  device-ID = 0x%08X, serial# = 0x%08X, CPU running %dkHz\r\n", iap.read_ID(), iap.read_serial(), SystemCoreClock / 1000 );
+    printf( "  device-ID = 0x%08X\r\n", iap.read_ID() );
+
+    serial_number = iap.read_serial();
+
+    printf( "  serial# =" );
+    for ( int i = 0; i < 4; i++ )
+        printf( " %08X", *(serial_number + i) );
+    printf( "\r\n" );
+
+    printf( "  CPU running %dkHz\r\n", SystemCoreClock / 1000 );
     printf( "  user reserved flash area: start_address=0x%08X, size=%d bytes\r\n", iap.reserved_flash_area_start(), iap.reserved_flash_area_size() );
     printf( "  read_BootVer=0x%08X\r\r\n", iap.read_BootVer() );
 
--- a/mbed.bld	Fri Jan 16 08:00:33 2015 +0000
+++ b/mbed.bld	Tue Mar 10 04:27:11 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf
\ No newline at end of file