Site Search

Hello, I'm Duck.

 

I've written many articles about the C language.

In an embedded system, the flash memory is the place where the code written in C is compiled and written.

What kind of memory is Flash memory?

Memory type

Let's take a look at how Flash memory is positioned.

The classification of memory is as follows.

RAM DRAM/SRAM/MRAM etc.
ROM EEPROM/Flash/CDROM etc.

Originally,

・RAM: Volatile memory that operates quickly but does not retain data when the power is turned off
・ROM: Non-volatile memory that operates slowly but retains data

However, in recent years, unexpected RAM such as MRAM has also appeared. 

 

The flash memory that we are dealing with here is non-volatile memory.

Data can be easily changed, and in familiar terms, this flash memory is used in USB memory.

Features of Flash memory

I thought that USB memory was convenient because I could overwrite it freely, but I was shocked by a word from the in-house training instructor.

 

Lecturer "Do you know that Flash cannot rewrite data?"

I "... Eh?"

 

What does that mean?

Flash memory operation 1 - data writing -

The initial state of Flash memory is a state in which all bits are 1.

 

The only write operation in Flash memory is to change 1 data to 0.

You cannot go from 0 to 1, which is the inverse operation. Also, although the unit that can be written differs depending on the device, it is generally 1 Byte unit or word (2 Byte) unit.

Flash memory write operation

  

However, with this method, data once written cannot be changed. What should I do?

Flash memory operation 2 - data erasure -

Another operation that Flash memory can do is erasing data.

 

However, this erase operation will change all 0 data to 1 block by block.

Block sizes vary by device, but can be quite large for writes, such as 64 KB.

Flash memory erase operation

  

There are only two ways to change data in Flash memory.

 

So overwriting it takes a little effort.

As an example, let's use the PC as the host and change the yellow colored part of the data in the Flash memory.

How to overwrite Flash memory

  

You save it in a buffer once, modify that data, and write it to Flash memory.

Also, if the process of writing all 0s to the flash memory is automatically performed by the flash memory, there is no need to be aware of it.

As you can see, even changing just one bit in Flash requires many steps.

I want to remember +α

Since FPGAs are generally volatile, it is necessary to use a non-volatile memory called configuration ROM to store design data.

Flash memory is mainly used.

Altera offers EPCQ and EPCQA as serial flash memory specifically for configuration.

After doing a little research, I discovered that Altera has recently released the MAX® 10 device, an FPGA with a built-in configuration ROM.