Read SPI EEPROM from FPGA

Thread Starter

mos_6502

Joined Dec 11, 2017
66
Hi to all,

I am trying to read an SPI EEPROM 25LC1024 with an Altera Cyclone IV FPGA. I can't.

I'm using different SPI Master component all Open source, and I make and remake unsuccessfull a FSM for read this EEPROM.
Where could I find a master SPI and an example of FSM (possibly in VHDL) for this EEPROM?
Someone have suggestion for this work? I'm only interested in reading single bytes, not writing!

Thanks!
 

Papabravo

Joined Feb 24, 2006
21,158
Hi to all,

I am trying to read an SPI EEPROM 25LC1024 with an Altera Cyclone IV FPGA. I can't.

I'm using different SPI Master component all Open source, and I make and remake unsuccessfull a FSM for read this EEPROM.
Where could I find a master SPI and an example of FSM (possibly in VHDL) for this EEPROM?
Someone have suggestion for this work? I'm only interested in reading single bytes, not writing!

Thanks!
Do you have the datasheet for the 25LC1024?
Here is a link to the microchip part:

https://ww1.microchip.com/downloads/en/DeviceDoc/22064D.pdf

In it you will find the details of clock phasing and polarity. There are four possibilities. The primary device has to select the correct combination of phasing and polarity in order to successfully read the device. Without the datasheet I suppose you could try all four options.

For an explanation of Clock Polaity and Phase see the appropriate section in the following article

https://en.wikipedia.org/wiki/Serial_Peripheral_Interface
 
Last edited:

Analog Ground

Joined Apr 24, 2019
460
I searched "SPI master in VHDL" and found several. As stated in Post #2, you have to determine what SPI "mode" to use. There are four modes.
 

Deleted member 115935

Joined Dec 31, 1969
0
The FPGA chips configure off this EEPROM or is it separate ?

If so check on the intel / Altera web site, if these pins can be read from by "normal" code,

The configuration proms are accessible via the programming tools, in this case Altera's.
One of the options, unless the chip is secured, is to read back the contents.

Speaking of which, if its configuration code, do you own the copyright for the code ?

If so , why do you need to read it back ? you can just program it again with your code.
 

Thread Starter

mos_6502

Joined Dec 11, 2017
66
Can you elaborate on tried unsuccessfully? Do you get any meaningful responses? For example, do you read all zeros, or all ones, or a mixed string of ones and zeros that you cannot decipher?
What is the speed of SCLK?
I always read $FF (all ones) at all address.
My FPGA clock is 50MHz, the SCLK is 1/10 of it (5MHz), but I also tried with lower frequencies.
The EEPROM chip work well; I can read and write it with CH 341 EEPROM programmer on PC.

Actually I tried adapting a code find on digikey web site ( Serial Peripheral Interface (SPI) Master (VHDL) - Logic - eewiki (digikey.com)

My code is based on a SPI accelerometer ( Accelerometer ADXL345 Pmod Controller (VHDL) - Logic - eewiki (digikey.com)

I attached my VHDL file as .asm file, but is a .vhdl file!
 

Attachments

Thread Starter

mos_6502

Joined Dec 11, 2017
66
The FPGA chips configure off this EEPROM or is it separate ?

If so check on the intel / Altera web site, if these pins can be read from by "normal" code,

The configuration proms are accessible via the programming tools, in this case Altera's.
One of the options, unless the chip is secured, is to read back the contents.

Speaking of which, if its configuration code, do you own the copyright for the code ?

If so , why do you need to read it back ? you can just program it again with your code.
This is an external EEPROM.

I are making my own computer with a propertary CPU and a chip (FPGA) for read/store data on memory (RAM) and read my personal OS from EEPROM at boot.
The EEPROM is programming by mine on normal PC and then it is read from FPGA.
 

Deleted member 440916

Joined Dec 31, 1969
0
There is no SPI master code in your asm file, can you make ALL the code available please not just disjointed snippets, in other words show us exactly what is not working. Can we also have a schematic and picture of prototype, maybe your layout is poor ?
 

Thread Starter

mos_6502

Joined Dec 11, 2017
66
There is no SPI master code in your asm file, can you make ALL the code available please not just disjointed snippets, in other words show us exactly what is not working. Can we also have a schematic and picture of prototype, maybe your layout is poor ?
The SPI Master code is here.

I'm using a Cyclone IV Dev Board: Cyclone IV FPGA Board EP4CE6E22C8N KIT DI SVILUPPO EP4CE6 CPLD altera PLD NIOSII | eBay

The EEPROM is directly connected to IO pins of this board. (I also tried to change pins)
 

Deleted member 440916

Joined Dec 31, 1969
0
You said "Actually I tried adapting a code find on digikey web site" so what exactly did you do to it ?
 

Thread Starter

mos_6502

Joined Dec 11, 2017
66
You said "Actually I tried adapting a code find on digikey web site" so what exactly did you do to it ?
The original code, as posted in post #7 link, read data from an accelerometer.

I modified it to read data from the EEPROM, sending immediately after the read command, 3 bytes for the address (24 bit, as specified in datasheet of my eeprom).
The modified code I attached it to the comment #7.
 

Deleted member 440916

Joined Dec 31, 1969
0
Ahh ok now I understand I will read through it when I have some time :)
I assume your using Quartus, did they tell you how to configure the pins or have you done that yourself ?
Were there ANY warnings during compilation ?
 
Last edited by a moderator:

Thread Starter

mos_6502

Joined Dec 11, 2017
66
How about answering the questions I asked you ?
I only saw now that you added more questions later.

What do you mean by "configuring pins"? I have never configured any pin in a particular way.
What should I do?
I get several warnings, but many are also for a second (much more complex) SPI controller for a SD card and this works without any problem. It is completely independent from that for the EEPROM.

Anyway, if you're asking me these questions I guess you've taken a look at my code and I assume this is correct, so the problem is definitely somewhere else, right?
 
Top