Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

Epcs4 interface problem

Hi,

I am using EPCS4SI8N through SPI interface to a microcontroller to write and read data. Right now I have done the connections accordingly but have problems with read and write to the serial EEPROM.

I am not getting any response for any of the opcodes. The logic looks simple but dont know where I am going wrong.

Thanks in advance!

14 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Yeah after I send the WREN, I have done what you have told.

    do{

    pull CS low

    send 0x05

    read from eeprom

    pull CS high

    while(!(read & 0x02))

    So I send it many times until i receive 0x02. But I am receiving 0 from the eeprom.

    Thanks!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    > - pull CS low

    > - send WREN(0x06)

    > - pull CS high

    > - delay();

    propose to insert the following lines, to check that the Flash "wants" to talk with you :-)

    - pull CS low

    - send RDSR (0x05)

    - read 1 byte --> shout be 0x02 (=Write Enable Latch is set)

    - pull CS high

    Regards,

    Heiko
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Yeah the hold pin is high connected to 3.3V. I think my SPI protocol is correct since it worked fine with SD card.

    I have done the following steps:

    - pull CS low

    - send WREN(0x06)

    - pull CS high

    - delay();

    - pull CS low

    -send WRITE(0x02)

    - send address 1st byte (MSB)

    - send address 2nd byte

    - send address 3rd byte (LSB)

    - send data

    - pull CS high

    - delay();

    Even for read its done in a similar way but using read opcodes.

    Thanks!
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    is the hold pin high (pin 7)? You may try to read identifier (command 20h). If you are not sure about the SPI protocol, you may have a look at the data sheet of another Flash e.g. M25P32.

    Regards