Sound player design based on EPG3231 and flash memory

Abstract: This paper proposes a simple method of using large-capacity NAND Flash memory in a single-chip microcomputer system. Compared with the general method, the programmer who writes the application does not need to master the specification of the computer file system. It only needs to operate the NAND Flash according to the timing of reading, writing, erasing, etc., and treat the NANDFlash as NOR Flash or SRAM. The physical address of the memory is transparent to the programmer, and it is only necessary to skip the block when it encounters a bad block (BAD BLOCK). This method reduces the difficulty and cost of using NAND Flash memory, and is applicable not only to EPG3231, but also to general 8-bit microcontroller systems.

In the teaching of single-chip microcomputers, students are more interested in production projects with sound and display. Therefore, this interest in the learning process often allows them to complete the project, gain a sense of accomplishment, and learn more.

At present, in terms of technology, most of the sound storage uses large-capacity NAND Flash, but it is generally stored in the form of a file system, which is difficult for students. The sound file of the sound player is stored in the NAND Flash in a non-file manner, so that the large-capacity NAND Flash memory can be relatively simply used without much background knowledge, which reduces the difficulty of using the NAND Flash memory. cost.

1 sound player overall design

The overall design block diagram of the sound player is shown in Figure 1. The memory is used for storing the sound file, and the single-chip computer displays the sound file name in the memory on the display, and selects the sound file to be played according to the button, and sends the data of the sound file from the memory to the internal D/A converter, D The output of /A is amplified by the amplifier and sent to the speaker to release the sound.


Among them, when selecting a memory, it should satisfy the conditions of large capacity, non-volatile, and low price. According to the above conditions, NAND Flash is the best choice. Here, K9G8G08 type NAND Flash is used, and its capacity is 1 Gbyte. For voice information in WAV format, 8 bit, 22.05 kHz, and mono are sufficient for general needs, and for music (song), the sampling frequency of 44.1 kHz can also achieve better results. Therefore, the device It can store about 800 minutes of voice or 400 minutes of music; the display adopts 122x32 LCM, the built-in controller is SEDl520, which can display 14 Chinese characters or 28 English characters; the keys mainly have playback/pause, stop, up, down Etc., using a separate button; MCU selects ELAN's EPG3231, which is similar to the 5l series MCU.

The key to designing a sound player is to consider how and how the sound data is loaded into the K9G8G08. One can use a U disk directly to download data to the K9G8G08 through a computer, and the sound data is stored as a file. However, it is necessary to complete the interface connection with the U disk in the MCU, and to be familiar with the file format of the computer, which is more difficult for beginners of the MCU. The other is to store the sound data in the K9G8G08 in order (skip when encountering bad blocks), so the physical address of the data storage is transparent to the developer, and then the sound data can be carried by the downloader. Into the K9G8G08. If you put the downloader and sound player together, you can also download the data online.

2 sound player hardware circuit design

2.1 Introduction to K9G8G08

The K9G8G08 is a 1 Gx8 bit NAND flash memory manufactured by Samsung. The operating voltage is 2.7 to 3.6 V. The internal memory structure is (2 K+64) bytes/page x 128 pages/block x 4096 blocks. The external circuit accesses its command register, address register, and data register in a time-sharing manner through a shared 8-bit I/O port to perform operations such as reading, writing, and erasing the device. The naming of its memory can be found in the literature. The K9G8G08 is available in a 48-pin TSOP package with pinouts as shown in Figure 2.


2.2 Introduction to EPG3231

EPG323l is an 8-bit RISC microcontroller from ELAN. It has 11 8-bit parallel ports, 1 8-bit current output type D/A, 1 10-bit successive approximation A/D, and 1 universal asynchronous transceiver UART. One 8, 16, 24 bit serial peripheral interface SPI, three timers, etc., rich in hardware resources, also supports handwriting recognition, speech recognition, ADPCM codec and other functions. In addition, the EPG3-23l is faster, with a command cycle of 125 ns at a clock frequency of 16 MHz.

2.3 EPG3231 and K9G8G08 circuit connection

Figure 3 is a circuit connection diagram of the EPG3231 and K9G8G08. The figure does not show K9G8G08, only the basic circuit of EPG323l and the connection pin with K9G8G08 marked with the network label are given. The 19-pin of the K9G8G08 is write-protected and is connected to +3.3 V (not protected) in the actual circuit. It should be noted that the D/A output of the EPG323l is 48-pin (PBl), and the output current signal needs to be converted into a voltage signal and sent to the subsequent power amplifier. One of the simpler and more feasible methods is to connect a resistor between PBl and ground to complete the current and voltage conversion. The key is the value of the resistor. If the resistance is large, the upper limit of the output waveform will appear limiting distortion; if the resistance is small, the dynamic range of D/A cannot be utilized to the utmost. Therefore, the method for determining the resistance value of the resistor is: first connect an adjustable resistor, write a test program, repeatedly send the value of 00~FFH to the D/A continuously, observe the PBl output through the oscilloscope, adjust the adjustable resistor, and make the output It is a distortion-free sawtooth wave with a maximum point of 3.3 V (ie reference power VREX (70-pin) voltage).


In addition, in Figure 3, the D port (PD0 ~ PD7) of the EPG323l is connected to the I/O port of the K9G8G08. This port must be bidirectional. It is also possible to use other bidirectional ports, but do not use the J port and the K port. The ports are suitable for input/output of buttons (scan output of matrix keyboard), which is slow and cannot be used for communication with K9G8G08. It should also be noted that since the code in the WAV file is unsigned (ie OOH is the lowest level, FFH is the highest level), and the D/A input of the EPG323l is a signed number (ie 80H is the lowest level, 7FH is the highest level), so the highest bit of the WAV sound data should be inverted and sent to D/A.

3 sound player software design

Before the sound player software is designed, the format of the data stored in the K9G8G08 should be determined.

The first is the format of the address. The address of the K9G8G08 internal memory unit operation is sent in 5 bytes, so the format of the address is preferably arranged according to these 5 bytes, as shown in Table 1.


Secondly, according to the characteristics of NAND Flash, there may be a bad block (BAD BLOCK), but BLOCK 0 must be a valid block (VALID BLl3CK), so the bad block information exists in BLOCK 0. The number of valid blocks of K9G8G08 is between 3 99* 096, that is, the number of bad blocks is not more than 100. The block address is determined by A19~A30. To facilitate the programming, the block address is stored in 3 bytes. The arrangement of each address bit is the same as the 3rd, 4th, and 5th bytes in Table 1, and A12~A18. Place O. The bad block information storage area occupies up to 300 bytes.

Third, the directory of the sound file is also stored in BLOCK O. Each record in the directory occupies 64 bytes, of which the first 5 bytes are the starting address of the sound file. Also for the convenience of programming, the address bits contained in each byte are consistent with Table 1; the following 59 words The section is the name of the sound, such as the name of the song, and ends with 0, as shown in Table 2. As can be seen from Table 2, the directory area has a maximum of 4,088 records, which should meet the general needs.


The most critical aspect of software design is the operation of the K9G8G08. In the sound player, the program only needs to read the K9G8G08. Figure 4 shows the software design flow for reading K9G8G08.


The program for the K9G8G08 read operation is called during the timer interrupt. For a WAV file of 22.05 kHz or 44.1 kHz, the interrupt period of the timer is 45.4 μs or 22.7 μs, respectively. For mono, 8-bit WAV files, the frequency can be found in the 18H, 19H bytes of the file header. For the WAV files of 22.05 kHz and 44.1 kHz, the values ​​of these two bytes are 22H. , 56H and 44H, ACH, the sound information starts from the 2CHth byte. Need to explain: 1) The operation of writing the command includes sending the command word and generating a falling edge on the write (WE) control line; 2) writing the 5-byte address is to write 5 to K9G8G08 in the order of Table 1. The address of the byte. The writing of each address includes a send address and a falling edge on the write (WE) control line; 3) the operation of inputting data includes generating a rising edge and reading data on the read (RE) control line.

4 Conclusion

Since the operation of different types of NAND Flash may be slightly different, if the player is to support multiple NAND Flash at the same time, the ID of the device should be read in the program, and different programs for reading NAND Flash should be selected according to their IDs. . The ID of Samsung NAND Flash is available in the literature. The sound player has the playback function of the cassette recorder and the repeater. If the recording function is added, it can be a substitute for the cassette recorder and the repeater because it has no tape and no complicated and fragile mechanical structure. The advantage is that the first two cannot be compared. Just because the 8-bit quantization resolution is slightly lower, it is reflected in the noise of playing a small volume, which is a bit of "呜呜" noise, which is caused by quantization error. It can be solved by using a 16-bit WAV file in the player, but this will double the amount of data. It can also be solved by using the MP3 file. At this time, it is an MP3 player, but you need to add an MP3 decoder (or decode it with software). The method of using NAND Flash proposed here is simple and easy, basically similar to the use of NOR Flash or SRAM. The physical address of the memory is transparent to the programmer, easy to understand and control.



references:

[1]. RISC datasheet http://
[2]. A30 datasheet http://
[3]. A12 datasheet http://
[4]. ACH datasheet http://


:
0 times
Window._bd_share_config = { "common": { "bdSnsKey": {}, "bdText": "", "bdMini": "2", "bdMiniList": false, "bdPic": "", "bdStyle": " 0", "bdSize": "24" }, "share": {}, "image": { "viewList": ["qzone", "tsina", "tqq", "renren", "weixin"], "viewText": "Share to:", "viewSize": "16" }, "selectShare": { "bdContainerClass": null, "bdSelectMiniList": ["qzone", "tsina", "tqq", "renren" , "weixin"] } }; with (document) 0[(getElementsByTagName('head')[0] || body).appendChild(createElement('script')).src = 'http://bdimg.share. Baidu.com/static/api/js/share.js?v=89860593.js?cdnversion=' + ~(-new Date() / 36e5)];

Heat film on Agriculture applications including : greenhouse seedling breeding Heating film, agricultural vegetable greenhouses heating film,,Seedling Heat Mat,Flowerpot heat mat etc.The application of heating film in animal husbandry, such as: hatching fowl heating film,far infrared sterilization heating film,etc.we are a professional and leader Chinese exporter of heat film,Customization options (for example: SMT components, flex cable and connectors) can provide the perfect complete solution that can significantly reduce assembly time and increase productivity.Providing a variety of complex shapes design, and different power designs. Membrane in the same piece electrically heated heating circuit can be designed and holding circuit,we are looking forward to your cooperation.

Seedling Heater System

Heating Mat For Planting Project,PTC Heat Pad,Ptc Heat Film,Heated Pet Mat

ShenZhen XingHongChang Electric CO., LTD. , http://www.xhc-heater.com

This entry was posted in on