I2C module configuration and application of TI series DSP

Publisher:SerendipitySoulLatest update time:2006-07-12 Source: 单片机及嵌入式系统应用Keywords:register Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  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.

Keywords:register Reference address:I2C module configuration and application of TI series DSP

Previous article:CPLD with automatic power off
Next article:I2C module configuration and application of TI series DSP

Recommended ReadingLatest update time:2024-11-16 17:55

51 MCU drives high-precision clock DS3231 source code
This program has 2 files in total, which are successfully driven by stc89c51 MCU. The complete code   can be downloaded from http://www.51hei.com/f/ds3231code.rar Below is the source code preview (the first file) :  /// ... */ /////////////////////////////////////////////////// ////////////////////////////////
[Microcontroller]
Perpetual calendar clock based on 51 (with temperature, alarm)
MCU source code: #include reg52.h //#include "DS18B20_3.H" #include string.h #include intrins.h #define uint unsigned int #define uchar unsigned char #define wd 1 //define whether there is temperature function =0 when there is no temperature, =1 when there is temperature #include "eeprom52.h" #define yh 0x80 /
[Microcontroller]
Perpetual calendar clock based on 51 (with temperature, alarm)
Introduction to RCC clock in STM32
LEGEND(description) HSE = Hight-speed external clock singal  HSI = Hight-speed internal clock singal LSI =  Low-speed external clock singal LSE = Low-speed internal clock singal HSE is an external high-speed crystal oscillator (4~16M HSE OSC, 8M OSC is recommended) HSI is the high speed internal crystal osci
[Microcontroller]
STM8 clock security system registers
STM8 clock security system register (CLK_CSSR) Address offset value: 0x08 Reset value: 0x00 Position 7:4 Reserved. Always 0. Bit 3 CSSD: Clock safety system monitoring is set by hardware or cleared by software writing 0. 0: CSS is off or HSE failure is not detected 1: HSE failure is detected Bit 2 CSSDIE: Clock s
[Microcontroller]
STM8 clock security system registers
Toshiba launches new clock expansion peripheral interface driver/receiver IC to help reduce the amount of wiring harnesses in automotive electronic systems
Toshiba launches new clock expansion peripheral interface driver/receiver IC to help reduce the amount of wiring harnesses in automotive electronic systems Shanghai, China, March 17, 2023 - Toshiba Electronic Components and Storage Corporation ("Toshiba") today announced the launch of an interface driver/receiver IC
[Automotive Electronics]
Toshiba launches new clock expansion peripheral interface driver/receiver IC to help reduce the amount of wiring harnesses in automotive electronic systems
ATmega32 External Clock
In order to drive the AVR chip from an external clock source, XTAL1 must be connected as shown in Figure 14. At the same time, the fuse bit CKSEL must be programmed to “0000”. If the fuse bit CKOPT is also programmed, the user can use the internal 36 pF capacitor between XTAL1 and GND. After selecting this oscillato
[Microcontroller]
ATmega32 External Clock
MSP430F5438 clock system
1 Overview   Unified clock system (ucs) unified clock system. MSP430F5438 has 5 clock sources: XT1, XT2, REFCLO, VLCLO, DCO. External LF (XT1 is usually 32.768K) ​​can be connected to a clock crystal or an external clock source of 4M-32M. XT1 can be used as a reference clock source for the frequency-locked loop. HF (X
[Microcontroller]
Implementation of GPS Precision Clock Based on PIC18F8520
GPS (Global Positioning System) is the most complete satellite navigation system in the world. It not only has real-time, continuous and high-precision three-dimensional positioning capabilities covering the entire world, but also has precise timing functions. Using highly stable and accurate satellite-borne atomic
[Microcontroller]
Implementation of GPS Precision Clock Based on PIC18F8520
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号