S25FL116K usage

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

cross mob
Anonymous
Not applicable

Hi,

   

i'm after some advice on the best way to change data on the flash device.

   

I've typically used eeprom in the past and modifying individual bytes has never been an issue.

   

I see with the S25FL116k device, to write even 1 byte, that location must first be erased (0xFF). 

   

The smallest amount of data that can be erased is a sector (4kB). 

   

Does this mean that i must copy 4kB of data, erase the sector and then re-write with data along with my new data?

   

It seems like i'm missing something. 

   

How do other people approach this.

   

Kind regards,

   

Damian

0 Likes
1 Solution
Anonymous
Not applicable

Hello Damian,

   

Q)Does this mean that i must copy 4kB of data, erase the sector and then re-write with data along with my new data?

   

A) Your understanding is correct. You need to copy the whole of 4KB, erase and then re write.

   

But it is not true in all the cases. Say initially the data in the location is 0x07(00000111) you can program it to 0x05(00000101) as you are not making any zeroes to one.  But you can not write 0x08 as it involves making the 4th bit zero which is not possible. You need to erase so that all the bits will be 1 and then make 4th bit zero.

   

Also when you are writing for the first there is no need to erase. Only if you are updating the already written data and if it involves changing 0 to 1 you need to erase adn rewrite it. This needs to be implemented in your code.

   

As we know in flash programming means changing 1 to 0. We can not make 0 to 1 which is why we erase and make all 1s.

   

Thanks,

   

Krishna.

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

Hello Damian,

   

Q)Does this mean that i must copy 4kB of data, erase the sector and then re-write with data along with my new data?

   

A) Your understanding is correct. You need to copy the whole of 4KB, erase and then re write.

   

But it is not true in all the cases. Say initially the data in the location is 0x07(00000111) you can program it to 0x05(00000101) as you are not making any zeroes to one.  But you can not write 0x08 as it involves making the 4th bit zero which is not possible. You need to erase so that all the bits will be 1 and then make 4th bit zero.

   

Also when you are writing for the first there is no need to erase. Only if you are updating the already written data and if it involves changing 0 to 1 you need to erase adn rewrite it. This needs to be implemented in your code.

   

As we know in flash programming means changing 1 to 0. We can not make 0 to 1 which is why we erase and make all 1s.

   

Thanks,

   

Krishna.

0 Likes
Anonymous
Not applicable

Thank you for your reply,

   

i will implement it in my code.

   

 

   

kind regards,

   

damian

0 Likes
Anonymous
Not applicable

Hi Krishna,

   

i've implemented this in my code but i'm finding that it is taking some time (up to seven seconds to write 5 bytes)  and i'm concerned not only for the time, but the current consumption.

   

My method is to erase a sector which will store my temporary data. I then read the entire sector i wish to store the new data in.

   

I do this in chunks of 256 bytes into ram. When full i write it as a complete page. If my new data falls in the range, it gets stored in the buffer array. i repeat 16 times to copy the entire sector.

   

Once the entire sector is temporarily stored, i erase the "final storage" sector and transfer the data back from the temporary storage sector.

   

I've noted that to erase even one sector can take 450mS and i have to erase two sectors.

   

Can someone recommend another strategy that i can use. I'm guessing it will involve using pointers to the changing memory location instead of a fixed memory location.

   

 

   

kind regards,

   

Damian

0 Likes
Anonymous
Not applicable

Hello Damian,

   

Can you please send the code to us. We will review it and suggest you if it needs any improvement.

   

Thanks,

   

Krishna.

0 Likes