2 sectors are erased instead of 1

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi,

I'm using S25FL256 connected to stm32f7 via SPI (single mode), and I'm trying to erase sector at address 0x600000.

The problem is that when I issue the command "sector erase" (0x21), 2 sectors are erased: address 0x600000, and address 0x6F0000.

Here's the sequence of operations:

tmp_buffer1 = {0,2,4,6,8,10,12,14,16,18}; //10 elements

//WRITE

slld_WriteOp(device_num, (ADDRESS)(0x600000), tmp_buffer1, 10, &dev_st);

slld_WriteOp(device_num, (ADDRESS)(0x6F0000), tmp_buffer1, 10, &dev_st);

//READ

slld_ReadOp( device_num, (ADDRESS)(0x600000), tmp_buffer11, 10); // => tmp_buffer11 now has the following data: {0,2,4,6,8,10,12,14,16,18}

slld_ReadOp( device_num, (ADDRESS)(0x6F0000), tmp_buffer22, 10); // => tmp_buffer22 now has the following data: {0,2,4,6,8,10,12,14,16,18}

//ERASE

slld_P4EOp(device_num, (ADDRESS)0x600000, &erase_res); //this is the sector erase operation (0x21)

//READ

slld_ReadOp( device_num, (ADDRESS)(0x600000), tmp_buffer11, 10); // => tmp_buffer11 is now all 0xFF

slld_ReadOp( device_num, (ADDRESS)(0x6F0000), tmp_buffer22, 10); // => tmp_buffer22 is now all 0xFF

The problem happens also in other sectors, for example 0x200000 (which erases also 0x2F0000). Should I try more sectors...?

The driver code is attached.

Please help... I've been debugging this for days with no avail...

Thanks in advance

Update:

I noticed that also the opposite happens: erasing 0x6F0000 erases also 0x600000

0 Likes
1 Solution
Anonymous
Not applicable

Thanks for the assistance. The problem is fixed. The problem was that something was flipping the address bytes. For example if I sent address 0x00F0000, it was sent as 0x0000F00. Perhaps something inside HAL_SPI functions does that (although my SPI is configured as MSB first). Now I send the address byte by byte and the problem doesn't happen anymore.

View solution in original post

0 Likes
9 Replies
SudheeshK
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hi,

Could you please let us know the complete part number?


Thanks and Regards,Sudheesh

0 Likes
Anonymous
Not applicable

sdhk wrote:

Hi,

Could you please let us know the complete part number?


Thanks and Regards,Sudheesh

Hi,

Thanks for the reply. Here's the complete part number:

S25FL256LAGMFI003

0 Likes
SudheeshK
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hi,

1. How many devices are showing this behavior? Are you observing this with all of the devices that you tested?

2. Can you provide waveform for Program, erase and read operations?


Thanks and Regards,

Sudheesh

0 Likes
Anonymous
Not applicable

1. How many devices are showing this behavior? Are you observing this with all of the devices that you tested?

I tested on 4 different devices and all of them had the problem.

2. Can you provide waveform for Program, erase and read operations?

Top (green) is MISO and bottom (yellow) is CS:

Erase of address 0x600000:

P81218-105506.jpg

Write to address 0x600000:

P81218-105711.jpg

Read from address 0x600000:

P81218-105754.jpg

0 Likes
Anonymous
Not applicable

Any help please?

0 Likes
Anonymous
Not applicable

Here are more images of the CLK (yellow, up) and MOSI (green, bottom) during erase operation (0x21):

Write Enable:

1_write_enable.jpeg

Erase:

2_erase.jpeg

Poll:

3_poll.jpeg

Write Disable:

4_write_disable.jpeg

0 Likes
Anonymous
Not applicable

Update:

Turns out that more data is deleted than I thought.

If I delete sector at 0x600000, looks like all the data from 0x600000 to 0x6F1000 is deleted!

That is 964KB, or 241 sectors.

0 Likes
SudheeshK
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hi,

I need a clarification about the waveform that you provided on December 19th. Why the CS# pin is toggling multiple times during erase and write operations? Please clarify.

Please provide waveform of MOSI and CS# pin for erase and write operations.

Thanks and Regards,

Sudheesh

0 Likes
Anonymous
Not applicable

Thanks for the assistance. The problem is fixed. The problem was that something was flipping the address bytes. For example if I sent address 0x00F0000, it was sent as 0x0000F00. Perhaps something inside HAL_SPI functions does that (although my SPI is configured as MSB first). Now I send the address byte by byte and the problem doesn't happen anymore.

0 Likes