The I2C bus was a serial communication interface specification first proposed by Philips. The standard I2C bus only uses two lines for communication. It can connect multiple devices with I2C interfaces for reliable communication. The number of I2C devices connected to the same bus, It is only limited by the maximum bus capacitance of 400pF, and the maximum communication rate can reach 3.4Mb/s. Because the I2C interface is simple and easy to use, it has been adopted by many chips and has become a widely used interface [1].
DSP, digital signal processor, is a widely used embedded processor. Its main application is to implement various digital signal processing algorithms in real time and quickly. Currently, the main international DSP supplier is TI, and its TMS32 series products occupy the Nearly half of the DSP market share. In order for users to develop and integrate systems conveniently and quickly, TI has integrated I2C communication modules in some models of DSP. This article takes TMS320C6713 as an example and uses the DSP development tool CCS2.2 provided by TI. CSL (Chip Support Lib, chip-level support library) configures the I2C module.
Image acquisition and processing is an important field of DSP application. This article combines the DSP-based image acquisition and processing system developed by the author, and takes the CMOS image acquisition chip OV7620 as an example to introduce the process of the DSP chip configuring the I2C device through the I2C module.
1 During the development process of TI's DSP with I2C interface
in embedded systems, if the processor does not have an I2C interface and there are I2C devices in the system, the common method is to use the two pins of the processor to simulate the SDA and SCL signals respectively. And use the program simulation interface. This method has good versatility, flexibility and reliability, but poor portability. Different models of processors require different programs. Although the source code of such programs can be downloaded online, program transplantation will still be difficult. It wastes a lot of developer time and makes the program large and difficult to maintain.
In order for users to develop and integrate systems conveniently and quickly, TI has integrated I2C communication modules into some models of DSP, such as TMS320C6713, TMS320C6416, TMS320C5509, etc.
TMS320C6713 is a high-performance floating-point DSP that integrates 2 I2C interfaces: I2C0 and I2C1. Among them, the pins of I2C1 are multiplexed with the pins of McBSP1 (Multichannel Buffered Serial Port 1, Multichannel Buffered Serial Port 1). McBSP1 is activated by default. To use I2C1, the lowest position of the register DEVCFG must be set to 1 [2, 3]. The structure of the I2C module is shown in Figure 1.
I2CDXR is the transmit buffer and I2CXSR is the transmit shift register. After the data on the bus is sent to I2CDXR, it is copied to I2CXSR, shifted out bit by bit, and sent to SDA. The bit shifted out first is the highest bit. I2CDRR and I2CRSR are the receive buffer and receive shift register respectively. They are responsible for moving the data on SDA, merging it into bytes, placing it in the receive buffer, and sending the data to the data bus.
The I2C module has 5 states that will generate interrupt signals, which are provided to DSP interrupt system calls as interrupt sources. These 5 states are: sending data accurately, receiving data accurately, registers can be accessed, the host did not receive a response signal, and bus arbitration failed. . Because the I2C module can provide interrupt signals, the interrupt processing function can be programmed, and the corresponding I2C event in the interrupt ensures real-time response.
I2C simulation can also work with EDMA (Enhanced Direct Memory Access). When data is copied from I2CDXR to I2CXSR or from I2CRSR to I2CDRR, an EDMA operation will be triggered, and EDMA will send the next data or read the received data. Since the EDMA operation does not take up DSP processing time, it can greatly improve the DSP operation speed and avoid continuous interruption of the pipeline. Therefore, if the I2C module is used to exchange data with a relatively large amount of data with peripherals, for example, the data in the cache A large amount of data is saved to the Flash of the I2C interface, and EDMA operation can be used. If the amount of data exchanged is relatively small, and the real-time performance is relatively high, for example, to receive the data collected by the I2C interface sensor, the DSP interrupt method can be used; if the exchanged The amount of data is relatively small, and the real-time requirements are not high. For example, when setting up an I2C device, you can use the DSP to query the status bits. This example uses the I2C module to configure the OV7620, using the query method.
In order for the I2C module to work normally, a driving clock must be provided for it. In the TMS320C6713, the clock of the I2C module is obtained by dividing the system clock, as shown in Figure 2.
The external clock is the external clock of the DSP system. The system clock frequency designed in this article is 25MHz. The PLL is the phase-locked loop of the system. The external clock is first divided and multiplied to lock the clock, and then divided according to different frequency division coefficients. Three clocks are used by TMS320C6713. One of them is output to the I2C module. The I2C module first predivides the clock according to the value of IPSC. The divided clock is used by the I2C module. At the same time, the clock is divided according to the values of ICCL and ICCH. Frequency division controls the low-level and high-level periods of SCL respectively. The frequency of SCL is.
Before configuring the I2C module, the PLL must be configured. The I2C of TMS320C6713 does not support high-speed mode and is generally configured in standard mode.
2 Use CSL to configure the I2C module.
Control of the I2C module is achieved by operating the control/status register group. The registers of TMS320C6713 are mapped to the address space. The registers can be read and written directly through address operations, such as
#define I2CMDR0 0x01B40024
* (volatile unsigned int *) I2CMDR0 & = ~ 0x20; the
registers can be read and written through address operations. The syntax is simple and the compilation efficiency is high, but the program It has poor readability and portability and is not easy to maintain.
In DSP application systems, a large number of DSP devices are generally involved, especially the programming of on-chip peripherals, which consumes more energy from developers in the early stages of development. TI provides CSL in the development environment CCS. Most CSL modules are composed of corresponding functions, macros, classes and symbols. It can easily and conveniently complete the programming work of configuring and controlling the on-chip peripherals of DSP devices, thus simplifying the development work of DSP on-chip peripherals, shortening the development cycle, having the ability to standardize the control and management of on-chip peripherals, and reducing the impact of DSP hardware specificity on The impact of user program code facilitates user code migration between different devices. However, using CSL for peripheral control may have some impact on user code execution efficiency [4].
This article first gives the program to configure the PLL, and then gives the program to configure the I2C module. Because the clocks of the DSP circuit boards are not the same, the PLL configuration program is not very portable. At the same time, in order to improve the compilation and execution efficiency, the configuration The PLL program uses direct address operation. For the macro definition of the register, please refer to the corresponding DSP data manual. This routine refers to the literature [2]. The external clock of the DSP system is 25MHz.
Note that most of the internal clock of the DSP system comes from the PLL. The PLL setting program must be placed at the forefront of everything. Only when the PLL is successfully configured can the system work normally.
After the clock is provided, the I2C module can be configured. This article configures I2C0 into host transmission mode, with an operating frequency of 100kHz, non-continuous transmission, and a 7-bit address. Because this program is to prepare for configuring OV7620, it does not use EDMA and DSP interrupts.
Note that I2C0 automatically enters the host receiving mode after sending a byte. In order to verify whether I2C0 is working normally, you can loop I2C0 and I2C1.
This routine only provides the header files required to configure the I2C module.
3 Configure OV7620 using I2C module
The CMOS color image sensor OV7620 launched by Omnivision has a maximum resolution of 664×492. It can not only work in progressive scanning mode, but also in interlaced scanning mode. The on-chip register can be configured through the I2C bus to enable its output. RGB original data, after the system designed in this article is powered on and reset, the TMS320C6713 first generates the I2C bus signal to initialize the OV7620 working register, and then the OV7620 can start to output image signals as required, including the horizontal synchronization signal HREF, the field synchronization signal VSYNC, Pixel clock signal PCLK and digital image signal [5]. DSP receives the original image data through EDMA, performs median filtering, removes noise, and then performs related image processing. The initialization program of OV7620 is given below.
The four parameters of the OV7620initial() function are the starting point and area range of the CMOS photosensitive area. I2C_SetOV7620() is a custom function that sends two data through I2C. The first data is the register address of OV7620, and the second data is Register contents.
4 Conclusion
This article introduces the I2C bus specification, taking TMS320C6713 as an example, explaining the results of the I2C module and the functions of each part in some TI DSPs, introducing how to configure the PLL and system clock of the DSP; and giving the use of CSL in the development environment CCS. The I2C module of TMS320C6713 is configured, and the OV7620 is configured.
Previous article:I2C module configuration and application of TI series DSP
Next article:Design of ACM program-controlled test system based on PC/104 interface
Recommended ReadingLatest update time:2024-11-16 20:22
- 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
- (Extra 2) GD32L233 Evaluation-Development Environment Construction (Basic Framework + FreeRTOS + Compilation Passed)
- Hardware structure of TMS320C55x
- Experience sharing on software management in the field of engine control in the automotive industry
- Antenna Principles (Harbin Institute of Technology)
- Xunwei iMX6 development board-device tree kernel-register device routine
- [RPi PICO] Using inline assembly to implement trigger ADC sampling and register viewing
- Measuring remote controls with an oscilloscope
- "Play Board" + Shared Bicycle Control Board - GPRS Module SIM800C
- Quick, help me calculate the baud rate error problem, click here to see the picture and formula
- Jlink prompts error message when burning external flash