Linux Driver Development III (the memory of hardware knowledge that must be understood)

Source: Internet
Author: User
Tags volatile

Linux Driver Development III (the memory of hardware knowledge that must be understood)

This article focuses on the basic knowledge of memory, the network on the Ram,rom,flash, etc. have a very detailed introduction, Lao Xie will these knowledge points summarized and annotated as follows. This process of finishing is also a process of deepening memory.

1. What is Memory

In the structure of the computer, there is a very important part, is the memory. Memory is used to store programs and data parts, for the computer, with memory, only memory function, to ensure normal work. There are many kinds of memory, according to its use can be divided into main memory and auxiliary memory, the main memory is also called internal memory (memory), auxiliary memory also known as external memory (external memory). External memory is usually magnetic media or optical discs, such as hard disk, floppy disk, tape, CD, etc., can save information for a long time, and do not rely on electricity to save information, but driven by mechanical components, the speed compared to the CPU is much slower. Memory refers to the storage parts on the motherboard, the CPU communicates directly with it, and uses the parts that store the data, storing the data and programs that are currently in use (i.e. executing), and its physical essence is a group or groups of integrated circuits with data input and output and data storage functions, and memory is only used for temporary storage of programs and data. Once the power is turned off or a power outage occurs, the program and data are lost.

2. How Memory Works

Memory is used to store data and programs that are currently in use (that is, in progress), the memory of the computer we refer to is dynamic memory (that is, DRAM), the so-called ' dynamic ' in dynamic memory, that is, when we write data to DRAM, the data is lost after a period of time, Therefore, an additional circuit is required for the memory refresh operation.


The specific work process is this:
A DRAM storage unit is 0 or 1 depending on whether the capacitor has an electric charge, an electric charge represents 1, and no charge represents 0. But a long time, representing 1 of the capacitance will discharge, representing 0 of the capacitance will absorb the charge, this is the reason for the loss of data; The refresh operation periodically checks the capacitance, if the charge is greater than 1/2 of the charge, it is considered to represent 1, and the capacitance is fully charged, if the charge is less than 1/2, it is considered to represent 0 To maintain the continuity of the data.

From the beginning of a computer, there is memory. Memory development to today also experienced a number of technical improvements, from the earliest Dram to Fpmdram, Edodram, SDRAM, etc., the speed of memory has been increasing and capacity is constantly increasing.

3. Continue discussion on Ram

RAM is the abbreviation for random Access memory. Also known as random access memory, the contents of the storage unit can be arbitrarily removed or deposited on demand, and the speed of access to the storage unit is independent of the location of the memory. This memory loses its stored content when it loses power, so it is mainly used to store short-time use programs.

RAM is divided into two main categories:

    1. Static RAM (Ram/sram), SRAM is very fast, is currently read and write the fastest storage device, but it is also very expensive, so only in a demanding place to use, such as the CPU of a buffer, two-level buffer.

    2. Another known as Dynamic RAM (Ram/dram), DRAM retains data for a short time and is slower than SRAM, but it is faster than any ROM, but the price of DRAM is much cheaper than SRAM, and computer memory is DRAM.

There are many types of dram, common mainly fpram/fastpage, Edoram, SDRAM, DDR RAM, RDRAM, Sgram, and Wram, which describes one of the DDR RAM.

DDR RAM (Date-rate RAM) is also known as DDR SDRAM, which is basically the same as the improved RAM and SDRAM, except that it can read and write two of times on a single clock, thus doubling the data transfer speed. This is the most used memory in the current computer, and it has a cost advantage, in fact defeating Intel's other memory standard-rambus DRAM. On many high-end graphics cards, high-speed DDR RAM is also available to increase bandwidth, which significantly improves the pixel rendering capabilities of 3D accelerator cards.

4.ROM Introduction

ROM is the abbreviation of Read only memory and is a semiconductor memory, characterized by the inability to change or delete data once it is stored. It is usually used in electronic or computer systems that do not require frequent changes to the data and will not disappear due to power off. Solid-State semiconductor memory that can read only the data stored in advance. ROM storage data, usually loaded into the machine prior to written, the whole process can only be read, and not like random memory can be quickly and easily rewritten. The data stored in ROM is stable, the data stored after power failure will not change, its structure is simple, the readout is convenient, so it is often used to store various fixed programs and data. Except for a few varieties of read-only memory (such as character generators) can be common, different users need read-only memory content is different.


The programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), and electrically erasable programmable read-only memory (EEPROM) are further developed for ease of use and mass production. EPROM need ultraviolet light for a long time exposure to wipe, use is very inconvenient. The 1980s of the EEPROM, to overcome the lack of EPROM, but the integration is not high, the price is more expensive. A new kind of flash memory is developed, which is similar to EPROM in the memory cell structure. Its high integration, low power consumption, small size, and can be quickly wiped online, and thus get rapid development.

Simply put, in a computer, RAM, ROM are data memory. RAM is a random access memory, it is characterized by volatile, that is, the loss of electricity amnesia. Rom usually refers to the cured memory (write once, repeatedly read), it is characterized by the opposite of RAM. Rom also divided into one-time curing, light erase and electric erase rewrite two types.

Rom can still hold data while the system is powered off, and ram usually loses data after power-down, typical RAM is the memory of the computer.

the advent of 5.Flash

Flash memory, also known as Flash, combines the advantages of ROM and RAM, not only with electronic erasable programmable (EEPROM) performance, but also without power loss data can be quickly read data (NVRAM advantage), u disk and MP3 used in this kind of memory. In the past 20 years, embedded systems have been using ROM (EPROM) as their storage device, but in recent years Flash has replaced the status of Rom (EPROM) in embedded system, used as storage bootloader and operating system or program code or directly as hard disk.

There are two main flash and Flash and NADN Flash.

Nor Flash read the same as our common SDRAM read, the user can directly run the code loaded in nor flash, which can reduce the capacity of SRAM and thus save costs.


NAND Flash does not take the memory of random read technology, its reading is in a single read a piece of the form, usually read 512 bytes at a time, the use of this technology flash relatively inexpensive. The user cannot directly run the code on NAND flash, so a lot of the development boards using NAND flash use a small nor flash to run the startup code in addition to the NAND Flah.

General small-capacity with nor Flash, because of its fast reading speed, much to store the operating system and other important interest, while the large capacity of NAND flash, the most common NAND flash application is the embedded system using the doc (disk on Chip) and we usually use the ' flash disk ', can be erased online. The current flash on the market mainly comes from Intel,amd,fujitsu and Toshiba, while the main manufacturers of NAND Flash are Samsung and Toshiba.

6.q&a

Question 1: What is dram, SRAM, SDRAM?
For:
dram--– dynamic accessor, need to constantly refresh, in order to save data, and is the row and column address reuse, many have page mode
sram--– static random memory, in case of power-up, no need to refresh, data is not lost, and generally not the row and column address multiplexing
SDRAM ——-synchronous dram, i.e. the reading and writing of data requires a clock to synchronize

Question 2: Why does the dram need to be refreshed and SRAM not required?
For:
This is determined by the type of RAM design, which uses a T and an RC circuit, causing the capacitance to leak and slowly discharge, so it needs to be refreshed frequently to save the data.

Question 3: Why is the use of DRAM more, and the use of SRAM is very small?

For:
1) because the production of SRAM of the same capacity is much higher than that of DRAM, it is precisely because of this that the development is limited. So at present SRAM is basically only used for the first level cache inside the CPU and the built-in level two cache. Only a small number of network servers and routers can use SRAM.

2) different storage unit structure leads to different capacity: A DRAM storage unit requires approximately one transistor and one capacitor (excluding line readout amplifiers, etc.), while an SRAM storage unit requires approximately six transistors. DRAM and SDRAM due to the implementation process problems, the capacity is larger than SRAM, but read and write speed than SRAM.

Question 4: What are the characteristics of the most used dram? What is the condition of its craft? (usually referred to as memory is DRAM.)
For:
1) DRAM needs to be periodically refreshed, and we should not confuse SRAM with read-only memory (ROM) and flash memory, because SRAM is a volatile memory that maintains data only if the power supply is maintained continuously. "Random access" means that the contents of a memory can be accessed in any order, regardless of which location was previously accessed.

2) DRAM and SDRAM due to the realization of process problems, the capacity is larger than SRAM. But read and write slower than SRAM, but now, SDRAM speed is already very fast, the clock seems to have 150 trillion. So the read-write period is less than 10ns.

3) SDRAM Although the operating frequency is high, but the actual throughput rate to be discounted. Take PC133 as an example, its clock period is 7.5ns, when the CAs latency=2, it takes 12 cycles to complete 8 bursts of read operations, 10 cycles to complete 8 bursts of write operations. However, if you access Bank,sdram alternately, you can complete one read-write operation per cycle (except, of course, the flush operation).

4) In fact, now the mainstream high-speed memory is Ssram (synchronous SRAM) and SDRAM (synchronous DRAM). Currently can be easily bought Ssram maximum capacity is 8mb/tablets, the maximum working speed is 166MHz, can easily buy SDRAM maximum capacity is 128mb/tablets, the maximum working speed is 133MHz.

Question 5: What are the characteristics of SRAM commonly used for server caches, which are less used but very fast?

For:
1) SRAM is static, DRAM or SDRAM is dynamic, static is used by the Bistable trigger to save information, and dynamic is to use the electronic, or when the refresh to maintain. SRAM is the abbreviation for static random access memory, which is a type of semi-conductor memory. "Static" means that the data stored in the SRAM is not lost as long as it does not power down.

2) SRAM is actually a very important memory, it has a wide range of uses. SRAM is fast enough to maintain data integrity when fast reads and refreshes. The internal SRAM uses the form of a bistable circuit to store data. So the circuit structure of SRAM is very complex.

3) from the type of transistor, SRAM can be divided into bipolar and CMOS two kinds. In terms of function, SRAM can be divided into asynchronous SRAM and synchronous SRAM (Ssram). The access of asynchronous SRAM is independent of the clock, and the data input and output are controlled by the change of address. All accesses to the synchronous SRAM are started on the rising/falling edge of the clock. The address, data input, and other control signals are related to the clock signal.

The last point to note:
SRAM should not be confused with SDRAM, SDRAM stands for synchronous DRAM (synchronous DRAM), which is completely different from SRAM. SRAM should not be confused with Psram, Psram is a dram disguised as SRAM.

7.NOR vs NAND Flash

About nor and NAND introduction and difference, there are many on the network, if not often used, it is really impossible to say why. Lao Xie is posted here, the purpose is often to see.

Nor and NAND are two of the main non-slipped technologies in the market today. Intel first developed nor Flash technology in 1988, radically altering the original eminence of Eprom and EEPROM. Then, in 1989, Toshiba released the NAND flash structure, emphasizing lower cost per bit, higher performance, and easily upgradeable through interfaces like disks. But after more than 10 years, there are still quite a few hardware engineers who are not clear nor and NAND flash.

Many in the industry are also confused about the superiority of NAND flash technology to nor technology, because in most cases flash memory is used only to store a small amount of code, and nor flash memory is more appropriate. NAND is an ideal solution for high data storage densities.

One, storage difference comparison

Nor is characterized by in-chip execution (XIP, execute in place) so that the application can run in Flash flash memory without having to read the code into the system RAM.

Nor is highly cost effective in 1~4MB small capacity, but very low write and erase speeds greatly affect its performance, as well as its high transmission efficiency.

The NAND structure provides very high cell density, high storage density, and fast write and erase speeds. The difficulty of applying NAND lies in the management of Flash and the need for special system interfaces.

Second, performance comparison

Flash Flash memory is non-volatile memory, can be called Block of memory unit block for Erasure and re-programming. The write operation of any flash device can only be done within an empty or erased unit, so in most cases the erase must be performed before the write operation. The erasure of NAND devices is straightforward, and nor does it require that all bits in the target block be written to 0 before erasing.

Since the erase nor device is carried out in a 64~128kb block, the time to perform a write/erase operation is 5s, in contrast, the erasure of the NAND device is carried out in a 8~32kb block, and the same operation is performed for up to 4ms.

The difference in block size when performing the erase further widens the performance gap between nor and NADN, and statistics show that for a given set of writes (especially when updating a small file, more erase operations must be done in the nor-based unit. This way, when choosing a storage solution, the designer must weigh the following factors.

Nor reads faster than NAND.

Nand writes much faster than nor.

NAND's 4ms erase speed is much faster than nor 5s.

Most write operations require a wipe operation first.

The NAND erase unit is smaller and the corresponding erase circuit is less.

Three, interface differences

NOR Flash has an SRAM interface with enough address pins to be addressable, which makes it easy to access every byte inside of it.

NAND devices use complex I/O ports to sequentially access data, and the methods of each product or vendor may vary. 8 pins are used to transmit control, address, and data information.

NAND read and write operations take a 512-byte block, which is a bit like a hard drive to manage such operations, and it is natural that NAND-based storage can replace hard disks or other block devices.

Iv. Capacity and cost

NAND Flash unit sizes are almost half the size of nor devices, and because of the simpler production process, NAND structures can provide higher capacity within a given mold size and correspondingly lower prices.

Nor Flash occupies the bulk of the 1~16MB flash market, while NAND flash is used only in 8~128MB products, which also shows that nor is it primarily used in code storage media, NAND is suitable for data storage, NAND in CompactFlash, The largest share of Secure Digital, PC cards and MMC memory cards is in the market.

V. Reliability and Durability

One of the key issues to consider when using flahs media is reliability. Flash is a very suitable storage solution for systems that require extended MTBF. The reliability of nor and NAND can be compared from three aspects of longevity (durability), bit switching and bad block handling.

Vi. life expectancy (durability)

The maximum number of erase times per block in the NAND flash memory is 1 million, and nor is 100,000 times the number of erase writes. In addition to the 10:1 block erase cycle advantage of NAND memory, the typical NAND block size is 8 times times smaller than nor, and each NAND memory block is removed less frequently within a given time.

The issue of exchange of bits

All flash devices are subject to the phenomenon of bit switching. In some cases (rarely seen, NAND occurs more often than nor), a bit is reversed or reversed.

One change may not be obvious, but if it happens on a critical file, this small glitch can lead to system downtime. If you just report a problem, read it a few times and it can be solved.

Of course, if this bit really changes, then the error detection/error correction (EDC/ECC) algorithm must be used. Bit reversal issues are more common in NAND flash, NAND vendors recommend using NAND flash while using the EDC/ECC algorithm.

This problem is not fatal when storing multimedia information in NAND. Of course, if you are using a local storage device to store operating systems, configuration files, or other sensitive information, you must use the EDC/ECC system to ensure reliability.

Eight, bad block processing

The bad blocks in the NAND device are randomly distributed. There have been efforts to eliminate the bad block, but found that the yield is too low, the price is too high, it is not cost-effective.

The NAND device requires an initial scan of the media to discover the bad block and mark the bad block as unavailable. In devices that have been made, failure to do so through a reliable method will result in high fault rates. Easy-to-use can be very straightforward to use nor-based flash, can be connected like other memory, and can be run directly on the code.

NAND is much more complex due to the need for I/O interfaces. Access methods for various NAND devices vary by manufacturer.

When using a NAND device, you must write to the driver before you can continue with other operations. Writing information to NAND devices requires considerable skill, as designers must never write to bad blocks, which means that virtual mapping is required throughout the NAND device.

Nine. Software support

When discussing software support, you should distinguish between basic read/write/erase operations and high-level software for disk emulation and flash management algorithms, including performance optimizations.

No software support is required to run code on nor devices, and in the same operation on NAND devices, drivers are often required, i.e. memory technology drivers (MTD), and NAND and nor devices require MTD for both write and erase operations.

There is a relatively small amount of MTD required to use nor devices, and many vendors offer more advanced software for nor devices, including the M-system TrueFFS driver, which is driven by Wind River System, Microsoft, QNX software Used by vendors such as System, Symbian, and Intel.

The drive is also used to simulate and manage NAND flash for diskonchip products, including error correction, bad block handling, and loss.

Itxiebo
20160502

Linux Driver Development III (the memory of hardware knowledge that must be understood)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.