1 IP hardware structure and registers
1.1 IP Hardware Structure
The internal structure of the IP is shown in Figure 1. It is mainly composed of five modules: baud rate clock register, register group controller, parallel I/O interface, I2C programmable interface, and I2C interface engine.
The baud rate clock generator is used to generate the basic clock frequency for the I2C IP operation; the register group controller is used to set the registers, and the setting data is transmitted to the module through the parallel I/O interface; the parallel I/O interface module is used to process the commands transmitted by the programmable interface module; the I2C programmable interface module is used to set the addresses of each register of the IP; the I2C interface engine module executes the transmission of data on the I2C bus.
1.2 Register Structure
The I2C control IP is mainly composed of 6 registers, as listed in Table 1. By reading and writing registers, the transmission of I2C bus data can be easily controlled, thereby realizing the communication between the NiosII processor and the device. The data register is used to store the data to be transmitted on the I2C bus; the baud rate generation module, the baud rate clock register and the clock register jointly determine the frequency of SCL on the I2C bus. The calculation formula of SCL is where System_clk is the system clock; Value is the value of the clock register; divider is the frequency division number corresponding to the value of the baud rate clock register (the difference between the register value and the frequency division number is 1. If the register is set to 0, the frequency division number is 1; if the register is set to 1, the frequency division value is 2).
Detailed introduction to local address register, control register and status register is omitted - Editor's note.
2 Application of I2C Control IP in Imaging System
CMOS sensors are widely used in imaging systems. Most of these sensors have built-in I2C serial communication interfaces. This article takes MT9M011 as an example to introduce the application of I2C control IP in imaging systems. The MT9M011 sensor can be divided into two modes according to the number of read and write bits: 16-bit data read and write mode and 8-bit data read and write mode. Here, the exposure register is selected and the 16-bit read and write mode is used for operation. The timing is shown in Figure 2.
The upper 7 bits of the slave device address (write mode) and the slave device address (read mode) are the slave device address, and the 8th bit is the read/write control bit (R/W), which controls the direction of data transmission.
Write data to the exposure register 0x09: The master device starts the transmission and then sends the address of the slave device it wants to address (write mode). MT9M011 monitors the bus and responds with a one-bit acknowledgement signal when its address matches the transmitted slave device address. Then the master device sends the exposure register address, and MT9M011 responds again. After writing 16 bits of data to the exposure register, the master device stops writing data. Every time 8 bits of data are transmitted, the slave device MT9M011 will generate a one-bit acknowledgement signal.
Reading data from exposure register 0x09: The beginning part is the same as the timing of writing data. After the master device sends the slave device address (write mode) and the register address, it needs to restart and send the slave device address (read mode) before reading data from the register. After reading each byte of data, the master device will generate a 1-bit response signal. When 16 bits of data are read, the master device sends a 1-bit non-response signal and the transmission ends.
3 IP Application Examples
3.1 Hardware Design
This article uses I2C control IP to configure the image sensor MT9M011 register in parallel. The hardware design is based on SOPC technology, integrating the 32-bit Nios II soft-core processor, SDRAM interface module, TIMER timer module (providing the frequency of signal sampling in SignaltapII), PIO module and I2C control IP (configured as a master device) provided by the system component library into an FPGA. QuartusII top-level principle is omitted - Editor's note.
3.2 Software Design
There are two ways to write software: one is to operate the I2C control IP application programming interface (API) function; the other is to use the read and write functions provided by Altera to operate the register. In order to improve the speed of system operation, the second method is adopted. The system software part is completed by writing C code in NiosII IDE.
The parallel configuration procedure for CMOS registers mainly includes the following two parts:
①IP initialization settings: including setting the baud rate, setting the local address register, and setting the clock register value.
② Select CMOS1 to read and write its register; select CMOS2 to read and write its register. Register selects exposure register.
The key codes are as follows:
The checkBus function queries the status register to determine the busy/idle status of the I2C bus, and the checkProgres function queries the status register to determine whether the bus data has been transferred. In order to observe whether the read data is consistent with the written data, the program is usually included in a while statement.
4 Experimental Verification
Burn the download file generated by the hardware system to the FPGA chip and run the C code program. Use the SignahapII logic analyzer that comes with QuartusII to observe the data on the I2C bus. Figure 3 shows the waveform obtained. The signals from top to bottom are the I2C bus signals m_sclk_2, m_sda_2, m_sclk_1, and m_sda_1 on CMOS2/CMOS1. The first half writes 0x06 and 0x07 to CMOS1 and then reads it out; the second half writes the same number to CMOS2 and reads it out. This waveform meets the timing read and write requirements of the MT9M011 image sensor.
5 System Expansion
In applications that require multi-channel CMOS configuration, the I2C control IP can be used to easily implement multi-channel parallel CMOS register configuration. For example, an 8-channel parallel CMOS configuration system: 8 CMOS sensor chips are soldered on the circuit board, and the enable is loaded in parallel to the 8 CMOS chips by controlling the 3-channel signal of the distributor. The 3-channel control signal and the enable signal are realized by controlling the PIO interface module of the SOPC system, and the transmission of the configuration data is completed under the control of the I2C control IP. The circuit board structure is simple and the system is easy to implement.
Conclusion
The I2C IP introduced in this article can be loaded into the SOPC system as a custom component, making the system design more flexible and having great potential for functional expansion. In the imaging system using CMOS image sensor, the I2C interface is widely used. This article gives an application example of the IP to illustrate that the use of the IP has broad prospects and high application value.
Previous article:Design of a dedicated keyboard interface chip using CPLD
Next article:Design of welding process based on flash control of PLC system
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- Open source Linux phone designed with KiCad
- MSP430F5529 MCP4725 Program
- [STM32WB55 Review] This Nucleo is a little special
- HIFU ultrasonic knife (high energy focusing control circuit)
- ARM transplantation encounters a long wait for a solution
- Single bus temperature sensor DS18B20 reading and writing example
- Using C language editor
- Why does this error always occur in the joint simulation of Xilinx 12.4 and modelsim?
- 【K210 Series】3. Core board connection
- The problem of repeated declaration of global variables in embedded C programming