Microchip has an application note that does exactly what you describe here. I don't know if it was updated for the PIC32 yet. Isaac Em 30/5/2012 12:06, Ariel Rocholl escreveu: > Mario, > > I think this topic has been discussed here a number of times. For instanc= e > PIC24 has pretty much the same limitation. > > The way you may want to work is not re-writting the whole 4KB block > everytime, but with a bit more ellaborated algorithm, update your variabl= e > in a subset of the region with increasing address, and always read from t= he > last one you sign in any particular way is useful in your application (e.= g. > one byte for actual data, next byte for marking "data used" with anything > different than 0xFF). That increase flash lifetime as reduce erase cycles= , > but also reduce the number of times you need to go to the expensive whole > block erase/rewrite. > > Another option is to alternatively use 2 blocks of flash, 4KB each, one > will swap into the other once is full, and act as a backup so you can > freely erase one block and keep the other one, with basically no use of R= AM > for that. > > Also note you need to use 4KB of RAM if all the memory positions are > actually useful (real data) otherwise you need only a fraction of that to > maintain your real data only, not the whole block. > > Welcome to the non-EEPROM MCU world, anyway ;) > > Hope this helps. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .