S25FL25S device Parameter 4-KB Sector Erase (P4E-20H) is not working

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
maac_3997091
Level 1
Level 1

Hi,

I'm using device S25FL25S device Parameter 4-KB Sector Erase (P4E-20H) is not working. 

20H- command is erasing the sector only once. If we are erasing same the sector again its not erasing what we have wrote locations.

So, its not writing new data in same sector.  my code;

   Write_Chip_Addr = addr;

   Erase_Chip_Addr = addr % 4096;

   if(Erase_Chip_Addr == 0)

   {

   S25FL164K_EraseSector(Write_Chip_Addr);

   }

  err = S25FL164K_Read(Write_Chip_Addr, sectorBuff, FLASH_MEM_SECTOR_SIZE);

    err = S25FL164K_Write(Write_Chip_Addr, data, len);

   err = S25FL164K_Read(Write_Chip_Addr, &RxBuff[Idx], len);

Erase section:

do

{

setWriteEnable();

err = readStatusReg(flashRxBuff);

retryCount--;

}while(!(flashRxBuff[0] & WEL_BIT) && retryCount);

   //erase

   index= 0;

   flashTxBuff[index++] = 0xDC;//FLASH_SE;

   //4 byte addr

   //flashTxBuff[index++] = (uint8_t)(address>>24);

   flashTxBuff[index++] = (uint8_t)(address>>16);

   flashTxBuff[index++] = (uint8_t)(address>>8);

   flashTxBuff[index++] = (uint8_t)(address>>0);

   err = sendMessage(flashTxBuff, index, flashRxBuff, 0);

Note: Sector erase is working properly (Sector Erase - D8h)

0 Likes
1 Solution
BacemD_61
Employee
Employee
50 replies posted 50 sign-ins 25 replies posted

Hello,

This is correct and that's also what you should expect.

The FL256S has only a set of 32 small sectors (4kB). The rest of the sectors are all 64kB.

Best regards,

Bacem

View solution in original post

0 Likes
9 Replies
BushraH_91
Moderator
Moderator
Moderator
750 replies posted 50 likes received 250 solutions authored

Hello,

Thank you for contacting Cypress Community Forum. We are currently reviewing the issue and will get back to you as soon as we find the resolution.

Have a nice day

Regards,

Bushra

0 Likes
BacemD_61
Employee
Employee
50 replies posted 50 sign-ins 25 replies posted

Hello,

There are few things we need to check and fix:

1. Does the S25FL256S Flash chip support the 4kB sectors? Please check the Ordering Part Number. It must have Model Number (Sector Type) = 0 : Uniform 64kB sectors.

2. Your code is not polling for operation completion. Please make sure to add this Status Register polling to wait for the operation to complete.

3. Your code is also referring to S25FL164K but here we're talking about a S25FL256S.

4. Please change the code used to set the WEL as following by taking out the function "setWriteEnable()" out of the while loop:

setWriteEnable();

do

{

err = readStatusReg(flashRxBuff);

retryCount--;

}while(!(flashRxBuff[0] & WEL_BIT) && retryCount);

Best regards,

Bacem

0 Likes
maac_3997091
Level 1
Level 1

Hi,

Thanks for the reply.

1. It's 64KB  sector Chip.

2. Same  code fine with S25FL256L..

3. All are having command set compatibility as per datasheet.

0 Likes

Hello,

You must poll for operation completion. Otherwise, while the device is still busy, it won't accept any other command.

This may be the root cause of your issue.

Please also check Item # 4 and implement that change as well.

Best regards,

Bacem

0 Likes

Hi,.

For item # 4 also issue.   Same way it's working if I use sector erase command 0xDC.

I think it's not issue. Any way I will once that also..

0 Likes

Hi BacemD,

I tried that way also . Still same behavior..

Thanks

0 Likes

Hello,

Please use a logic analyzer to capture the traces so that we can see what's going wrong.

You should connect all the signals: CS#, SCK, IO0, IO1, IO2 and IO3 and capture all the command sequences that are sent to the flash.

Best regards,

Bacem

0 Likes

Hi,

4KB sector erase working upto 128KB it means 32 sectors. After that only 64KB sectors only working.

Thanks,

0 Likes
BacemD_61
Employee
Employee
50 replies posted 50 sign-ins 25 replies posted

Hello,

This is correct and that's also what you should expect.

The FL256S has only a set of 32 small sectors (4kB). The rest of the sectors are all 64kB.

Best regards,

Bacem

0 Likes