Hi... I'm using the 64J11 right now, and need to store things in NV memory, and yep, this is what I'm doing. A few things... this doesn't apply to a bootloader, but since I only have to store something like 32 bytes, I only need to copy those to RAM before doing erase & rewrite, of course. It costs 1024 bytes of flash to save 32, but hey, these chips go to 40Mhz @ 3.3V and are significantly cheaper than the (slightly older) generation (like the F6520). If the bootloader will be rewriting say everything above 1K in program space (or potentially rewriting it - whatever isn't rewritten is unused), then you can erase a 1K block, then do multi writes to it, sequentially, of course. No need to save anything. Now if the bootloader is designed to be able to rewrite just little arbitrary sections of flash, then you've indeed got the 1K RAM problem. Also note much more limited endurance vs. EEPROM. Like, 1K rewrite cycles, typical, instead of 100K or 1M. This is a problem for me, which I'm going to solve by storing my approx 32 bytes in a series of blocks, so when I do a "save" I find the end of the series of blocks, and write the new values into the erased flash. When I run out of memory (1K, or maybe I'll use several K), erase everything and start over. So in effect spreading the wear over a larger area. Cheers, J Forrest W Christian wrote: > Well, I am working on a bootloader for the 18f46J11.... > > And came across this snipplet: > > "To maintain the endurance of the program memory cells, each Flash byte > should not be programmed more than once between erase operations. Before > attempting to modify the contents of the target cell a second time, an > erase of the target page, or a bulk erase of the entire memory, must be > performed." > > Add to that: "The minimum erase block is 512 words or 1024 bytes." > > This isn't a big problem for the bootloader (rewriting 1024K at a time > is ok - a bit dangerous in page 0, but not a big issue). What is bad > is that this particular pic doesn't have any flash other than the > program memory, so I in effect get to use the program memory as flash > data memory to store my nonvolatile settings. > > Assuming I am reading my datasheet correctly, that means I get to > reserve 1024 of the 3776 bytes of RAM so I can read the entire block of > configuration memory in, make modifications to it, and then re-write > it. Am I missing something? > > -forrest > > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist