Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Cannot Read Random Address Serial Flash - HELP -

Status
Not open for further replies.

3BABY

Member level 5
Joined
Jan 14, 2011
Messages
91
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
New Zealand
Activity points
2,252
Hi Guys,

seeing i was not successful after many weeks trying to interface I2C EEPROM.. i decided to try Serial Flash.. as i still needed some sort of non-volatile memory for my project.. but did not want to use a whole heap of I/O pins.. my problem:

i have the Write routine, and a Read routine working.. BUT.. i for some reason cannot Read a Byte from a Random Address, or put more correctly i cannot read the actual data that is there.. i can only read (correctly) the Address i just Wrote to..

for instance.. i am writing ASCII "A" to location 37h, "B" to location 38h, "C" to location 39h, but if i read location 37h i read the value of FFh, if i read back location 38h i get the same FFh, and if i read 39h i get ASCII "C"..

the "data in" routine in the code is working properly i know, because i can read the Status Register correctly.. so im certain that is not the issue. when i write o 37h and then read it back i get the correct value (ASCII "A") and the same with 38h and 39h.. but i cannot write to n locations and then read back all the locations correctly.. the only location i read correctly is the last location i wrote to.

whats going on.. i have read through the datasheets over and over and it doesnt seem like im doing anything wrong.. as far as i know the Writes are ok with data is in the locations.. but why can i only read back the last Address i wrote to properly... what special voodoo do i need to make this work?

im using M25P80 8Mbit Serial Flash Memory

Any help would be much appreciated!!
 

The M25P80 is a PAGE write device. You can't write to individual bytes, you have to write 256-byte pages at a time. Also, you have to erase a page before you can write it. Keep in mind, this is essentially a ROM, not a RAM.

Barry
 
  • Like
Reactions: 3BABY

    3BABY

    Points: 2
    Helpful Answer Positive Rating
SPI serial flash - as well as I2C eeprom - access is pretty straightforward I think. Just follow the procedure given in the data sheet. Serial flash needs to be sector or bulk erased before programming, also a write enable instruction must be issued.

You didn't show any code.

P.S.:
You can't write to individual bytes, you have to write 256-byte pages at a time.
In fact you can write individual bytes, but it's suggested to write a page at once. There's no exact data sheet specification, how multiple partial writes to a page between erases affect the reliability of data storage. To be on the safe side, you should avoid it.
 
Last edited:

The M25P80 is a PAGE write device. You can't write to individual bytes, you have to write 256-byte pages at a time. Also, you have to erase a page before you can write it. Keep in mind, this is essentially a ROM, not a RAM.

Barry


Hi Barry,

thanks for the quick reply, i thought the M25P80 was NOR and could W/R single bytes..

"The high density NAND type must also be programmed and read in (smaller) blocks, or pages, while the NOR type allows a single machine word (byte) to be written and/or read independently."


either way.. thanks for the reply.. looks like ill have to read pages now.. :)

---------- Post added at 10:16 ---------- Previous post was at 10:10 ----------

SPI serial flash - as well as I2C eeprom - access is pretty straightforward I think. Just follow the procedure given in the data sheet. Serial flash needs to be sector or bulk erased before programming, also a write enable instruction must be issued.

You didn't show any code.

Hi FvM.. thanks for the reply.. in my code before i write any bytes i issue a Sector Erase... just while writing this i now realise.. if i issue a Sector erase every time i write a byte.. that would explain why im reading back FFh for location 37h, 38h and then when i read back 39h its ok.. as when i wrote to 38h i Sector erased and that killed all the data in 37h, and then when i wrote to 39h it killed all the data in 38h and also erased 37h for a 3rd time.. Correct?

.. i didnt think it would be worth adding my code as its prity messy and just wanted to get the technicals correct before i started pulling code apart..
 

i thought the M25P80 was NOR and could W/R single bytes..
It is NOR, and by interface functionality can write single bytes. But according to the datasheet, it's not a reliable method to fill the memory pages. There's however a timing specification for single or multiple byte write, and there are surely some applications, that suggest partial writes, e.g. data loggers.
looks like ill have to read pages now..
Reading of individual bytes isn't a problem.
if i issue a Sector erase every time i write a byte.. that would explain why im reading back FFh for location 37h, 38h and then when i read back 39h its ok..
Yes.
.. i didnt think it would be worth adding my code as its prity messy and just wanted to get the technicals correct before i started pulling code apart..

O.K., no problem, I'm convinced you'll figure it out.
 
  • Like
Reactions: 3BABY

    3BABY

    Points: 2
    Helpful Answer Positive Rating
Ok.. so ive just verified in code.. that if i Sector Erase and then Write Random Address Bytes (without sector erasing before each Write) .. then i can Read back Random Address Data Bytes..

the issue now is a Sector Erase sets 65536 Bytes to FFh.. thats allot of bytes to have to pull out store in memory if you only need to change one.. is there any way to just erase a page of 256bytes before you write to it insted of Sector Erasing a whole lot?

or can i just Sector Erase Once and then Write say 00h to a specific Address in order to change it? these is not "Page Erase" in the data sheet.. just Sector Erase and Bulk Erase

---------- Post added at 11:48 ---------- Previous post was at 10:30 ----------

Ok,

so yeah Sector erase is the only way to go.. looks like ill be working on a Old Sector - New Sector copy routine...

thanks for the reply's guys.. i appreciate it!!! :)
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top