Sector Erase function is missing in QSPI Flash Drivers (LPCXFlashDriverLib)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sector Erase function is missing in QSPI Flash Drivers (LPCXFlashDriverLib)

371 Views
gauravmore
Contributor II

Hi,

We are  using LPC4367JBD208E in our project. We are using W25Q128JVFIM  interfaced over SPIFI lines. In order to access this flash we are using the flash driver library provided by LPCopen  LPCXFlashDriverLib.

In the driver I have made modification with respect to the lines used for SPIFI communication and tested it with the W25Q128JVFIM  using the sample code provided in LPC open.

We found it is working but while testing it is observed that the function provided in the library named

uint32_t EraseSectors(uint32_t adr, uint32_t numsecs)

Performs Block erase instead of sector erase. the Sector erase part is missing. I have attached the QSPI flash code test code for reference. 

It is required  since we want to Erase 4KB sector erase part instead of 64KB block erase.

Kindly refer the code and let us know that whether we have the updated code regarding the sector erase section.

 

Thanks 

Gaurav More

 

Labels (2)
0 Kudos
7 Replies

358 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Gaurav,

I have checked the data sheet of W25Q256JV, I do not think that there is page erase command as the following figure. There is sector erase/Sector Erase (4KB) with 4-Byte Address/Block Erase (32KB)/Block Erase (64KB)/chip erase, but there is not page erase.

That is why there is not page erase api function in the software package I think, if I am wrong, pls update the thread.

Hope it can help you

BR

XiangJun Rong

 

xiangjun_rong_0-1615725669423.png

 

0 Kudos

345 Views
gauravmore
Contributor II

Hi XiangJun Rong

Thanks for the reply.

Yes you are right. there no page erase option for the chip I am using. My query was regarding the sector erase only. If you see the code I shared there is Erase function which requires Addr and sector number as a parameter. This function is actually doing block erase not the sector erase. Sector erase is 4KB and Block erase is 64KB.

Inside the function named

uint32_t EraseSectors(uint32_t adr, uint32_t numsecs)

is actually performing block erase instead of sector erase. Following are the functions called inside the EraseSectors function,

spifiEraseByAddr and inside spifiEraseByAddr function spifiErase is called and inside spifiErase function pHandle->pFamFx->eraseBlock(pHandle, firstBlock); is called. Which I have verified ad my end.

So please confirm the same and also whether we can get the sector erase part inside the library or not?

Thanks

Gaurav More

 

 

0 Kudos

330 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Gaurav,

I see your question, I am sure that the uint32_t EraseSectors(uint32_t adr, uint32_t numsecs) call the blockerase command.

If you want to implement the sector erase function, I suppose you have to implement it yourself. Because the LPC43xx is a bit old, in the latest spifi flash operation for LPC54xxx, we do not use the QSPI Flash Drivers architecture, so it is impossible to update QSPI Flash Drivers in future I think.

Hope it can help you

BR

XiangJun Rong

 

uint32_t EraseSectors(uint32_t adr, uint32_t numsecs) {

SPIFI_ERR_T errCode;
#if !defined (DONT_BLANKCHECK_BEFORE_ERASING)
uint8_t ch = FlashDevice.valEmpty;
uint32_t chw = ch | (ch << | (ch << 16) | (ch << 24);
if (checkblank(adr,(numsecs * (FlashDevice.sectors[0].szSector/4)), chw ) == 0)
return (0); // sector blank, so no need to erase
#endif

spifiDevSetMemMode(pSpifiHandle, false);
errCode = spifiEraseByAddr(pSpifiHandle, adr, adr + (FlashDevice.sectors[0].szSector * (numsecs -1)));
if (errCode != SPIFI_ERR_NONE)
return (errCode);

spifiDevSetMemMode(pSpifiHandle, true);

return (0);
}

/* Erase multiple blocks */
SPIFI_ERR_T spifiErase(const SPIFI_HANDLE_T *pHandle, uint32_t firstBlock, uint32_t numBlocks)
{
SPIFI_ERR_T err = SPIFI_ERR_NONE;

if ((firstBlock + numBlocks) > pHandle->pInfoData->numBlocks) {
return SPIFI_ERR_RANGE;
}

/* Only perform erase if numBlocks is != 0 */
for (; (numBlocks); ++firstBlock, --numBlocks) {
err = pHandle->pFamFx->eraseBlock(pHandle, firstBlock);
if (err != SPIFI_ERR_NONE) {
break;
}
}

return err;
}

/* Erase multiple blocks by address range */
SPIFI_ERR_T spifiEraseByAddr(const SPIFI_HANDLE_T *pHandle, uint32_t firstAddr, uint32_t lastAddr)
{
uint32_t firstBlock, lastBlock;
SPIFI_ERR_T err = SPIFI_ERR_RANGE;

/* Get block numbers for addresses */
firstBlock = spifiGetBlockFromAddr(pHandle, firstAddr);
lastBlock = spifiGetBlockFromAddr(pHandle, lastAddr);

/* Limit to legal address range */
if ((firstBlock != ~0UL) && (lastBlock != ~0UL)) {
err = spifiErase(pHandle, firstBlock, ((lastBlock - firstBlock) + 1));
}

return err;
}

0 Kudos

326 Views
gauravmore
Contributor II

Hi XiangJun Rong,

Thanks for the reply.

In the reply you mentioned that SPI flash driver will not be updated in future. any reason for the same. I thing this SPI flash is for LPC43XX tri-core controller where there as two versions on chip flash and using external flash. 

So is it a case that LPC43XX will not be continued further. Con you please confirm this since i am going to use the flash in my project due to some application requirement and also regarding the same there is a possibility that I may require support for the same.

Thanks 

Gaurav More

 

 

0 Kudos

319 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Gaurav,

Maybe what I said is not clear, the LPC4367 was released in 2015 year, it has 15 year tenure, in other words, it can be available till 2030 year.

Because of lack of  work resource, we have not plan to update the QSPI Flash Drivers till now, I mean you have to modify the flash driver code yourself rather them software package team.

Yes, we provide support for the LPC43xx.

BR

Xiangjun Rong

 

 

0 Kudos

316 Views
gauravmore
Contributor II

Hi Xiangjun Rong

Thanks for the reply.

Also thanks for the proper clarification. It means there is a possibility that in future the patch will be available but now it is not there . m i understood correctly?

 

Thanks

Gaurav More

0 Kudos

310 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Gaurav,

Yes, there is a possibility that in future the patch will be available but now it is not there.

BR

XiangJun Rong

0 Kudos