Application of CF Card in DM642 Based Portable Digital Video System

Application of CF card in DM642 based portable digital video system

0 Introduction

At present, digital video system has been widely used in daily work and life, such as monitoring system, video telephone, digital TV, etc. with the progress of technology and work life, the requirements for video image quality are higher and higher, and the amount of data processed is also larger and larger, which puts forward two new problems: on the one hand, the processing capacity of hardware is required to be faster, For example, both monitoring system and video telephone system are required to be real-time; On the other hand, the storage medium of data is required to be larger and easy to carry. In order to realize the independent operation of DSP (digital signal processing) system, a large capacity storage medium is needed to store video data. In this paper, the high-end multimedia processing chip DM642 of TI company is used as the image processing chip. Its powerful computing power, rich peripheral interfaces and complete programmability can be easily used to develop various image systems. The use of CF card can make up for the defect that the on-board flash capacity is usually too small and the data will be lost after SDRAM power failure. At the same time, the pin connection mode adopted by CF card has relatively high seismic resistance and stability, and can better meet the requirements of portable equipment. In terms of video coding and decoding, MPEG-2 algorithm provided by TI company can basically meet the requirements of compression efficiency and quality.

1 Introduction to CF card

The full name of CF card is compact F1ash. It was first launched by SanDisk in 1994 and has now become an industry standard. Its internal diagram is shown in Figure 1. CF card consists of two basic parts: control chip and flash memory module. The control chip is used to connect with the host and control the transmission of data in the flash memory module, which is used to store information. The CF card is compatible with 3.3V and 5V operating voltages and supports a variety of interface access modes. At present, the capacity of CF can be as high as 100GB, the mainstream capacity has reached 4GB, and the price has been reduced to about tens of yuan, which is very cost-effective.

2. Interface design between DM642 and CF card

2.1 hardware interface design

CF card supports three basic working modes: PC card memory mode, PC card I / 0 mode and true ide mode. The pin functions corresponding to different modes are slightly different. In the design of this paper, the pccard memory mode is used. Before inserting the CF card, ensure that the slot / reg pin of the CF card is high level, so that the CF card can automatically enter the PC card memory mode. DSPs access off chip memory through external memory interface EMIF (external memory interface). The EMIF of DM642 has four spaces: CEO, cel, CE2 and Ce3, each with 256MB of addressing space. In the system design described in this paper, CE2 space is configured as the address space of CF card for use by CF card. According to the requirements of memory mode, CE2 space is configured as an 8-bit asynchronous interface. In addition, a CPLD is specially equipped to control the reading and writing of CF card. The hardware connection is shown in Figure 2.

The pin connection description is as follows: / reg signal is used to select whether to access ordinary register or attribute register. It completes the selection of read-write register together with address line a [3:0]. / CDL and / CD2 are used to detect whether there is a CF card in the slot. When the CF card is inserted into the slot, these pins will be pulled down Cel and / CE2 are used to select the data transmission width of CF card, which is designed as 8-bit width in this paper. In order to save IO port resources, / CDL, / CD2, / cel, / CE2 and I / reg are connected to the configured general IO (GPIO) port.

Teal3 controls reg, teal2 controls cel of CF card, and teal1 controls CE2 and DSP of CF card_ CE2 is the enable signal of CE2 space. Are and iawe are the read-write signals of asynchronous interface, which are effective at low level. They are connected with DSP_ CE2 logic takes "or" and connects to / 0e and / we of CF card, so that after / CE2 is enabled, the read and write operation of CF card can be controlled accordingly.

The CF card has a 16 bit data bus, but it can be flexibly configured into 8 bits or 16 bits according to the data width of the main controller. In this system, the low 16 bit data bus d [15:0] of DM642 is connected with the data bus d [15:0] of the CF card. The lower four bits a [3:0] of the 11 bit address bus of the CF card are connected to tea [6:3] of the DM642, tea [9:4] of the CF card is grounded, teal0 is connected to tea7 of the DM642, CSEL is grounded, iowr and iord are pulled up to VCC, and other unspecified pins are grounded.

2.2 software interface of CF card

The reading and writing of CF card is based on sectors, each sector is 512 bytes, and one or more consecutive sectors are read and written each time. In this paper, the CF card is configured as PC card memory mode, and the register address mapping in this mode is shown in Table 1.

Register 0 is used to read and write data. Register 1 is an error register during read operation to store error information. It is a feature register during write. Register 2 is used to store the number of read-write sectors. Registers 3 6 are used to store the address of the read-write sector. There are two modes of sector addressing of CF card: physical addressing (cylinder / head / sector, CHS) and logical block addressing (LBA). CHS is the address of the specific cylinder, head and sector corresponding to the sector, while the address of LBA is logically continuous. The conversion relationship between the two addressing modes is: LBA address = (cylinder number) × Number of heads head number) × Sector number sector number 1. This paper selects the linear addressing mode of LBA.

Register 7 has different meanings when reading and writing. The read operation is the status register, which stores the status information of the CF card. The write operation is the command register, which is used to set the command and complete the corresponding operation.

Before CF card reading and writing program, initialize DSP and CF card, initialize GPIO, set CE2 space of DM642 as 8-bit asynchronous interface, configure / reg as high level, and set CF card as 8-bit data interface.

When reading and writing sectors, first set the LBA address of the starting sector and the number of sectors to be read and written, then set the command register, set the read data to 20h and the write data to 30h, and read the status register after writing. The read and write operation can be started only when the status register is "58h", otherwise continue to query the status. Since the data interface is 8 bits, you need to read or write 512 data registers for a sector. After that, read the status register to see if it is "50h" and judge whether the CF card operation is completed. If it is completed, exit the operation, otherwise continue to query until it is completed.

CF card writes a sector function, and the source code is as follows:

The method of reading and writing multiple sectors is similar to this. Just set the number of sectors and the corresponding read-write commands. Generally speaking, directly setting the cyclic read-write is more efficient than calling the subroutine, because it only needs to read and write the starting address of the sector once.

2.3 memory space management of CF card

In this system, the video data in MPEG2 format is stored on the CF card. Although the length of the video is uncertain, the sector address addressed by LBA is 4 bytes. In this design, the storage space of CF card can be allocated as follows: the first sector stores the index information of video; The image data is stored from the second sector.

The data format stored in 512 bytes of the first sector is as follows:

Total section is the number of total video data stored, initially 0; Current security is the number of the current video to be operated, initially 1; Addressl is the starting address of the first video, the initial value is 0x00000002, and address2 is the starting address of the second video data, the initial value is 0, and the subsequent data are set to o during initialization.

Each time the system starts, the information of the first sector needs to be read first. The read information is placed in an array infolba with a width of 4 bytes. Then the video address to be read and written in each segment is calculated as follows: currentaddress = infolba [current section]. Accordingly, the first sector needs to be rewritten after reading and writing, and the index information is updated, specifically total section Current section and the address where the next video data is stored.

From a practical point of view, the first sector can store the first address of about 125 videos, which can basically meet the requirements of use. According to the design, the value of addressl is always ox00000002, and the total section and current section have a specific size relationship, then the first three data of infolba can be used as a verification flag to detect whether the current CF card space allocation meets the requirements. If it does not meet the requirements, it will be initialized according to the initial value. Generally, current section = totalsection 1. When current section is less than or equal to total section, if you write a sector, the data information after infolba [current section] will be overwritten or the index information will be lost, so as to ensure the reuse of CF card memory space. In this system, the control signal is input through the external hardware control circuit, which can easily realize the functions of recording, playing, fast forward, fast backward and pause. Obviously, the video data on the CF card can be played or overwritten by changing the value of current section through fast forward and fast backward.

3 conclusion

In this paper, the software and hardware interfaces between CF card and DM642 are given. The software engineering is integrated through ccs2.2 platform and RF5 framework, and the CF card is successfully applied to the portable digital video system based on DM642. After the program is written to on-board flash, the power on self start can be realized. Through many tests and program optimization, the system runs well, which shows that the scheme successfully solves the requirements of real-time, large capacity and stability of portable equipment, and has broad application prospects.

DM642 based portable digital video system related articles
What Are Some Ways to Keep My Hair Really Healthy?
How Was the First Sale of Vivo X60 Series?
Huami Technology Held a Press Conference on August 27, and Amazfit Smart Sports Watch 3 Officially A
Connect to Nonencrypted Wireless Network Using Ubuntu Commands
Is Time Travel Possible? Can We Travel Back in Time?

Copyright © 2020 Coffee bag - Guangzhou tianci packaging industry Co,. Ltd. | Sitemap