Design of automatic bad block detection system based on single chip microcomputer FIash memory

Publisher:云淡风轻2014Latest update time:2014-01-02 Source: eccnKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the rapid development of electronic technology, intelligent electronic products can be seen everywhere, such as PCs, mobile phones, PDAs, digital cameras, game consoles, digital TVs, etc., and the core components of such electronic products are often inseparable from memory. Whether it is from the physical structure of the memory, storage capacity, data reading and writing speed, reliability, durability, or the practicality of the product. There are many types. However, for various reasons, more and more electronic products use NAND-type Flash memory with fast data transmission and large capacity. Although NAND-type Flash has many advantages, it has the inevitable bad blocks generated randomly. If the bad blocks cannot be well solved, it will lead to a high failure rate. Therefore, a DSP-based Flash memory bad block automatic detection system is proposed here.

1 System Design

FIG1 is a block diagram of the Flash memory bad block automatic detection system.

Storage 1


This system design uses AT89C51 to automatically detect invalid blocks of NAND Flash memory, obtain bad block information of Flash memory, and prepare for subsequent data storage. This system design includes two parts: hardware circuit and supporting software design. Its hardware circuit mainly consists of four parts: single-chip microcomputer, control, display and memory. The single-chip microcomputer part adopts the conventional minimum system circuit; the control part consists of buttons and external interrupts of the single-chip microcomputer. The button is connected to the ground terminal through a resistor, and the reset button is connected to the power supply terminal; the display part uses the P0 and P1 ports of the single-chip microcomputer to control the 8-bit seven-segment common anode digital tube, the bit selection end is controlled by the P2 port, and the data end is controlled by the Pl; the memory part is connected to the single-chip microcomputer. Due to the level difference, a level converter 74LVX42-45 is required to convert the 5 V voltage output by the single-chip microcomputer to 3 V, and convert the 3V voltage output by the Flash to 5V. The conversion direction is easy to control. The software design part uses the C language of the microcontroller to write the program. After the data is stored in the microcontroller, it is put into an array using a loop statement, so that up and down queries can be realized by changing a certain variable. The change of this variable is placed in the external interrupt program.

2 Hardware Circuit Design

Hardware circuit design Since the 51 single-chip microcomputer selected is a TTL device, and the NAND Flash memory to be detected is a CMOS device, the voltage levels of these two types of devices do not match, so it is necessary to add a level converter 74154245 to achieve bidirectional conversion between 5 V and 3 V voltage.

2.1 MCU connection

In order to facilitate reading, many wire connections in the circuit schematics of the system design are network labeled, and the naming of the labels is basically based on the pin name. The bit operation of the P1 port of the single-chip microcomputer controls the control end of the Flash, and the P0 port is used as the address and data transmission port of the single-chip microcomputer and the Flash. The flow of data is controlled by P1.6 and P1.7. When reading the data of the Flash, such as reading the ID, first operate the P1 port bit of the single-chip microcomputer, set the control word according to the timing, and then the PO port of the single-chip microcomputer outputs the command to read the ID, and then set the control word of the write address, and input the address 00H. In the read state, continuous RE pulses can output the ID code. The page read operation is similar. Figure 2 is a single-chip microcomputer circuit connection diagram.

Storage 2
  

2.2 Flash memory connection

K9K8G08UOM is a 1 GB high-capacity, high-reliability, non-volatile Flash memory using NAND technology, with high density and high performance. Its invalid block is defined as containing one or more invalid bytes, and its reliability cannot be guaranteed. The information in the invalid block is called invalid block information. Like all valid blocks, it has the same AC and DC parameters. An invalid block will not affect the operation of the valid block because it has corresponding independent instruction resources relying on the selection transistor. The system design must mask its invalid block through the address. In order to ensure that the first block (address is OOh) is a valid block, no error correction l K programming/erase cycle is required.

In addition to the invalid block information that has been loaded first, all storage units of the device are erased, and the invalid block status is defined in the first byte of the free area. There is no FFh in the column address of the 2048-byte first page of each block. In many cases, the invalid block information can also be erased. Once erased, it is impossible to restore its original information. Therefore, the system must recognize the invalid block based on the information of the original invalid block. The system is designed to determine whether the block is an invalid block by reading the first page of each block.

According to the function of each pin in the Flash device data sheet, the circuit connection of Flash is designed. Figure 3 only shows the pins used by the K9K8G08UOM part. The control end of the Flash in the circuit is connected to the Pl port of the microcontroller through a level converter, and the I/O port is connected to the P0 port of the microcontroller through a level converter.

Storage 3

2.3 74LVX4245 Level Converter

The 74LVX4245 provides an 8-bit bidirectional level converter that converts between 5V and 3V. The T/R pin of this device controls the direction of data flow. The transmitter makes data flow from terminal A to terminal B, while the receiver makes data flow from terminal B to terminal A. Terminal A is connected to the 5V bus, while terminal B is connected to the 3V bus, as shown in Figure 4. [page]

Storage 4

2.4 Digital Tube

The common anode digital tube dynamic display mode is adopted. In order to improve the driving ability, a triode drive is adopted, and the digital tube is lit bit by bit with the low level of the P2 port, and the character to be displayed is input into the P0 port. When this system is designed, the first and second bits show the number of bad blocks, and the last three bits show the invalid block address.
  

3 System Software Design

The μVision2 integrated development environment is used. μVision2 supports all Keil toolkits for 8051, including C editor, macro assembler, linker, locator and converter from object file to HEX format. System software design, that is, microcontroller code design, can usually use assembly language or C language. Figure 5 is the main process of invalid block judgment.

Storage 5

The core part of the software in this design is the page read function of the memory. The function defines an unsigned integer variable with a value of 2048. According to the timing of page read, the read instruction 00H is first written into the command register of the Flash by the function Writ-eCommand, and then the address of 4 cycles is written into the address register of the Flash by the WriteAddress function, and then the read command 30H is written into the Flash instruction register by the WriteCommand function. After the delay, the control word of the read status is set, and the cache data is read in 2048 read signal pulses. The complete source code of this function is as follows:

Storage 6

4 Conclusion

This design meets the system design requirements, can read the ID number of the Flash memory, accurately read the number of invalid blocks in the memory and the corresponding physical address, and query the invalid block address up and down through the function button. After replacing the memory with fLash, the distribution of invalid blocks of the device can be well detected. It can be a tool for selecting devices with better performance, and can also accurately obtain the invalid block address, laying a good foundation for future data storage.

Keywords:MCU Reference address:Design of automatic bad block detection system based on single chip microcomputer FIash memory

Previous article:Realizing real-time acquisition of all-digital images using USB2.0 single-chip microcomputer chips
Next article:Design of DC power supply control board based on multiple single-chip microcomputers

Recommended ReadingLatest update time:2024-11-16 14:30

Controlling a two-phase four-wire stepper motor with a 51 single-chip microcomputer
Recently, I learned the driving principle of stepper motors. I practiced it myself according to the textbook and used ULN2003 to drive 28BYJ-48 two-phase five-wire stepper motors. It can rotate normally. I have an old optical drive. I disassembled it and found that there are three motors inside. One of them is a two-p
[Microcontroller]
Design of wireless environment detection system based on MSP430F5438 microcontroller
Environmental monitoring refers to determining the environmental quality (or degree of pollution) and its changing trend by measuring the representative values ​​of factors that affect environmental quality. With the continuous advancement of science and technology, especially the continuous development of computer
[Microcontroller]
Design of wireless environment detection system based on MSP430F5438 microcontroller
Atmega16 MCU experiment: DS18B20 and ad acquisition and display program
rem Main.bas file generated by New Project wizard rem rem Created: Sunday September 16, 2018 rem Processor: ATmega16 rem Compiler: BASCOM-AVR rem Write your code here $regfile = "m16def.dat" $crystal = 2000000 Config 1wire = Portb.0 'Define BS18B20 connected to PB0 Config Lcdpin = Pin , Db4 = Porta.4 , Db5 = Porta.5
[Microcontroller]
Atmega16 MCU experiment: DS18B20 and ad acquisition and display program
Sharing experience of connecting single chip microcomputer to Bluetooth 4.0
Recently, the company wants to develop a smart hardware, connect the hardware through an APP, and send commands to achieve certain purposes. For a newbie who has never been exposed to Bluetooth, I am completely in the dark. So I looked for examples and strategies on the Internet, but the examples and codes were not wh
[Microcontroller]
Experience gained from microcontroller serial port processing (stm32)
       I recently developed a stm32 serial port data frame batch processing code and encountered many problems. As a new worker, I lack experience and really need to summarize it to avoid the same mistakes in the future.       The general situation is listed as follows:       1. Serial port receiving interrupt proce
[Microcontroller]
PlC microcontroller C language programming (10)
4. SLM software simulation debugging of C program pic07.c In "PIC Microcontroller C Language Programming (8)" and "PIC Microcontroller C Language Programming (9)", we have edited and compiled the C program pic07 C. Now we need to check whether the program can achieve the expected design goal, that is, whether it can
[Microcontroller]
PlC microcontroller C language programming (10)
A low-power mass storage system for single-chip microcomputer based on USB flash drive
Introduction In recent years, with the development of Flash Memory non-volatile storage technology, USB-based flash memory, namely U disk, has been widely used. Theoretically, using U disk as the storage medium of portable acquisition and storage system can fully meet the requirements of long-term acquisition of
[Microcontroller]
A low-power mass storage system for single-chip microcomputer based on USB flash drive
Implementing encryption application of SRAM process FPGA using microcontroller
In the design of modern electronic systems, programmable logic devices have been widely used due to their excellent performance, flexible and convenient upgradeability. Since large-scale high-density programmable logic devices mostly use SRAM technology, the FPGA device is required to be reconfigured every time it is p
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号