Rev. 2.1 12/03Copyright © 2003 by Silicon LaboratoriesAN129-DS21AN129WRITING TO FLASH FROM APPLICATION CODERelevant DevicesThis application note applies to the following devices:C8051F000, C8051F001, C8051F002, C8051F005,C8051F006, C8051F007, C8051F010, C8051F011,C8051F012, C8051F015, C8051F016, C8051F017,C8051F206, C8051F220, C8051F221, C8051F226,C8051F230, C8051F231, C8051F236, C8051F020,C8051F021, C8051F022, C8051F023, C8051F300,C8051F301, C8051F302, C8051F303, C8051F304,and C8051F305.Note: This application note replaces AN109 (formerly AN09).IntroductionThe FLASH memory on all Silicon Labs MCUdevices is writable from application code. Thiscapability allows user software to store values tothe FLASH, such as calibration constants or systemparameters, and to implement a boot loading fea-ture in which user firmware can be updated in-sys-tem from a remote site.This document starts with the basics of writing toFLASH from application code on any Silicon LabsMCU device. Then it discusses details specific toeach device series. Example code for each deviceseries that shows how to read and write FLASH isincluded at the end of this note.Key Points•Disable interrupts before setting PSWE to ‘1’ to prevent interrupt service routines, which may access variables in x data space, from generat-ing MOVX writes which could corrupt FLASH memory.•It is strongly recommended that the VDD mon-itor be enabled during FLASH write and erase operations to prevent data corruption resulting from power irregularities or power-down con-ditions. •In 'C', the pointer used to de-reference FLASH writes should NOT be located in x data space (data and idata are appropriate). Items of Note•Be cautious when using the ‘Large’ and ‘Com-pact’ memory models, which targ...