Reading last byte of the memory return to the beginn doesn´t work at AT25SF041B


I was programming a rounting for calculation the size of the used memory.

For this I´m writing 6bytes at the beginn (adress 0x00) of the flash memory array. After this i start a read funktion at the adress 0x07FFFA and read 12 bytes. In the datasheet is written, if the last byte is read the memory continues reading at adress 0x000000. 

If I read the adress 0x00 direct i get my 6 bytes back.

If i read 12 bytes beginn at adress 0x07FFFA is get 0xFF for every byte. 

Is there some special condition to reset the internal adress counter of the memory, if the last byte was read?

  • Hi,
    There is no special condition to reset the internal address counter of the memory, after the last byte was read.
    That is because, the Read Array command can be used to sequentially read a continuous stream of data from the device.
    The device incorporates an internal address counter that automatically increments every clock cycle.

    To perform the Read Array operation:
    1) The CS pin first must be asserted.
    2) Then the appropriate opcode (0Bh or 03h) must be clocked into the device.
    3) After the opcode has been clocked in, the three address bytes must be clocked in.
    This specifies the starting address location of the first byte to read within the memory array.
    NOTE: If the 0Bh opcode is used for the Read Array operation, an additional dummy byte must be clocked into the device after the three address bytes.
    After the three address bytes (and the dummy byte, if using opcode 0Bh) have been clocked in, additional clock
    cycles result in data being output on the SO pin.
    When the last byte (07FFFFh) of the memory array has been read, the device continues reading back at the beginning of the
    array (000000h). That means wrapping around from the end of the array to the beginning of the array.
    De-asserting the CS pin terminates the read operation and puts the SO pin into high-impedance state.

    Take note that the clocks need to continue to read data as long as you want to read them.
    Do not stop the clock after sending READ array command.

    Finally, you said if you read 12 bytes beginning at address 0x07FFFA you get 0xFF for every byte.
    You did not mention that you wrote anything at address 0x07FFFA (and only 6 bytes of space available till 0x07FFFF).
    Did you write any pattern there? If not you will get 0xFF.
    Are you saying it is not automatically wrapping around from the end of the array to the beginning of the array?
    Or why there is 0xFF at 0x07FFFA? It is 0xFF because you did not write anything there.

    I suggest that you capture the trace of bytes and compare with what you wrote and what you tried to read.

    Best regards,
    Renesas Electronics Online Support

  • Hi, 

    in my first step I wrote 6 charaters (0XB5, 0xDE, 0xAD, 0xBE, 0xEF, 0x5D) from adress 0x00 to 0x06.

    If i start reading at the adress 0x07FFFA and want to read 12 bytes, for my understandig the fist 6 bytes are 0xFF and the last the byte should be the 6 charaters is write into the flash. Because I start reading at 0x07FFFA the byte number 6 have the address  0x07FFFF and the byte 7 should have the address 0x00 right?

    The !CS pin is deselected after the 12 bytes are clocked. See the pink line in the picture.

  • Reads a sequence of bytes from the current memory stream and advances the position within the memory stream by the number of bytes read.
    Tell The Bell

  • Hi Josh69,

    if you click on the image further up, you will see the hole stream with 12 Byte read.

  • Hi,

    Please clarify as to why your clock is not continuous?

    Just to check:

    Write some bytes starting at 0x07FFFA to the end : 0x01, 0x02, 0x03, 0x04, 0x05, 0x06

    Then, Can you run a continuous loop as follows just to check things up =>

    Drive CS LOW.

    Keep CLOCK ON all the time.

    Send op code 0x03

    Send 0x00 three times (24 bits)

    Keep CLOCK active

    Let the loop continue.

    See what it does. 

    Does it read the last 6 bytes?

    Does it wrap around at all? What happens after it reaches last address?

    Let me know.


  • Also, keep the CS LOW while running the READ loop.

  • Hi,

    about the clock. My SPI is interrupt controled, with an low priority interrupt. If a byte is received the interrupt is triggert to read the SPI FIFO and start send out the next clocks for the next byte. Because it is a low priority interrupt is is possible that 3 other interrupt are triggert during the interrupt activ time of the SPI interrupt. 

    If i read address 0x00 to 0x06 i get the correct bytes.

    read address 0x00 to 0x06

    For read operation i use the opcode 0x03.

    I write from 0x07FFFA to 0x07FFFF the data 0x01, 0x02, 0x03, 0x04, 0x05, 0x06.

    I can read back the data i write before but the 7 byte is not correct. 

  • I solve the problem. 

    It was a problem with the addressing. My compiler make something strange with the address.