Device drivers play an extremely important role in the Linux kernel. In an embedded system, except for the CPU, memory and a few other components, all device control operations must be completed by the driver. System designers must develop corresponding drivers for each peripheral in the system, otherwise the device will not work properly under Linux.
In an embedded laser tracker based on the AT91RM9200 processor, in order to achieve fast and stable tracking of the target, it is necessary to control two motors, namely, the azimuth motor and the pitch motor. The principle is as follows: by continuously reading the data of the two angle encoders , the deviation between the actual angle of the two motors and the expected angle is calculated, and the two motors are driven to track the target using the principle of feedback control. When the control voltage of the two motors is 5V, the motors stop; when the control voltage is 0V, the motors rotate clockwise at the maximum speed; when the control voltage is 10V, the motors rotate counterclockwise at the maximum speed.
According to the above control requirements, a 4-channel 12-bit serial DA converter, DAC7714, is selected as the control driver chip for the two motors. The quality of the driver of this chip under the embedded Linux system will directly determine the tracking effect of the entire instrument, and it is also one of the basic problems that need to be solved in embedded development.
1 Overview
DAC7714 is a 4-channel 12-bit serial input, voltage output DA converter launched by TI of the United States. Its power supply voltage is ±15 V, and it can realize automatic output retention. In addition to saving the resources of the single-chip microcomputer , this serial port chip also has the advantage of simultaneously outputting multiple 0-10 V (reference voltage is +10 V and 0 V), which is particularly suitable for occasions where MCU resources are scarce and there are many control channels.
DAC7714 performance features:
1) 12-bit resolution, serial interface;
2) Power consumption is only 250 mW;
3) 4 analog output channels, voltage output;
4) Linear error ±1LSB;
5) Support unipolar (0~10 V) or bipolar (-10 V~+10 V) output;
6) Automatic output hold;
7) The reset signal is optional, and different reset modes have different initial values.
2 Hardware Design
The hardware of the embedded laser tracker is relatively complex. Here we will introduce the hardware connection between the DAC7714 and AT91RM9200 related to the motor drive. Since the motor power is relatively large in actual use, it is necessary to add a driving circuit to the two outputs of the DAC7714 to truly drive the motor.
2.1 DAC7714 pins and functions
DAC7714 is a SOJ 16 package, and the specific pins and functions are described as follows:
VOUTA~VOUTD: 4 analog outputs
CS: Chip select terminal, low level is effective
CLK: serial data clock terminal
V CC : Positive power supply , typically +15 V
VSS: Negative power supply, usually 0 or -15 V
GND: Ground
VREFL: Analog output voltage reference (lower limit)
VREFH: Analog output voltage reference (upper limit)
SDI : Serial Data Input
LOADDACS: Conversion end judgment bit
RESET and RESETSEL: Chip reset setting bits
2.2 DAC7714 Hardware Design
The hardware design of DAC7714 is relatively simple. Its programmable pins RESET, LOADDACS, CS, CLK, and SDI are connected to the IO ports PA0-PA1 and PA3-PA5 of AT91RM9200 respectively, laying the foundation for the next step of driver development; its VOUTA and VOUTB are connected to the control signals of two motors; VREFL is grounded, and VREFH is connected to +10 V, using a unipolar connection method. The specific connection is shown in Figure 1.
3 Driver Design
The purpose of the driver is to drive the hardware to work properly, so the driver should be written for specific hardware. In the embedded laser tracker, it is necessary to write a driver for DAC7714, and the kernel will call and manage the chip in the form of a device node. DAC7714 is a serial DA converter. It is necessary to control the above pins of AT91RM9200 according to its working timing diagram, simulate its working timing, and complete the driver design in the kernel Linux-2.4.19.
3.1 DAC7714 working timing diagram
To complete a digital-to-analog conversion, DAC7714 needs to serially output 16 bits of data to SDI on the rising edge of CLK while CS is low. Among the 16 bits of data, the combination of the first two bits A1 and A0 will determine the conversion output of a certain channel (00-A channel, 01-B channel, 10-C channel, 11-D channel), the next two bits are invalid bits, and the last 12 bits of data are the data that really need to be converted. Its working timing diagram is shown in Figure 2.
3.2 Driver Program Composition
As a device file, the DAC7714 driver is also divided into several operations such as open, write, and release. For the kernel, DAC7714 is a character device, and the device is named Name[] = "DAC7714drv". This module is dynamically loaded using the insmod command and dynamically unloaded using the rmmod command. The DAC7714 driver mainly consists of a registration function, a deregistration function, an initialization function, and a DA output function.
When a user uses the insmod command to load a module, the following registration function is actually called:
When the open function is used in the application to open the DAC7714 device, the following function is actually called to complete the initialization operation of the corresponding pins of the controller (using PA0 connected to RESET as an example):
In the DAC 7714_write function, the PA0-PA5 pin levels of AT91RM9200 are controlled to simulate the timing of Figure 2 to complete the DA output, as shown in the flow chart 3.
4 Test Program Design
In the test program, the 4 outputs of DAC7714 are tested separately. The test method is to measure the voltage output value of the corresponding channel of DAC7714 through a multimeter or oscilloscope for the specified digital quantity . If the value is consistent with the theoretical value, it means that the driver is correct.
First, call the open function to open the DAC7714 device, then control the digital quantity to increase by 1 from 0, and combine the channel number to generate the control digital quantity that the DAC7714 can recognize, then call the write function to control the output, and when the control digital quantity reaches the maximum value, switch to the next channel. The main code of the test program is as follows.
5 Conclusion
This paper presents the hardware design of DAC 7714. In the AT91RM9200+ embedded Linux environment, the design method based on its driver and test program is introduced in detail, revealing the general rules of embedded development. In the actual test process, the actual output voltage of the 4 channels is compared with the theoretical voltage, and the maximum error is 0.1%, which can fully meet the requirements of laser tracking.
Previous article:Classification and functions of ARM microprocessor instructions
Next article:Design of computer mouse control system based on STM32F103RCT6
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
- Dear masters, please answer this for me. I am waiting.
- EEWORLD University Hall----Live Replay: ADI Motor Control Solutions
- Here are some more
- Personal understanding of DSP_28335's interrupt PIE system
- Introduction to the method of board-level online compilation and downloading of C6000 DSP code
- How to draw this shape of 0.35x0.35
- EEWORLD University ---- ARM (IMX6U) bare metal video tutorial (punctual atom)
- EEWORLD University Hall----Texas Instruments field transmitter output interface/fieldbus solution
- Design of Portable Weather Instrument Based on MSP430 Microcontroller
- EEWORLD University ---- Top 5 Simple Electronic projects