I'm programming flash memory of MPC5606B through JTAG interface using Nexus. I'm imitating a tool that perform this task. However, in the middle of the process, the entire flash memory is erased. I skipped this part in code, but, when I do this, the write to memory does not work. Of course I have a backup of the memory, but, I was wondering, to allow programming the data flash is necessary to erase a block memory? I mean, the procedure is a bit long, so, I was wondering if I can just to write in memory positions.

The tool makes a selection of 4 blocks of 16kB to be erased, it is the entire dataflash of MPC5606, 64kB. So, I can erase only 16kB instead of 64kB, but, my doubt is, is really necessary to erase a block of 16kB, or the entire memory of 64kB, just to write some bytes , for example 16 bytes, in the flash memory ?

I looked about this information on datasheet and documents like AN4365 and I didn't find nothing.

Please, any help will be appreciated. With my bests regards , Daniel.

1 Answer 1


At a guess, it is using NAND flash. This type of flash has good density and is reasonably cheap but it has one limitation: individual bits can be only toggled from 1 to 0 but not the other way around. If you need to set any bit to 1, you need to erase it, and NAND can only be erased in whole blocks (block size and layout is chip-specific). So, to write almost any byte you usually have to save the contents of the current block, erase it (turning all bytes to FFs), then write out the saved contents with the updated byte value.

This is indirectly confirmed by the appnote:

When flash memory blocks have been erased, they then can be programmed.

I.e. it is assumed that the blocks to be programmed (=written to) have been erased first. However, writing bytes that only change individual bits from 1 to 0 might still work even without erasing so you can try that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.