AnsweredAssumed Answered

flash erase error

Question asked by Boyeon Kim on Oct 30, 2018

I'm trying to erase a 16KB block and write some data again in the same block.

But this process causes an ECC error as a reason that I don't expect.

It doesn't happen at the same addess all the time neither same number of try for writing/erasing.

I think this error starts from "pFlashCheckStatus" library function in flashBlockErase.

(All functions related to flashWrite/flashErase are from NXP.)

 

Here is my test process.

 

**target block : 0xF8C000 ~ 0xFA3FFF

1. Read the block with certain length (in this case, length = 10)

2. Erase the block if it is not 0xFFFFFFFF

3. Write data in the block

4. Unlock the block with below code that I added with my intention because I think it should be unlocked for next writing.

CLEAR32(FLASH_REG_BASE + LOCK0_REG_OFFSET, 0x00010000);

5. Wait 10~15 seconds to make sure the flash process is done.

6. Repeat step1 to 5.

 

 

** This function is that we got from NXP.

void flashBlockErase(uint32_t startAddress) {
tLibSsdBlockInfo bInfo;
N256K_BLOCK_SEL n256KBlockSelect = {0, 0};
uint32_t opResult = 0;
uint32_t mask;

n256KBlockSelect.first256KBlockSelect = 0;
flashGetBlockInfo(startAddress, &bInfo);
mask = 1 << (31 - bInfo.bit);
switch (bInfo.space) {
case C55_BLOCK_LOW:
ASSERT(C55_OK == pSetLock(&ssdConfig, C55_BLOCK_LOW, (~mask) >> 16));
ASSERT(C55_OK == pFlashErase(&ssdConfig, C55_ERASE_MAIN, mask >> 16, 0, 0, n256KBlockSelect));
break;
case C55_BLOCK_MID:
ASSERT(C55_OK == pSetLock(&ssdConfig, C55_BLOCK_MID, (~mask) & 0xFFFF));
ASSERT(C55_OK == pFlashErase(&ssdConfig, C55_ERASE_MAIN, 0, mask & 0xFFFF, 0, n256KBlockSelect));
break;
case C55_BLOCK_HIGH:
ASSERT(C55_OK == pSetLock(&ssdConfig, C55_BLOCK_HIGH, ~mask));
ASSERT(C55_OK == pFlashErase(&ssdConfig, C55_ERASE_MAIN, 0, 0, mask, n256KBlockSelect));
break;
case C55_BLOCK_256K_FIRST:
n256KBlockSelect.first256KBlockSelect = mask;
ASSERT(C55_OK == pSetLock(&ssdConfig, C55_BLOCK_256K_FIRST, ~mask));
ASSERT(C55_OK == pFlashErase(&ssdConfig, C55_ERASE_MAIN, 0, 0, 0, n256KBlockSelect));
break;
case C55_BLOCK_256K_SECOND: ASSERT(FALSE);
case C55_BLOCK_UTEST:
ASSERT(C55_OK == pSetLock(&ssdConfig, C55_BLOCK_UTEST, 0));
ASSERT(C55_OK == pFlashErase(&ssdConfig, C55_ERASE_UTEST, 1 << bInfo.bit, 0, 0, n256KBlockSelect));
break;
default: ASSERT(FALSE);
}
/* Wait until the operation finishes */
while(C55_INPROGRESS == pFlashCheckStatus(&ssdConfig, C55_MODE_OP_ERASE, &opResult, &CtxData));
/* Lock/Unselect the block */
ASSERT(C55_OK == pSetLock(&ssdConfig, bInfo.space, 0xFFFFFFFF));
}

Outcomes