I2C module configuration and application of TI series DSP

Publisher:breakthrough3Latest 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: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

PIC Oscillator Configuration and Clock Switching
Microcontroller programming is C language + register setting.  In the past, the configuration of PIC oscillators was just a copycat, that is, just use other people's code. In the past two days, I have specially studied the configuration of oscillators and clock switching. Under the mplab IDE and C30 compiler, the test
[Microcontroller]
Freescale Kinetis 60 (K60) clock system analysis
Some time ago, I learned about the clock system of the Freescale K60 chip and gained a general understanding of its clock system. Here I write down my understanding and share it for future reference. Freescale's Kinetis series is a microcontroller based on ARM CORTEX-M4 core launched by Freescale. 1. Freescale K60
[Microcontroller]
Freescale Kinetis 60 (K60) clock system analysis
Principles and applications of real-time clock circuits
1 Introduction   There are many popular serial clock circuits now, such as DS1302, DS1307, PCF8485, etc. These circuits have simple interfaces, low prices, and ease of use, and are widely used. The real-time clock circuit DS1302 introduced in this article is a circuit from DALLAS Company with trickle current charg
[Analog Electronics]
ds1302 real time clock
There are many popular serial clock circuits now, such as DS1302, DS1307, PCF8485, etc. These circuits have simple interfaces, low prices, and are easy to use, and are widely used. The real-time clock circuit DS1302 introduced in this article is a circuit with trickle current charging capability from DALLAS. Its mai
[Power Management]
ds1302 real time clock
S3C2440A clock system
Clock system S3C2440A_UserManual_Rev13.pdf OVERVIEW The Clock & Power management block consists of three parts: Clock control, USB control, and Power control. The Clock control logic in S3C2440A can generate the required clock signals including FCLK for CPU, HCLK for the AHB bus peripherals, and PCLK for the APB bus
[Microcontroller]
S3C2440A clock system
STM32F030 internal clock settings
如题,下面贴上我的时钟设置代码: #define PLL_SOURCE_HSI // HSI (~8MHz) used to clock the PLL, and the PLL is used as system clock source static void SetSysClock(void) { __IO uint32_t StartUpCounter = 0, HSEStatus = 0; #if defined (PLL_SOURCE_HSI) FLASH- ACR = FLASH_ACR_PRFTBE | FLASH_ACR_LATENCY; RCC- CFGR |= (uint32_t)RCC_CFGR_HP
[Microcontroller]
JZ2440 bare metal development and analysis: ARM chip clock system 1
ARM chip clock system analysis OM switch
[Microcontroller]
JZ2440 bare metal development and analysis: ARM chip clock system 1
Clock Interrupt in MCU Programming
This article takes the AT89C51 system with a 6MHz clock as an example to illustrate the application of clock interrupts: Timer initial value and interrupt cycle The clock interrupt does not need to be too frequent, generally 20mS (50Hz) is sufficient. If a time base signal of one hundredth of a se
[Microcontroller]
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号