Erasing NOR block 0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Erasing NOR block 0

Jump to solution
619 Views
jBrizzle
Contributor I

Hello,

I'm working writing a custom bootloader for a MK20FN1MVMD12, but I'm running into an issue when I erase block 0. After erasing the entire block by successively calling the erase sector command, any software reads to an address in block 0 results in reading the previous value (not 0xFF). No error is being reported, and the "read 1s section" command indicates that everything was erased properly.

Some potentially important information:

  • This only happens when I erase block 0.
  • I read the data by doing something like "data = ( ( volatile uint32 * )0x00000000 )[ offset ]" where offset is a value < ( block size / 4 ).
  • I am executing out of RAM while performing the erase.
  • The FTFE is unsecure at all times during this process.
  • If I attempt to write >= 0xC1 bytes after erasing the block, I am able to read properly, but no data is actually written at that point. Any subsequent write calls complete as expected.
  • If I use a debugger to look at the erased block, I see that everything was erased, and all subsequent reads in my code work properly.

Any thoughts?

Labels (1)
0 Kudos
1 Solution
498 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

The flash memory controller will come up in a valid configuration with the cache and prefetch buffers enabled.

If a firmware driver is used to program flash values, then a flush of the cache might be needed. The cache has no means of snooping to know when a program operation occurs, so a flush is needed to ensure that the cache does not return stale data.

Wish it helps.   

best regards,

Ma Hui

View solution in original post

0 Kudos
3 Replies
499 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

The flash memory controller will come up in a valid configuration with the cache and prefetch buffers enabled.

If a firmware driver is used to program flash values, then a flush of the cache might be needed. The cache has no means of snooping to know when a program operation occurs, so a flush is needed to ensure that the cache does not return stale data.

Wish it helps.   

best regards,

Ma Hui

0 Kudos
498 Views
jBrizzle
Contributor I

The cache was definitely the problem for me. My NOR driver was not flushing the cache after it wrote or erased which was causing all my problems.

Thanks for your help,

Jordan

0 Kudos
498 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

I am checking this issue. I will let you know when there with any updated info.

Thank you for the patience.

Best regards,

Ma Hui

0 Kudos