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.
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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
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
- Python is now officially the second most popular programming language
- Number monitoring of moving objects
- The role of capacitors
- MSP430 MCU Development Record (19)
- EEWORLD University ---- ADPD188BI Integrated optical module for smoke detection
- Positive and negative power supplies, in-phase and inverting amplifier applications of op amps 1. Op amps powered by positive and negative power supplies have a large dynamic range...
- EEWORLD University Hall----Components and Electromagnetic Compatibility
- The role of pressure sensors in mobile phones
- 4 Working principle and advantages of switching BOB power supply
- MicroPython Newsletter Issue 11 (MicroPython 8th Anniversary)