2 Replies Latest reply on Jun 29, 2017 3:03 AM by userc_45205

    Write succeeds, but read returns wrong value

      I'm working with a S25FL127S device. SPI accesses appear to work correctly as I can reliably read the identification, which matches the  datasheet. After applying power, I use the WREN (06h) and PP (02h) commands to write a 256-bye block of data, one byte at a time, where the data for each byte is simply its 0-based index into the block (0, 1, 2, 3...). After writing each byte, I poll the WIP bit in SR1, using the RDSR1 (05h) command, waiting for it to go low, before proceeding to the next byte. I then read the data back, using the Read (03h) command.


      The first byte comes back as 0x00, as expected, but the remaining bytes are all 0xff. What am I doing wrong?

        • 1. Re: Write succeeds, but read returns wrong value

          Hello Jeff,


          Sincere apologies for the delay.


          When you are using page programing command it is recommended to  that a multiple of 16-byte length and aligned Program Blocks be written. For the very best performance, programming should be done in full, aligned, pages of 512 bytes aligned on 512-byte boundaries with each Page being programmed only once. But from your description I understand that you are using PP command and writing only one Byte at a time which is not good. I think in your case when you are issuing PP command only one byte is being written and .  You need to give WREN and PP command again to write second Byte which is not efficient and will result in wastage of time. It is better to write all 256 bytes in to the buffer ans write them at one go .


          Please try writing more than one byte at a time and check if you are able to read more than one byte.





          • 2. Re: Write succeeds, but read returns wrong value

            Thanks for the explanation. I did notice that writing all 256 bytes at once worked, but I didn't know why single-byte writes failed until you explained it.