NVM Controller

This week Dr. Shawn pointed out that we do not need to use a boot loader since we just need to erase the flash and write the new data. I looked at NVM (Non-Volatile Memory) controller as an alternative. The NVM library in MPLAB X gives you the ability to read, erase and write to the flash memory. The read, write and erase functions require the starting address and also the number of blocks that are affected. However, the size of blocks for each function is different. this is demonstrated in the table below.

Operation

Size of 1 Block

Read

1 Byte

1 Byte

Write

2048 Bytes

1 Row

Erase

16384 Bytes

1 Page

In order to avoid stalling the PIC32 when performing an operation on the flash memory, boot flash memory (BFM) should be used to run the code and program flash memory (PFM) should be targeted for the particular flash operation. The flash operation can not be performed on the same partition used to run the code without stalling the processor. BFM addressing starts at 0x1FC00000 to 0x1FC02FFF, PFM addressing starts at 0x1D000000 to 0x1D07FFFF.

You may also like...

Leave a Reply