NAND Flash is a non-volatile memory using NAND structure technology. It has the characteristics of ROM memory. The data stored in the chip can be maintained for 10 years without loss in the case of power failure, and the chip pins and access have similar characteristics to RAM. NAND FLASH memory multiplexes the data line and address line into 8 lines, and also provides command control signal lines. Therefore, the number of pins of NAND FLASH memory will not increase due to the increase of storage capacity. This greatly facilitates system design and product upgrades.
1 Component Introduction
1.1 MSP430 chip
The MSP430 series of microcontrollers is a 16-bit RISC series of microcontrollers launched by TI. This series is a group of ultra-low power microcontrollers with a power supply voltage range of 1.8V-3.6V. Considering the requirements of micro volume and low power consumption of this system, MSP430F149 is selected here. It has 60KB Flash Memory, 2kb RAM, 8 channels with a 12-bit A/D converter with a sampling rate of 200K, hardware multiplier, 2 16-bit timers with a large number of capture/compare registers, watchdog, etc., which provides a good foundation for the further development and expansion of the system, and is particularly suitable for the development of more complex systems.
1.2 NAND Flash
NAND Flash is a new generation of data storage device launched and developed by Sumsung. Here we use K9F1G08U0M chip, with power supply voltage of 2.7V-3.6V, which is consistent with MSP430F149, low power consumption, capacity up to 128M×8Bit, read and write by page, erase by block, and use I/O port as command pin/address pin/data pin in time-sharing multiplexing. It has high reliability.
2 Hardware Design
In this system, the data input and output port of K9F1G08U0M is connected to the P6 port of the microcontroller. The chip select signal is connected to P2.4 of the microcontroller. CLE (command latch control terminal), ALE (address latch control terminal), WE (write operation control terminal), and RE (read operation control terminal) respectively control the levels of the microcontroller P3.3, P2.3, P2.6, and P2.5 pins to determine the level of the FLASH.
Control word operation, address operation, write operation or read operation. The write protection function is not used here, so WP is connected to a high level. The circuit composed of the partial connection between FLASH and the microcontroller is shown in Figure 1.
Figure 1 Connection between MSP430F149 and K9F1G08U0M
3 Software Design
There are many development software for MSP430. This article uses IAR's integrated development environment - IAR Embedded workbench, and uses C430 (MSP430 series C language) to write and debug. The microcontroller's operations on FLASH mainly include writing, reading, and erasing.
3.1 Write Operation
Writing data to FLASH is page-based. The command word, address and data of K9F1G08U0M are all operated in time-sharing mode through the parallel port lines I/O0-I/O7 under the control signal. Addresses A0-A10, A11-A26 are sent in 4 times through I/O0-I/O7. At the same time, the K9F1G08U0M chip provides a status indication signal line. When the signal is low, it indicates that FLASH may be busy in the erase, program or read operation; when it is high, it indicates that it is ready, and various operations can be performed on the chip. The write operation flow chart of 126M data to be written in this system is shown in Figure 2. [page]
3.2 Read Operation
There are three types of read operations: serial page read, continuous row read, and random read. Serial page read is selected here. First, input the read operation control word 00h, then write the address, write the control word 30h, and after the signal becomes high, read out the data of this page in sequence. Then change the page address to read out the data in other pages. The operation flow chart is shown in Figure 3.
Figure 2 Write operation flow chart
Figure 3 Flowchart of the program to read FLASH data
3.3 Erase Operation
Any write operation of the FLASH device must be performed in an empty or erased cell, so the FLASH must be erased before the next data storage.
The erase operation is based on blocks. There are 1024 blocks in K9F1G08U0M. The input of block address requires two cycles. The address of block operation is only valid from A18 to A27, and A12 to A17 are ignored. The block erase command (D0h) sent after the address starts the block erase operation. After the signal becomes high, the command word 70h is sent, and the value of I/O0 is read to determine whether the data erase is successful. Figure 4 is a block erase flow chart.
Figure 4 Flowchart of erasing FLASH program
4 Programming
Here is a partial program of write operation. Read operation and erase operation can be programmed by referring to the flowchart in the article. It is worth noting that other specific write address operations should be read carefully [page]
K9F1G08U0M chip information.
#include
#define CLE BIT3
#define ALE BIT3
#define WE BIT6
#define CE BIT4
#define RE BIT5
#define RB BIT7
void ReadFlash(); //Read FLASH subroutine
void WriteFlash(); //Write FLASH subroutine
void inituart(void); //Initialize asynchronous serial communication
void Write10h(); //Write control word 10h subroutine
void WriteCommand(); //Write command word write address
void ClrFlash(); //Erase FLASH subroutine
unsigned int k,i,a
void main ()
{
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 &= ~XT2OFF;
do
{
IFG1 &= ~OFIFG;
for (iq0=0x05; iq0>0; iq0--);
} // Check whether the crystal oscillator is oscillating
while ((IFG1 & OFIFG)!= 0);
BCSCTL2 = SELM_2 + SELS + DIVS0;
//SMCLK selects 4M after 2 division
While(k<0xFC00) //Execute when the number of pages is <64512
{
WriteCommand(); //Call the subroutine to write the control word and address
While(i<2048) //Execute loop when the number of bytes is <2048
{
WriteFlash(); //Call the data writing subroutine,
32 bytes
i=i+32; //Number of bytes + 32
}
i=0; //After writing a page, the number of bytes is set to 0
Write10h(); //Call the write 10h subroutine
while(!(P2IN & RB)); //Wait for RB signal to become high
k++; //Page number + 1
}
k=0; //Set the page number to 0
LPM4; //After all is written, MSP430 enters low power mode 4
5 Conclusion
The MSP430 series of microcontrollers have the characteristics of strong real-time processing capabilities, fast running speed, and high cost performance. This article introduces the application of FLASH K9F1G08U0M in an embedded system composed of MSP430F149. The experiment shows that the whole system is simple and reliable, with complete functions and stable operation, and has practical value. The author's innovation point: realizes the application of two low-power chips, MSP430 microcontroller and NAND Flash, in embedded systems, completes the write, read and erase operations of FLASH, and achieves the system's micro volume and low power consumption characteristics.
Previous article:Task switching mechanism and interrupt scheduling optimization of μC/OS-II
Next article:Design of remote meter reading system based on CAN/RS485 double-layer network
Recommended ReadingLatest update time:2024-11-16 22:24
- Popular Resources
- Popular amplifiers
- Automotive Electronics S32K Series Microcontrollers: Based on ARM Cortex-M4F Core
- EDA Technology Practical Tutorial--Verilog HDL Edition (Sixth Edition) (Pan Song, Huang Jiye)
- ARM Embedded System Principles and Applications (Wang Xiaofeng)
- Deep Understanding of Linux Driver Design (Tsinghua Developer Library) (Wu Guowei, Yao Lin, Bi Chenglong)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Bluetooth Low Energy has great potential to improve the user experience of car access control systems
- Ask the master to judge
- MSP430F5529 Getting Started with Small Examples
- PCB layout and wiring rules
- How to drive a three-phase two-Hall brushless DC motor?
- I have published some theoretical articles before. Today I will simulate and verify the real theoretical data.
- SensorTile.box Sound Control LED Brightness
- Automobile complete vehicle EMC testing, complete vehicle electromagnetic compatibility testing, automobile parts EMC testing
- Motor control video FOC sensorless
- Interrupt controller of C6678 developed by DSP