Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Re Reflashing in circuit

Re Reflashing in circuit

2004-08-19 by Owen Mooney

Some time ago I posted a message asking for the suggestions to reflash a 
2106 to update the firmware in an existing product

I followed one suggestion which works very well.

This accepts a certain character sequence then uses the IAP programming 
to destroy the first pages in Flash. The user then powers down and up
The micro detects the lack of program and the flash programming utility 
can be used again.

Advantages:

    1. Frees up P0.14 - uses only the serial tx and rx
    2. No external wires needed for reloading firmware
    3. Security - nobody can read our flash without the character 
sequence - micro is set in a great blob of epoxy !
    4. Reflash the firmware without opening the box.

Code:

#define IAP_LOCATION 0x7ffffff1

void reflash(void){
   typedef void (*IAP)(unsigned int [],unsigned int[]);
   unsigned int command[5];
   unsigned int result[2];
   IAP iap_entry;
   __ARMLIB_disableIRQ();
   iap_entry=(IAP) IAP_LOCATION;
   // prepare to erase
   command[0]=50;
   command[1]=0;
   command[2]=4;
   iap_entry(command, result);
   // erase
   command[0]=52;
   command[1]=0;
   command[2]=4;
   command[3]=14745;  // clock frequency
   iap_entry(command, result);
   // wait for power down
   for (;;) ;
}

>
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.