Continue to Site

# EEPROM PROGRAMING

Status
Not open for further replies.

#### KingMoshe

##### Member level 2
Hi all,
I hope my question is related to here.
I want to write 256 parameters to EEPROM device from txt file on my computer.
Today I have I2C communication between the FPGA and the EEPROM device and I succeed to read and write from / to the EEPROM.
The only problem is that I need to write each parameter separately because I set only one register for the DATA should be written to the EEPROM.
And the second problem is that I need to program the FPGA each time with a different DATA on this register.
How can I write the all 256 parameter to the EEPROM from txt file on my computer with or without the FPGA?
And it should be easy to change the parameters value without burn the FPGA.
Arduino can be considered also.

Thanks,
Moshe

#### KlausST

##### Super Moderator
Staff member
Hi,

I don´t know
* which exact EEPROM device you use
* the according schematic
* what software you use to read/write the EEPROM
* what hardware you use to read/write the EEPROM
* how this is related to an FPGA

The usual sequence is: (but it depends on the used device, so please read the datasheet)
[ S ] device address + R/W [ A ] adrH [ A ] adrL [ A ] data [ A ] data [ A ] data [ A ] ... [ P ]

Klaus

#### FvM

##### Super Moderator
Staff member
I think the problem is that you are missing clear requirements for the intended operation of your design.

It's a common situation to use an EEPROM interfaced to FPGA as non-volatile parameter storage. The EEPROM would be useless if all parameters are fixed, thus it's also common that the parameters can accessed through another interface of the FPGA, e.g. a parallel processor bus or a serial interface like I2C, SPI or UART. The interface can be also used for other communication purposes.

Another option would be to design the FPGA to EEPROM interface for multi-master operation with direct access for an external processor.

#### KingMoshe

##### Member level 2
Thanks for answers, I will try to give more details.
First, that is my system scheme.

Now, before the system is ready to use, I need to write 256 parameters to EEPROM (parameter = 8 bit DATA).
The parameter are not fixed, and could be changed.
Since the DSP do not have I2C communication interface, I am using the FPGA as a bridge for the DATA from the EEPROM to the DSP.
Today, I can read and write parameters from / to the DSP to / from the EEPROM, but I need the parameters will be on the EEPROM before the first use of the system.
So I am asking if it possible to connect to the EEPROM in parallel the FPGA through I2C and perform the write process? or I can use my FPGA (that already have I2C communication to the EEPROM) and write all the parameter from txt file through the FPGA?
I don't want to use the DSP to write parameters to the EEPROM since all parameters should be on EEPROM before the first use.

#### FvM

##### Super Moderator
Staff member
It's also common to have a set of default EEPROM parameters compiled into the FPGA that take effect unless new parameters have been written from the application.

My favorite method is to keep the parameters in a FPGA RAM block, initialized with default values. EEPROM parameters are conditionally read to the RAM during startup depending on a specific flag or e.g. valid CRC of EEPROM content.

#### KingMoshe

##### Member level 2
It's also common to have a set of default EEPROM parameters compiled into the FPGA that take effect unless new parameters have been written from the application.

My favorite method is to keep the parameters in a FPGA RAM block. EEPROM parameters are conditionally read to the RAM during startup depending on a specific flag or e.g. valid CRC of EEPROM content.
Hi,
What you wrote is the same way as I read the parameters from EEPROM to the DSP. First of all copy all parameters from EEPROM to FPGA RAM, and from the RAM to the DSP.
But my question is how to write all the parameters to the EEPROM from TXT file on my computer before I read them.
The parameters are not fixed, the TXT file is change every time.

Thanks,
Moshe

#### FvM

##### Super Moderator
Staff member
But my question is how to write all the parameters to the EEPROM from TXT file on my computer before I read them.
The parameters are not fixed, the TXT file is change every time.
Asking how to process text files would be rather dedicated to the Elementary Electronic Questions sections...

I don't understand what's the exact problem. Obviously the text file content has to be send through a protocol of your choice either to the FPGA or DSP. The FPGA can e.g. expose an UART interface for test and calibration purposes.

Depending on your application enviroment, you can either chose a custom protocol or use industry standard protocol like MODBUS. Or design your interface so that it accepts a formatted data file like Intel hex.
--- Updated ---

Another option used in some designs is to program the EEPROM indirectly through FPGA JTAG interface via boundary scan methods or virtual JTAG IP compiled into the FPGA.

Last edited:

#### KlausST

##### Super Moderator
Staff member
Hi,

I2C needs pull-up resistors.
The exact EEPROM type is a secret? This makes a detailled discussion difficult.
Why a bridge SPI --> I2C, when there are SPI_EEPROMs?

SPI as well as I2C could be MUXed so you can read/write them via an external device.

Klaus

#### FvM

##### Super Moderator
Staff member
Without loss of generality we can expect a small industry standard EEPROM 24Cxx. Also believe that everyone knows about I2C pull-ups, although it can be possibly omitted in a FPGA interface, using push-pull for SCL and internal pull-up for SDA.

I assume that SPI is additionally used for other communication purposes and preferred for its higher throughput.

MUX option has been already mentioned in post #3, interface choice depends on the overall application requirements.

I believe that plenty of suggestions have been made, KingMoshe should decide and implement.

#### KlausST

##### Super Moderator
Staff member
Hi,

EEPROM details:
I may be mistaken, but I think there are differnt page sizes even on 24Cxx EEPROMs. So one maybe can not write all 256 bytes in a row. Maybe page by page...

Klaus

#### KingMoshe

##### Member level 2
Hi,

I2C needs pull-up resistors.
The exact EEPROM type is a secret? This makes a detailled discussion difficult.
Why a bridge SPI --> I2C, when there are SPI_EEPROMs?

SPI as well as I2C could be MUXed so you can read/write them via an external device.

Klaus
Of course pull up resistors exist.
EEPROM Type: On semi, CAV24C02.
SPI - I2C Bridge because in my workplace an I2C EEPROM is required from some reasons that I don't know about them.

That is my question, how to read and write from the eeprom with external device? what is my options? I need to write from txt file.

#### FvM

##### Super Moderator
Staff member
I see. These details have to be considered, but are belonging to the low level memory interface. Page size of standard EEPROM is 256 byte or 128 words, depending on the chosen memory organisation. 256 "parameters" might refer to 256 words or even double words , in so far writing all parameters can translate to writing multiple pages.

#### KingMoshe

##### Member level 2
Hi,

EEPROM details:
I may be mistaken, but I think there are differnt page sizes even on 24Cxx EEPROMs. So one maybe can not write all 256 bytes in a row. Maybe page by page...

Klaus
you right, the EEPROM have 16 pages, for me it is OK to write each parameter separately. the question is how to write from txt file directly to the eeprom, or how to write from txt file directly to the FPGA and then I can use the I2C communication that I already implemented between the FPGA and EEPROM.
--- Updated ---

I see. These details have to be considered, but are belonging to the low level memory interface. Page size of standard EEPROM is 256 byte or 128 words, depending on the chosen memory organisation. 256 "parameters" might refer to 256 words or even double words , in so far writing all parameters can translate to writing multiple pages.
Lets say I need to write only one parameter (parameter = 8 bit of DATA) from txt file to the EEPROM or to the FPGA, how can I do it ?

#### FvM

##### Super Moderator
Staff member
That is my question, how to read and write from the eeprom with external device? what is my options? I need to write from txt file.

Generally, you should be prepared to do some FPGA coding and also PC programming. Ideally, a suitably formatted text file can be send via a terminal application (e.g. Putty) to an UART interface implemented in the FPGA, interpreted by the FPGA code and written to the EEPROM. A similar function can be implemented on the DSP. Alternatively an universal programmer can be connected to the EEPROM I2C lines and write the data.
--- Updated ---

Consider the FPGA implements an UART interface and a serial command shell.
A write command could have the form
Code:
w<hex address> <hex data><CR>

Different addresses may access internal registers, RAM blocks or directly map to EEPROM writes.

Last edited:

#### KingMoshe

##### Member level 2
Consider the FPGA implements an UART interface and a serial command shell.
A write command could have the form
Code:
w<hex address> <hex data><CR>

Different addresses may access internal registers, RAM blocks or directly map to EEPROM writes.
The FPGA implements SPI Communication with the DSP as described in the scheme above. (user logic SPI)
And I can connect with external device to the SPI BUS if needed.

Status
Not open for further replies.