Accessing Serial Flash Memory Using SPI Interface 4 spiflashread This function reads the content from the serial flash. The data is read from the memory location specified by the first parameter. This address ranges from 0 to SPI flash size and is not the processor’s absolute range. SPI Serial EEPROM/Flash Programming Utilities SDFlash EEPROM/Flash Programming Algo Version 1.0 This download includes algorithm files that can be used with SDFlash to program a SPI Serial EEPROM/Flash connected to SPI-A of a C2834x device. SDFlash is a product of Spectrum Digital Inc. (www.spectrumdigital.com) Document updated: June 8, 2009. I'm Designing a board using TMS320C5515 DSP where in I'm planning to use 24 Bit SPI serial Flash to load my application program and boot from it. Is there a programmer available using which I can program the 24 bit SPI flash. The available programmer for C5515 EVM doesn't have the 24 Bit SPI programming.
The SF600 is a high speed 'in System Programming' programmer to update the SPI Flash soldered on board (In-Circuit Programming) or in the socket adaptor (Offline programming). The programmer is easily controlled by the computer DediProg Software through the USB bus offering a friendly interface and powerful features to users.
In embedded systems, a memory device is a physical device that is able to store data that can be used to communicate or perform a certain function. Memory devices can be interfaced through multiple different serial protocols, including SPI, or Serial Peripheral Interface. There are multiple different types of SPI memory devices used in embedded systems, including Flash memory and EEPROMs. In this article, we’ll provide a background on their relationship and a comparison between the two.
Example of EEPROM on Circuit Board. Photo by Micah Elizabeth Scott on Flickr.
Differences Between Flash Memory and EEPROM
SPI Flash memory and EEPROMs are both considered to be nonvolatile memory. Nonvolatile memory means the device is capable of retaining data without the need for constant power, allowing devices to save information even when turned off. They are both electronically writable and erasable memory and are microcontroller-based applications, which means they are used either on or off chip to store information.
While Flash memory and EEPROM devices are both able to store information used in embedded devices, their architecture and operations for reading, writing, and erasing data slightly differ.
EEPROM, which stands for Electrically Erasable Programmable Read-Only Memory,
is a type of memory where data is read, written, and erased at the byte level. Flash memory, on the other hand, which is a type of EEPROM, is architecturally arranged in blocks where data is erased at the block level and can be read or written at the byte level.
What are the Advantages and Disadvantages of Using Flash Memory vs EEPROM?
There are various advantages and disadvantages to using either Flash memory or EEPROM devices:
Because EEPROMs operate their erase functions on a byte-per-byte basis, this increases the time taken to clear and edit the device but it allows developers to edit specific parts if needed. Flash memory is able to erase the device in large chunks of data, which considerably improves the erase speed and allows the device to store information more compactly. However, because of this, it also loses its ability to edit certain bytes, forcing developers to rewrite entire blocks of data upon any changes.
Performing a number of erase and write cycles on a memory device will cause it to eventually degrade over time. One of the advantages of using EEPROM is its improved lifespan. EEPROMs are able to perform up to 1,000,000 erase/rewrite cycles in its lifetime. Depending on the type of Flash memory, Flash devices have a reduced lifespan where most flash products are able withstand around 10,000 to 1,000,000 erase/write cycles before the wear begins to deteriorate the integrity of the storage.
Additionally, in terms of size and cost, Flash memory has a smaller memory cell size than EEPROM and is cheaper to implement.
Flash vs EEPROM Applications
SPI Flash memory, also known as Flash storage, has become widespread in the embedded industry and is commonly used for storage and data transfers in portable devices. Common devices include phones, tablets, and media players, as well as industrial devices like security systems and medical products. Flash memory is particularly useful for static data applications like USB Flash drives.
EEPROMs are also very common in embedded applications, and are frequently used for storing minimal data quantities in computer and electronic systems and devices.
Types of EEPROM and Flash Memory
There are different types of EEPROM and Flash memory. EEPROM supports both serial and parallel access. Serial EEPROMs are interfaced through serial protocols like I2C or SPI. Because of this, it includes a limited number of pins and is able to operate over a minimum number of lines – typically two to four.
Parallel EEPROMs are interfaced using parallel communication using an 8-bit bus and require additional pins to operate – typically up to 28 to 32. While parallel EEPROMs operate faster than serial EEPROMs, serial EEPROMs, including SPI and I2C EEPROMs are preferred due to their simplicity and widespread adoption of I2C and SPI in numerous devices.
There are also multiple types of Flash memory, with NAND and NOR Flash being the most common. Both NOR and NAND Flash offer different advantages for certain applications. NOR Flash offers quicker read speeds and random-access capabilities, while NAND flash is more suitable for quickly writing and erasing data. NAND Flash is more commonly used compared to NOR flash, as it is optimized for high-density storage and is able to achieve a smaller chip size and cost-per-bit due to not having random-access capabilities.
How Total Phase Supports SPI Flash Memory and EEPROM Devices
Total Phase offers multiple host adapter tools that support reading, writing, erasing, and verifying SPI-based Flash memory and EEPROM devices. Depending on the speed and application, embedded system engineers can use the Aardvark I2C/SPI Host Adapter, Cheetah SPI Host Adapter, or the Promira Serial Platform to interface with such memory devices.
The Aardvark I2C/SPI Host Adapter is a general-purpose host adapter capable of signaling up to 8 MHz as an SPI master and up to 4 MHz as an SPI slave. It also can emulate an I2C master or slave device up to 800 kHz.
The Cheetah SPI Host Adapter is designed to support high-speed programming applications, allowing users to signal up to 40 MHz as a master SPI device. It is able to support up to 3 slave selects. Additionally, it features a pipelined architecture that enables command queuing for maximum throughput.
The Promira Serial Platform is an advanced host adapter tool that is capable of signaling up to 80 MHz as an SPI master and 20 MHz as an SPI slave. It offers multiple other features for advanced programming which include supporting up to 8 slave selects along with support for Dual and Quad I/O.
The Flash Center Software is a software package that allows engineers to quickly erase, program, and verify I2C- and SPI-based EEPROM and Flash memory chips that are interfaced through Total Phase's Promira Serial Platform, Aardvark I2C/SPI Host Adapter, and Cheetah SPI Host Adapter.
Unlike other programmers which can take minutes to program a memory device, the Flash Center Software can program the same device in seconds. The Flash Center Software natively supports a wide range of commonly used I2C- and SPI-based Flash memory and EEPROM devices, but it also allows users to easily add new parts if not already supported.
See how to easily program a Flash memory device using a USB to SPI programmer in the Flash Center Software:
Have questions on how our I2C/SPI host adapters can support your Flash memory and EEPROM applications? Please contact us [email protected] to find out more.
In this post, you will find how to READ/WRITE SPI based serial EEPROM chips like winbond W25X10A / W25X20A / W25X40A / W25X80A, Atmel AT25HP256 / AT25HP512, etc. using Arduino Uno. Same can be done with other Arduino boards also.
I was little “Bit” off and I saw a dead desktop motherboard (ASUS P5KPL-AM/PS) lying around and covered by heavy dust underneath my sofa. Instantly, playing with these little bits instead – came to my mind. It has a winbond W25X80A EEPROM BIOS chip. I was working with Arduino and decided to play with the EEPROM chip. Long before this, I already have faced the problem that when one need to read/write a BIOS chip but do not have any external EEPROM programmer. May be you are one of them as well. If you are one of them or you want to learn how to read/write a serial EEPROM chip just by using any Arduino development board, keep reading.
By reading this article, you’ll learn the following things:
- About EEPROM chips and how they work
- SPI Protocol
- Serial communication between Arduino and computer using python pyserial
Winbond W25X80A is a 8mbit or 1MB EEPROM chip and it is very common to find. It has 8 pins like below and many EEPROM chips has exactly same pin configuration.
|IN NO.||PIN NAME||I/O||FUNCTION|
|1||/CS||I||Chip Select Input|
|3||/WP||I||Write Protect Input|
|5||DIO||I/O||Data Input / Output|
|6||CLK||I||Serial Clock Input|
Note: This chip is operated on 3.3V. Don’t apply 5V on it or it will just get fried up.
Pins and their functions
Chip Select (/CS)
The SPI Chip Select (/CS) pin enables and disables device operation.
The /CS input must track the VCC supply level at power-up. If needed a 10kΩ pull-up resister on /CS can be used to accomplish this.
Serial Data Output (DO)
The SPI Serial Data Output (DO) pin provides a means for data and status to be serially read from (shifted out of) the device. Data is shifted out on the falling edge of the Serial Clock (CLK) input pin.
Write Protect (/WP)
The Write Protect (/WP) pin can be used to prevent the Status Register from being written.
The Hold (/HOLD) pin allows the device to be paused while it is actively selected.
Serial Clock (CLK)
The SPI Serial Clock Input (CLK Dell inspiron 15 windows 10 sm bus controller driver. ) pin provides the timing for serial input and output operations.
Serial Data Input / Output (DIO)
The SPI Serial Data Input/Output (DIO) pin provides a means for instructions, addresses and data to be serially written to (shifted into) the device. Data is latched on the rising edge of the Serial Clock (CLK) input pin.
What is SPI (Serial Peripheral Interface)
SPI or Serial Peripheral Interface is a synchronous serial data transfer protocol used by microcontrollers for communicating with one or more peripheral devices. Two or more microcontrollers can communicate with one another with SPI also. Each SPI devices has three common lines and one device specific line as following:
- MISO (Master In Slave Out) – The Slave line for sending data to the master. In our case its DIO or Data Input Output.
- MOSI (Master Out Slave In) – The Master line for sending data to the peripherals. In our case its DO or Data Output.
- SCK (Serial Clock) – The clock pulses which synchronize data transmission generated by the master. In our case its CLK.
- SS (Slave Select) – the pin on each device that the master can use to enable and disable specific devices. In our case it is /CS or Chip Select Bar (active low).
When a device’s Slave Select pin is low, it communicates with the master. When it’s high, it ignores the master. This allows you to have multiple SPI devices sharing the same MISO, MOSI, and CLK lines.
Modes of operation
SPI has four modes of operation, combine polarity and phase according to this table:
|Mode||Clock Polarity |
|Output Edge||Data Capture|
As per datasheet, our winbond W25X80A EEPROM chip works with both SPI_MODE0 and SPI_MODE3 i.e. raising edge of the clock.
More details on Arduino SPI operations can be found here: https://www.arduino.cc/en/Reference/SPI
Logic level conversion (5V to 3.3V)
As we are using Arduino Uno R3, by default we have 5V logic along with one 3.3V output power line. We must convert Arduino’s 5V logic outputs to 3.3V otherwise the EEPROM chip will be fried in very short time. As this is just for sending binary logic signals i.e. 1 (true) or 0 (false), not for powering up a device – few milliampere of current will be absolutely fine. Hence, a simple voltage divider will do the job done. In a 0-5V logic system, below 2.5V means 0 and above 2.5V means 1. For the EEPROM’s output pins – they are already 3.3V i.e. much higher than 2.5V of threshold. So, there will be no problem detecting 3.3V as 1 (true) and 0V as 0 (false) in the Arduino. If you use a Arduino board that operate on 3.3V, just ignore all these precautions.
Schematic (pin connections)
Link to the schematic: https://easyeda.com/arp14/spi-based-eeprom-reader-writer
List of components needed
- Arduino Uno
- winbond W25X10A/W25X20A/W25X40A/W25X80A EEPROM
- 100 Ω resistor x3
- 220 Ω resistor x1
- 1k Ω resistor x1
- Jumper wires
Pin map from EEPROM chip to Arduino
- Arduino 3.3V to EEPROM pin 8 (VCC)
- Arduino 3.3V to EEPROM pin 3
- Arduino 3.3V to EEPROM pin 7
- Arduino GND to EEPROM pin 4 (GND)
- Arduino pin 10 to EEPROM pin 1
- Arduino pin 11 to EEPROM pin 2
- Arduino pin 12 to EEPROM pin 5
- Arduino pin 13 to EEPROM pin 6
Note: Don’t forget to convert logic level 5V to 3.3V.
Various functions to read/write to/from EEPROM
Full source code can be found on my GitHub page:
How to read a single byte data from EEPROM
How to read a block data from EEPROM
How to download the entire EEPROM
Steps to download the content of EEPROM into a file:
- First, make download_rom() function only active and flash the sketch into your arduino.
- Configure serial port and baud rate in download_rom.py according to your arduino sketch.
- Press reset button in your arduino.
- Run download_rom.py by entering ‘python2.7 download_rom.py‘ in your terminal/cmd window.
- Now press ‘d‘ and hit enter in the prompt in your terminal/cmd window and wait for finish.
How to erase a 4KB block from given address in EEPROM
How to erase a 64KB block from given address in EEPROM
How to erase the entire EEPROM at once
How to write data to EEPROM
How to upload a ROM file to the EEPROM
Steps to upload a file from computer to the EEPROM:
- First, make upload_rom() function only active and flash the sketch into your arduino.
- Configure serial port and baud rate in upload_rom.py according to your arduino sketch.
- Run upload_rom.py by entering ‘python2.7 upload_rom.py‘ in your terminal/cmd window.
- Press reset button in your arduino.
- Enter the file path i.e. ‘/path/to/the/file.rom‘ and hit enter and wait for finish.
How to read manufacturer ID and device ID from EEPROM
Spi Flash Memory Programmer
Usb Spi Flash Programmer
According to the Manufacturer and Device Identification table in the winbond W25X80A datasheet, EF is “Winbond Serial Flash” and 13 is “W25X80A“.
Yes, we can flash a standard BIOS chip with Arduino. It was fun to play with bits, specially – seeing first byte fetched from the EEPROM was just amazing. From now, I am a worry-free person from a bad BIOS flash 🙂
Spi Flash Programmer Schematic
- https://media.digikey.com/pdf/Data%20Sheets/Winbond%20PDFs/W25X10A,20A,40A,80A.pdf – winbond W25X80A datasheet.
Have anything in your mind? Just comment below.
Hope you learn something!