The principle of mobile phone chord chip C520 and the process of playing MIDI music files

At present, there are a variety of polyphonic control chips in the mobile phone market. Yamaha in Japan is used more frequently, Winbond and Macronix in Taiwan, and Zhongxingwei and Zhiduowei in mainland China. The chord chips of various companies have their own characteristics. Among them, the C520 of Zhiduowei can support the playing of national musical instruments, so C520 is selected as the chord music control.

2 C520 chord chip

C520 is a chord chip of Shanghai Zhiduo Microelectronics Co., Ltd., which is specially used to provide crisp and realistic music ringtones and rich game sound effects for mobile phones. The chip integrates 64 chords, 16 tone wavetables and 21 Chinese folk music. It has a MIDI synthesizer with 3D stereo surround enhancement, MIDI GM preset ROM, 16-bit high-performance audio digital-to-analog converter and 2/4 bit ADPCM decoding And other functions.

2.1 Chip characteristics

Compared with other mobile phone chord chips on the market, C520 has the following characteristics:

â‘  It can synthesize the input MIDI signal through the on-chip music synthesizer, or demodulate the input ADPCM signal by the ADPCM demodulator, and then output the waveform through the built-in DAC.

â‘¡ Integrated high-quality MIDI GM sound library with a capacity of up to 3 Mb; provides a national musical instrument sound library in addition to the GM sound library, supports more than 20 national musical instruments such as erhu, zither, pipa; supports multiple sounds and polyphony-at most simultaneously Supports 16 tones and 64 polyphony.

â‘¢ With multiple function ports, it can support mobile phone vibration drive and LCD backlight drive, and can be used to play music synchronized PWM to control colorful lights.

④ The interface with the main control terminal can be a parallel interface or a serial interface; allow the chip to work in DAC input mode and accept input data compatible with the universal serial DAC data format; on-chip FIFO with different input data integrated; typical operating current in standby mode Less than 50 μA.

2.2 Functional unit

The whole chip is composed of IOU (I / O interface unit), SG (music synthesizer), ADEC (ADPCM demodulator), TG (clock module) and ANALOG (logic) module.

IOU completes the interface with the external CPU, controls the internal FIFO and other functional interfaces of the chip; the MIDI data forming the music and the external CPU's control commands to the chip are also sent out through the registers in the IOU. The SG module takes the MIDI data from the IOU's FIFO and synthesizes the music using the wavetable synthesis method. ADEC receives the compressed PCM data, decodes it according to the corresponding control signal, and outputs the decoded 16-bit PCM code to the DSP unit of SG. TG multiplies the input clock and generates an internal clock. ANALOG includes a DAC and AMP that performs low-pass filtering and power amplification on the output signal of the DAC. The internal structure of the C520 chip is shown in Figure 1.

3 Application

3.1 Typical circuit

The control CPU selects Samsung's 32-bit RISC chip S3C4510B. The chip is specially developed for embedded Ethernet applications. The core is ARM7TDMI and supports the THUMB instruction set with high code density. It is suitable for applications that are sensitive to price and power consumption.


Figure 1 C520 internal structure block diagram

Figure 2 Typical application circuit

C520 and S3C4510B can be a parallel interface or a serial interface, but the parallel interface has a faster data transmission speed than the serial interface, so the parallel interface is used in this design. The chip application circuit is shown in Figure 2.

In this circuit, the CS_N of C520 is controlled by I / O P0 of S3C4510B. In fact, if the chip select signal line is enough, you can choose any one of the signal lines in the S3C4510B ROM / SRAM / Flash chip select signal Nrcs [5: 0], which can save 1 GPIO; the same, if Don't want to control the reset of C520, you can connect its reset signal to the reset line nRESET of S3C4510B, so that S3C4510B and C520 will be reset at the same time when the power is turned on; C520 PD pin is the low power consumption state control pin, "1" is the normal working state , "0" is to enter the low power consumption state; C520 IRQ pin is an interrupt output pin, which can be connected to the external interrupt request signal pin XINTREQ of S3C4510B.

3.2 Chip initialization

The initialization of C520 is very simple, including:

① Set the PLL frequency division ratio according to the external clock. The PLL frequency division ratio is determined by the register CLOCK (read: 10h / write: 11h) and the register Master Clock (read: 18h / write: 19h). Internal clock frequency fsys = fclock · (DN + 1) / (DM + 1). Among them DM is the register CLOCK [4: 0], DN is the register Master clock tuning [5: 0], fclock is the external input clock, the internal system clock frequency fsys must be set between 48 MHz and 50 MHz.

â‘¡ Turn on the analog module and write 0 to bit 3 of the Analog Power Down register (read: 66h / write: 67h).

â‘¢ Set Analog Select, select analog function according to register Analog Select (read: 60h / write: 61h).

3.3 Play MIDI music files

C520 can play MIDI FORMAT 0 and MMD format MIDI files.

The ASCII value of the 4-byte data at the beginning of the MIDI FORMAT 0 file is "MThd", and the ASCII value of the 4-byte data at the beginning of the MMD file is "MMhd". ARM sends these two formats of MIDI data differently, and distinguishes them according to the 4-byte data at the beginning of the file before sending.

Send MIDI FORMAT 0 format MIDI file, all data in the file must be sent.

The MMD format file can be divided into four blocks, and each block has an 8-byte header data portion at the beginning. The ASCII code value of the first 4 bytes of the first block header data part is "MMhd", the ASCII code value of the first 4 bytes of the second block header data part is "MMly", and the ASCII code value of the first 4 bytes of the third block header data part is "MMdd". The ASCII code value of the first 4 bytes of the data part of the fourth block header is "MMex". The 5th, 6th, 7th, and 8th bytes of each piece of header data are the length of this piece of data (excluding the header data), the 5th byte is the low byte, and the 8th byte is the high byte. These 4 The hexadecimal data composed of bytes plus the length of the header data is 8, which is the length of this piece of data. The header data of the MMdd block data is followed by compressed MIDI data; the MMly block data is dedicated data for karaoke, and there is no need to send the block when playing MIDI; Mmex is an expansion block.

Figure 3 Play MIDI file flow

When sending MIDI data in MMD format to C520, the MMhd block is sent first, followed by the MIDI data part of the MMdd block (that is, the part except the block name and block length in the block), and the MMly block does not need to be sent.

Figure 3 shows the flow of playing MIDI files.

Conclusion

This article introduces Chido's mobile phone chord chip C520, and gives its principle and internal structure diagram. Using Samsung's RISC chip S3C4510B as the controller, the chord music is realized. The detailed circuit schematic diagram and the flow of playing MIDI music files are given in the article, which can be used as a reference for the application of chord chips in mobile products.

China Single Electric Water Boiler Urn  Suppliers

Here you can find the related products in Single Electric Water Boiler Urn, we are professional manufacturer of Single wall electric water boiler urn, Hot Water Urn , Electric Hot Water Dispenser , Large Water Boiler ,Big Water Boiler with Reservoir and Taps,Commercial Electric Water Boiler Urn,We focused on international export product development, production and sales. We have improved quality control processes of Commercial Electric Water Boiler Urn to ensure each export qualified product.
If you want to know more about the products in Commercial Electric Water Boiler Urn, please click the product details to view parameters, models, pictures, prices and other information about Single Wall Electric Water Boiler Urn,portable hot water dispenser,hot water dispenser for tea,hot water urn shabbat, tea boiler,
Whatever you are a group or individual, we will do our best to provide you with accurate and comprehensive message about Single Wall Electric Water Boiler Urn!

Single Wall Electric Water Boiler Urn

Single wall electric water boiler urn,single wall hot water urn, Single Wall Electric Hot Water Dispenser,Single Wall Water Boiler with Reservoir and taps

FOSHAN FORTUNE ELECTRICAL APPLIANCE CO.,LTD , https://www.coffelady.com