CCD QR Code Data Matri based on TMS320DM642

Publisher:温暖心绪Latest update time:2011-04-09 Source: 电子技术应用Keywords:TMS320F281 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The portable matrix-type two-dimensional code CCD reader proposed in this paper uses TI's high-speed DSP chip TMS320DM642 as an image processor, uses a high-resolution CCD camera to capture images, uses pattern recognition in the DSP processor for initial positioning, and accurately decodes and recognizes the Data Matrix two-dimensional code to obtain the string information encoded in the two-dimensional code graphic. The results can be directly displayed on the reader, and can exchange information with other devices through the communication interface [1].

1 Hardware Implementation

The hardware part mainly consists of a CPU controller, a CCD camera, an image acquisition chip TVP5150, SDRAM and Flash memories, an LCD display, a clock and watchdog circuit, a power supply and reset circuit, a serial communication circuit, etc. The hardware structure block diagram is shown in Figure 1 [2].


The main application circuit consists of DM642, video input circuit, video output circuit and other circuits, as shown below.

1.1 DM642 module

The CPU of this system uses the high-performance DSP chip TMS320DM642 (DM642 for short) developed by TI for video applications. DM642 is based on the C64x core, and many peripheral devices and interfaces are added on its basis, so it is more widely and conveniently used in actual projects. This system uses a 50 MHz crystal oscillator as the external clock input of the DSP, and generates a 600 MHz operating frequency after 12 times the internal phase-locked loop. DM642 adopts a 2-level cache structure (L1 and L2), which greatly improves the running performance of the program. The on-chip 64-bit EMIF (External Memory InterFace) interface can be seamlessly connected to storage devices such as SDRAM and Flash, greatly facilitating the movement of large amounts of data. More importantly, as a dedicated video processing chip, DM642 includes 3 dedicated video ports (VP0~VP2) for receiving and processing video and audio data, which improves the performance of the entire system. This system mainly uses the external memory expansion interface EMIF, video port VP1, video port VP2 and general IO port GPIO of TMS320DM642.

1.2 Video Input Interface

DM642 has three video ports, supporting multiple resolutions and standards. Its bit width and input and output directions are software controllable. In the design, the A channel of VP2 is set to video input mode to realize the graphic input of QR code. The data between DM642 and the video codec chip are transmitted through these dedicated ports, but the control of these chips is realized through the I2C bus.

When using an analog camera to collect video data, a video decoding chip is needed to digitize the collected analog data and then send it to the video port of DM642 for processing. This design uses the TVP5150A produced by TI, which is an ultra-low power NTSC/PAL/SECAM video decoder with a powerful and reliable synchronous detector. Its connection with DM642 is shown in Figure 2 [3].

In Figure 2, the YOUT port of TVP5150A is directly connected to the VP2 port of DM642 for data transmission. The dot matrix clock line is connected to the VP2_CLK1 of the VP2 port on DM642 for the clock signal of data transmission. DM642 reads and writes the internal registers of TVP5150A through the I2C bus to achieve the purpose of controlling the chip.

1.3 Video Output Interface

For designs that require local playback, a video port needs to be set to playback mode. This design needs to control the quality of the acquired surface image of the object through the focal length and field of view of the lens, and needs to monitor the image quality. For this purpose, a video output interface needs to be designed. In the design, video port VP1 is used for video playback, so channel A of the VP1 port is set to playback mode. When playing back the collected data, the digital video signal needs to be converted back into an analog signal before it can be played on the monitor. This design uses SAA7104 produced by Philips to complete the signal conversion. The circuit connection between SAA7104 and DM642 is shown in Figure 3.

In Figure 3, the VP1 port of DM642 outputs a digital video signal in BT.656 format to the MP port of SAA7104, and the Y signal and Cb, Cr signals are separated by the internal data management module of the SAA7104 chip; then the digital signal is sent to the corresponding analog/digital conversion module in the chip to convert the digital signal into an analog video signal; finally, it is output by the CVBS (composite video signal) or Y, C (S-terminal signal) pins. The clock signal LLC of SAA7104 is 27 MHz, which is provided by the VP2CLKI of DM642, and the VP2CLKI of DM642 comes from the SCLK pin of TVP5150A, which makes the video acquisition and playback meet the synchronization requirements. DM642 configures the registers inside the SAA7104 chip through the I2C interface to control the chip.

2 Software Implementation

In terms of software, it mainly focuses on three aspects: video encoding, decoding chip drivers, software process design and algorithm design.

2.1 Video driver model based on DSP/BIOS

The design uses TI's DSP/BIOS-based driver model, uses the CSL (Chip Support Library) chip support library to configure TVP5150A and SAA7104, and uses the FVID API to implement video signal acquisition and playback. The framework based on this driver model is shown in Figure 4 [4].

2.2 Software Workflow

After the program is powered on and starts running, it will first initialize the settings of each module, including VP1, VP2, TVP5150A, SAA7104, McBSP, etc., and then perform image capture in a DSP/BIOS system task object. The captured image data will be stored in a FVID_Frame structure provided by FVID, and the subsequent image processing will be performed on the graphic data in this structure. The obtained image will first be subjected to QR code recognition and positioning, and the pattern recognition method will be used to determine whether the image collected this time contains QR code information and whether QR code recognition processing is required. If it contains QR code information, it will enter the QR code recognition module for recognition, output to the LCD display, and send the QR code information through McBSP.

Among them, the DSP/BIOS system task object is a thread managed by the TSK module. Its task priority is higher than the idle loop and lower than hardware and software interrupts. The TSK module dynamically schedules and preempts tasks based on the priority of its task and the current execution status. DSP/BIOS has a total of 15 task priorities available, and the lowest priority is reserved for the idle loop. For this reason, TI's DSP/BIOS configuration tool is used in the design to configure the TSK module and establish the system task tskLoopback for video acquisition and image analysis loops. The flow of the system program is shown in Figure 5.


2.3 Image Processing Procedure

In the image processing program part, to obtain accurate decoding information, two key components must be included: positioning of the two-dimensional data matrix code and decoding of the two-dimensional code. This design only decodes the Data Matrix two-dimensional code.

In terms of image positioning, the Data Matrix code itself contains a lot of positioning information. Figure 6 shows a Data Matrix code image. It can be seen that there is a black horizontal bar at the bottom of the code image and a black vertical bar at the left border. The width of each bar is the width of a valid 1. The upper right corner of the image is the data encoding image area, and there is a white continuous area around the entire image with a width of 4 times a valid 1 pixel. The program uses this information to locate the code image and determine the direction of the code image.

In the program, first obtain a complete Data Matrix two-dimensional code image as a template for future recognition and decoding of real-time dynamic images. For the image used as a template, select the entire two-dimensional code image area as the training area of ​​the template, and train it as a template for locating the two-dimensional code image in the real-time image through the transformation of the image coordinates. After that, set some parameters for pattern recognition during positioning, including rotation angle range, scaling range, image grayscale level, etc. When the template and positioning tool are configured, the image is acquired in real time through the CCD camera for positioning and recognition. For a real-time image, first use the positioning tool to locate the two-dimensional code image. If the positioning is successful, the image contains the two-dimensional code image information. If the positioning returns an unsuccessful flag, do not proceed to the next step and directly apply for the image again. For images containing two-dimensional code information, read the original binary code stream at the image position given by the positioning tool according to the image pixel size value given by the positioning tool, and then decode the binary code stream according to the encoding rules of the Data Matrix to obtain the corresponding string for display and transmission.

This article describes in detail the design of a CCD two-dimensional code Data Matrix reader based on TMS320DM642, including the system design of hardware and software. The reader designed according to this design scheme has a simple structure, is easy to implement, and has a high two-dimensional code recognition rate.

Keywords:TMS320F281 Reference address:CCD QR Code Data Matri based on TMS320DM642

Previous article:Introduction to the Principle of DSPLL
Next article:Dual-redundancy DSP solution for channel control design

Recommended ReadingLatest update time:2024-11-16 19:46

Research on the Design of Three-Phase Rectifier Based on TMS320F2812
Abstract: The basic principle of SVPWM (space vector modulation) is discussed in detail, and a design scheme of a three-phase PWM rectifier control system based on DSP is given. TMS320F-2812 is applied, and a design method of a principle prototype is given, and experimental verification is carried out. O Introduct
[Power Management]
Research on the Design of Three-Phase Rectifier Based on TMS320F2812
Latest Embedded Articles
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号