SPI-based data transmission system

The proposed data transmission system addresses low efficiency in SPI-based systems by using multiple chip selection signals to enable simultaneous data transfer among slave devices, improving optical image stabilization in camera modules.

JP7534023B2Active Publication Date: 2024-08-14HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2022580738
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2020-06-28
Filing Date
2021-06-24
Publication Date
2024-08-14
Estimated Expiration
2041-06-24

AI Technical Summary

Technical Problem

The existing SPI-based data transmission systems in optical camera modules with multiple slave SPI devices suffer from low data transmission efficiency, leading to undesirable optical image stabilization effects due to the master SPI device being unable to communicate with more than one slave device simultaneously.

Method used

A data transmission system that utilizes a master SPI device to output multiple chip selection signals to enable and control multiple slave SPI devices, allowing simultaneous data transmission and reception through flexible switching of data ports and indicators, thereby improving efficiency.

Benefits of technology

The system enhances data transmission efficiency by enabling multiple slave SPI devices to receive and transmit data simultaneously, optimizing optical image stabilization effects in camera modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007534023000015
    Figure 0007534023000015
  • Figure 0007534023000009
    Figure 0007534023000009
  • Figure 0007534023000010
    Figure 0007534023000010
Patent Text Reader

Abstract

This application provides an SPI-based data transmission system. In this system, a master SPI device enables a first slave SPI device using a combination of a first chip select signal and a second chip select signal. When the master SPI device drives the first chip select signal to an active state and the second chip select signal to an inactive state, the master SPI device controls the second slave SPI device to transmit data using the data line. The master SPI device may further receive data using the data line, and the first slave SPI device may receive data using the data line. Thus, when the first chip select signal is in an active state and the second chip select signal is in an inactive state, the master SPI device and the first slave SPI device simultaneously receive data transmitted by the second slave SPI device, thereby improving the data transmission efficiency of the SPI system.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] child The application relates to the field of data transmission technology, and in particular to SPI-based data transmission systems. [Background technology]

[0002] Currently, optical image stabilization (O A camera module that supports IS includes motor drives, and each motor drive controls the motor of the camera module based on the gyroscope information collected by the gyroscope sensor (GYRO) to implement image stabilization. Using a smartphone as an example, the gyroscope sensor is generally mounted on the main board of the smartphone, and the gyroscope sensor and the camera module are connected using a serial peripheral interface (SPI) to transmit the gyroscope information between the gyroscope sensor and the camera module.

[0003] When a smartphone includes multiple camera modules that support optical image stabilization, one of the multiple camera modules acts as a master SPI device, and the gyroscope sensor and other camera modules act as slave SPI devices. The master SPI device can perform data transmission with only one slave SPI device at a time. Therefore, when one camera module obtains gyroscope information from the gyroscope sensor, another camera module will be delayed in obtaining gyroscope information from the gyroscope sensor, resulting in an undesirable OIS effect.

[0004] In conclusion, in an SPI system containing multiple slave SPI devices, the data transmission efficiency between the SPI devices is not high, which leads to undesirable OIS effects in the camera module acting as a slave SPI device. Summary of the Invention

[0005] This application provides an SPI-based data transmission system for improving the data transmission efficiency of an SPI system including multiple slave SPI devices.

[0006] According to a first aspect, this application provides a data transmission system. The system may include a master SPI device, a first slave SPI device, and a second slave SPI device. The master SPI device may be configured to output a first chip select signal to the first slave SPI device and the second slave SPI device, and to output a second chip select signal to the first slave SPI device. A combination of the first chip select signal and the second chip select signal is used to enable the first slave SPI device, and the first chip select signal is used to enable the second slave SPI device, and the master SPI device, the first slave SPI device, and the second slave SPI device are further connected using a data line. The master SPI device may be further configured to control the second slave SPI device to transmit data using the data line when the master SPI device drives the first chip select signal to an enabled state and the second chip select signal to an disabled state, and to receive data transmitted by the second slave SPI device using the data line. Slave The SPI device may be configured to transmit data under control of the master SPI device using the data lines when the master SPI device drives the first chip select signal to an active state and the second chip select signal to an inactive state. The first slave SPI device may be configured to receive data transmitted by the second slave SPI device using the data lines when the master SPI device drives the first chip select signal to an active state and the second chip select signal to an inactive state.

[0007] In the data transmission system, the master SPI device may enable the first slave SPI device using a combination of the first chip select signal and the second chip select signal, and when the master SPI device drives the first chip select signal to an enabled state and the second chip select signal to an disabled state, the master SPI device controls the second slave SPI device to transmit data using the data line, and the master SPI device further receives data using the data line, and the first slave SPI device receives data using the data line. Thus, when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, the master SPI device and the first slave SPI device simultaneously receive data transmitted by the second slave SPI device, which can improve the data transmission efficiency of the SPI system.

[0008] In a possible example, when the transmit port of the first slave SPI device is connected to the receive port of the master SPI device using a first data line, and the receive port of the first slave SPI device is connected to the transmit port of the master SPI device using a second data line, the data lines including a first data line and a second data line, the transmit port of the first slave SPI device and the transmit port of the master SPI device are configured to transmit data, and the receive port of the first slave SPI device and the receive port of the master SPI device are configured to receive data, the first slave SPI device may be further configured to switch the transmit port of the first slave SPI device to the receive port and switch the receive port of the first slave SPI device to the transmit port when the master SPI device drives the first chip select signal to an enabled state and the second chip select signal to an disabled state.

[0009] In this design, in the 4-wire mode, when the master SPI device drives the first chip select signal to an active state and the second chip select signal to an inactive state, the first slave SPI device may switch its transmit port to a receive port to receive data sent by the second slave SPI device using the data lines. The first slave SPI device may switch its receive port to a transmit port to not receive data from the master SPI device and not respond to the write indicator bit sent by the master SPI device, to avoid sending data using the same data lines as the second slave SPI device to avoid data contention.

[0010] In another possible example, the first slave SPI device may be further configured to set a data port of the first slave SPI device to a bidirectional data port, the bidirectional data port supporting both transmission and reception of data.

[0011] In this design, in 3-wire mode, the first slave SPI device sets the data port to a bidirectional data port and receives data sent by the second slave SPI device through the data port. Additionally, the first slave SPI device further transmits data sent by the master SPI device through the data port. Reception This may further improve the data transmission efficiency.

[0012] Additionally, the master SPI device may be specifically configured to transmit a first indicator over the data lines when the master SPI device drives the first chip select signal to an active state and the second chip select signal to an inactive state. The first indicator is used to control the transmission of data. And the first slave SPI device may be further configured to skip transmitting data in response to the first indicator when the master SPI device drives the first chip select signal to an active state and the second chip select signal to an inactive state.

[0013] In this design, the first slave SPI device does not respond to the first indicator from the master SPI device, so that the first slave SPI device and the second slave SPI device do not simultaneously transmit data on the data line based on the first indicator, thereby avoiding data contention.

[0014] The master SPI device may be further configured to transmit a second indicator and data over the data lines when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state, the second indicator being used to control reception of the data, and may be further configured to receive a second indicator over the data lines when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state, and to receive data over the data lines in response to the second indicator.

[0015] In this design, when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state, the first slave SPI device may receive data from the master SPI device based on the second indicator.

[0016] The master SPI device may be further configured to transmit a first indication over the data lines and receive data from the first slave SPI device over the data lines when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state. The first indication is used to control the transmission of the data. And, the first slave SPI device may be further configured to receive the first indication over the data lines and transmit data over the data lines in response to the first indication when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state.

[0017] In this design, when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state, the first slave SPI device may send data to the master SPI device based on the first index.

[0018] Additionally, the first slave SPI device may be further configured to skip transmitting data over the data lines and skip receiving data over the data lines when the master SPI device drives the first chip select signal to an invalid state and drives the second chip select signal to an invalid state.

[0019] In this design, when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an invalid state, the first slave SPI device may not read data in response to a read indicator bit sent by the master SPI device. Additionally, the first slave SPI device does not send data in response to a write indicator bit sent by the master SPI device to avoid data transmission contention on the data line.

[0020] According to a second aspect, the present application provides a chip, the chip being suitable for use in the first slave SPI device according to the first aspect.

[0021] For example, the chip may include an SPI controller, an SPI control logic unit (or referred to as an SPI control logic circuit), an SPI data receive / transmit switching unit (or referred to as an SPI data receive / transmit switching circuit), and an SPI data port (or referred to as a data port).

[0022] The SPI control logic may be configured to receive a first chip select signal and a second chip select signal from the master SPI device. A combination of the first chip select signal and the second chip select signal is used to enable the chip. The SPI data port may be connected to the master SPI device and the second slave SPI device using data lines. The SPI control logic may be configured to control the SPI controller to receive data transmitted by the second slave SPI device on the data lines via the SPI data port when the master SPI device drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state.

[0023] Optionally, the SPI data port may include a transmit port and a receive port, the transmit port connected to the receive port of the master SPI device with a data line, the receive port connected to the transmit port of the master SPI device with a data line, the transmit port configured for the chip to transmit data on the data lines, and the receive port configured for the chip to receive data transmitted on the data lines. The SPI control logic may be further configured to configure the transmit port to receive data transmitted on the data lines when the master SPI device drives the first chip select signal to an enabled state and the second chip select signal to an disabled state.

[0024] The chip may further include an SPI data receive / transmit switching circuit. The SPI controller may include a transmit module and a receive module. The transmit module is configured to transmit data, and the receive module is configured to receive data. The SPI control logic circuit may be further configured to control the SPI data receive / transmit switching unit to connect the transmit port to the receive module when the master SPI device drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state.

[0025] The SPI control logic may be further configured to configure the SPI data port as a bidirectional data port, the bidirectional data port supporting both receiving and transmitting data.

[0026] The SPI control logic may be further configured to control the SPI controller to not transmit data in response to a first indicator transmitted over the data lines when the master SPI device drives the first chip select signal to an enabled state and the second chip select signal to an disabled state, the first indicator being used to control the transmission of the data.

[0027] The SPI control logic may be further configured to control the SPI controller to receive data transmitted on the data lines via the SPI data port when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state. The SPI controller may be further configured to receive a second indication transmitted on the data lines when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state, the second indication being used to control receipt of the data, and to receive the data transmitted on the data lines in response to the second indication via the SPI data port.

[0028] The SPI control logic may be further configured to control the SPI controller to receive data transmitted on the data lines via the SPI data port when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state. The SPI controller may be further configured to receive a first indication transmitted on the data lines when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state, the first indication being used to control transmission of the data, and to transmit the data on the data lines via the SPI data port in response to the first indication.

[0029] The SPI control logic circuit may be further configured to control the SPI controller not to transmit data over the data lines and to control the SPI controller not to receive data over the data lines when the master SPI device drives the first chip select signal to an invalid state and drives the second chip select signal to an invalid state.

[0030] The SPI controller, the SPI control logic circuit, the SPI data receive / transmit switching circuit, and the SPI data port may be implemented by an integrated circuit.

[0031] According to a third aspect, the application provides a camera module. The camera module may include a chip according to any one of the second aspect or the design of the second aspect, and the camera module may have the functionality of the chip according to any one of the second aspect or the design of the second aspect. The camera module may further include a motor and a camera. When the second slave SPI device includes a gyroscope sensor, the motor may be configured to obtain data of the gyroscope sensor from the chip to perform vibration control and / or autofocus of the camera.

[0032] According to a fourth aspect, the present application provides a terminal device. The terminal device may include a data transmission system according to the first aspect or any one of the designs of the first aspect. Thus, the terminal device may have functionality according to the first aspect or any one of the designs of the first aspect.

[0033] Alternatively, the terminal device may include a chip according to the second aspect or any one of the designs of the second aspect, and therefore may have the functionality of a chip according to the first aspect or any one of the designs of the first aspect.

[0034] Alternatively, the terminal device may include a camera module according to the third aspect. Thus, the terminal device may have the functionality of the chip according to the second aspect or any one of the designs of the second aspect. In this case, the terminal device may be a photographing device. The terminal device may further include an image signal processing chip (image signal processing, ISP) configured to obtain an image signal from the camera module and process the image signal, for example, to perform high-definition processing on the image signal output by the camera module.

[0035] According to a fifth aspect, the application provides a data transmission system. The system may include a first camera, a second camera, and a first sensor. The first camera, the second camera, and the first sensor communicate with each other using an SPI protocol. The first camera is a master SPI device, and the second camera and the first sensor are slave SPI devices. When the first camera and the second camera operate simultaneously, the first camera acquires first sensor data using the SPI protocol, and the second camera acquires the first sensor data using the SPI protocol simultaneously.

[0036] The data transmission system enables the first camera and the second camera to acquire the first sensor data simultaneously, thereby reducing the delay in the acquisition of sensor data by the cameras and improving the OIS effect of the camera module.

[0037] In a possible design, the first camera may output a first chip select signal to the second camera and the first sensor, and output a second chip select signal to the second camera and the first sensor. A state combination of the first chip select signal and the second chip select signal is used to control whether to enable the second camera and is used to control whether to enable the first sensor. The first camera, the second camera, and the first sensor are further connected using data lines. When the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, the first camera may control the second camera to transmit data using the data lines and receive data transmitted by the second camera using the data lines, the first sensor may transmit data using the data lines under the control of the first camera, and the second camera may receive data transmitted by the first sensor to the first camera using the data lines.

[0038] With this design, the first camera can flexibly control the working states of the second camera and the first sensor by using the first chip select signal and the second chip select signal. When the second camera and the first sensor are in the working state (also called the enabled state), the first camera and the second camera simultaneously acquire the data of the first sensor, which can improve the data transmission efficiency.

[0039] In a possible design, the first camera may output a first chip select signal to the second camera and the first sensor, and output a second chip select signal to the second camera and the first sensor. A state combination of the first chip select signal and the second chip select signal is used to control whether the second camera is enabled and is used to control whether the first sensor is enabled. The first camera, the second camera, and the first sensor are further connected using data lines. When the first chip select signal and the second chip select signal are in a preset state combination (e.g., when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, or in another state combination), the first camera may control the second camera to transmit data using the data lines and receive data transmitted by the second camera using the data lines, the first sensor may transmit data using the data lines under the control of the first camera, and the second camera may receive data transmitted by the first sensor to the first camera using the data lines.

[0040] With this design, the first camera can flexibly control the working states of the second camera and the first sensor by using the first chip select signal and the second chip select signal. When the second camera and the first sensor are in the working state (also called the enabled state), the first camera and the second camera simultaneously acquire the data of the first sensor, which can improve the data transmission efficiency.

[0041] In a possible design, the first camera may transmit data to the second camera using the data line, the first sensor may receive the data transmitted by the first camera using the data line, and the second camera may receive the data transmitted by the first camera to the first sensor using the data line.

[0042] With this design, the first camera can flexibly control the working states of the second camera and the first sensor by using the first chip select signal and the second chip select signal. When the second camera and the first sensor are in the working state (also called the enabled state), the second camera and the first sensor simultaneously acquire the data of the first camera, which can improve the data transmission efficiency.

[0043] In a possible design, when the transmit port of the second camera is connected to the receive port of the first camera using a first data line, and the receive port of the second camera is connected to the transmit port of the first camera using a second data line, the data lines including a first data line and a second data line, the transmit port of the second camera and the transmit port of the first camera are configured to transmit data, and the receive port of the second camera and the receive port of the first camera are configured to receive data, the second camera may switch the transmit port of the second camera to a receive port and switch the receive port of the second camera to a transmit port when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination.

[0044] In this design, in 4-wire mode, the second camera can be connected to the first camera by switching the transmit and receive ports. Sensors Additionally, since the second camera no longer receives data or instructions from the first camera, it does not transmit data using the data line, thereby avoiding data transmission contention.

[0045] In a possible design, the second camera may further configure the data port to be a bi-directional data port, which supports both receiving and transmitting data.

[0046] In this design, in the 3-wire mode, the second camera may set the data port as a bidirectional data port and receive the data transmitted by the first sensor through the data port. Additionally, the second camera may further receive the data transmitted by the first camera through the data port to further improve data transmission efficiency.

[0047] In a possible design, when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, or when the first chip select signal and the second chip select signal are in a preset state combination, the first camera may transmit a first indicator using the data line, the first indicator being used to control the transmission of data, and the second camera not transmitting data in response to the first indicator.

[0048] In this design, the second camera does not need to respond to the first indication received and therefore does not transmit data over the data line, thereby avoiding data transmission contention.

[0049] In a possible design, when the first chip select signal is in an invalid state and the second chip select signal is in an valid state, or when the first chip select signal and the second chip select signal are in a preset state combination, the first camera uses the data line to select the second chip select signal. 2 The first camera may transmit an indicator and data, the second indicator being used to control reception of the data, and the second camera may receive the second indicator using the data line and receive data using the data line in response to the second indicator.

[0050] In this design, the first camera may flexibly control the working state of the second camera, and the second camera may receive the data transmitted on the data line based on the second indicator from the first camera, so as to improve transmission efficiency.

[0051] In a possible design, when the first chip select signal is in an invalid state and the second chip select signal is in an valid state or when the first chip select signal and the second chip select signal are in a preset state combination, the first camera may transmit a first indicator using the data line, the first indicator being used to control the transmission of data, the second camera may receive the first indicator and transmit data using the data line based on the first indicator, and the first camera may further receive data from the second camera using the data line.

[0052] In this design, the second camera may send data to the first camera based on the first indicator to improve transmission efficiency.

[0053] In a possible design, when the first chip select signal is in an invalid state and the second chip select signal is in an valid state, or when the first chip select signal and the second chip select signal are in a preset state combination (e.g., when the first chip select signal is in an invalid state and the second chip select signal is in an valid state, or when they are in another state combination), the second camera does not transmit data using the data lines and does not receive data using the data lines, implementing flexible switching between operating modes of the second camera.

[0054] In a possible design, the first sensor is a gyroscope sensor. ·data comes from the first sensor, and the first sensor information is gyroscope information.

[0055] According to a sixth aspect, the present application provides a circuit, the circuit being connectable to a second camera according to the fifth aspect.

[0056] For example, the circuitry may include some or all of the following components: an SPI controller, an SPI control logic unit (or referred to as an SPI control logic circuit), an SPI data receive / transmit switch unit (or referred to as an SPI data receive / transmit switch circuit), or an SPI data port (or referred to as a data port).

[0057] The SPI controller may be configured to control the SPI data port to acquire the first sensor data when the first camera acquires the first sensor data using an SPI protocol. The SPI data port is configured for the second camera to perform SPI protocol communication with the first camera and / or the first sensor. The first camera is a master SPI device, and the second camera and the first sensor are slave SPI devices.

[0058] In a possible design, the SPI data port may transmit acquired first sensor data to a second camera.

[0059] In a possible design, the SPI data port is connected to the first camera and the first sensor using data lines.

[0060] In a possible design, the circuit further includes an SPI control logic unit configured to receive a first chip select signal and a second chip select signal from the first camera. A combination of the first chip select signal and the second chip select signal is used to control whether to enable the second camera. When the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, the SPI control logic circuit may control the SPI controller to control the SPI data port to receive data transmitted by the first sensor on the data line to the first camera.

[0061] In a possible design, the circuit further includes an SPI control logic unit configured to receive a first chip select signal and a second chip select signal from the first camera. A combination of the first chip select signal and the second chip select signal is used to control whether to enable the second camera. When the first chip select signal and the second chip select signal are in a preset state combination, the SPI control logic circuit may control the SPI controller to control the SPI data port to receive data transmitted by the first sensor on the data line to the first camera.

[0062] In a possible design, the SPI control logic unit may further control the SPI controller to control the SPI data port to receive data transmitted by the first camera to the first sensor on the data line.

[0063] In a possible design, when the second camera's transmit port is connected to the first camera's receive port using a first data line, and the second camera's receive port is connected to the first camera's transmit port using a second data line, the data lines include a first data line and a second data line, the second camera's transmit port and the first camera's transmit port are configured to transmit data, and the second camera's receive port and the first camera's receive port are configured to receive data, the SPI control logic unit may further configure the transmit port to receive data transmitted on the data lines when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination.

[0064] In a possible design, the circuit further includes an SPI data receive / transmit switching circuit. The SPI controller may include a transmit module and a receive module. The transmit module is configured to transmit data, and the receive module is configured to receive data. The SPI control logic unit may further control the SPI data receive / transmit switching circuit to connect the transmit port to the receive module when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, or when the first chip select signal and the second chip select signal are in a preset state combination.

[0065] In a possible design, the SPI control logic unit may further configure the SPI data port to be a bi-directional data port, supporting both receiving and transmitting data.

[0066] In a possible design, the SPI control logic unit may further control the SPI controller to not transmit data in response to a first indicator transmitted over the data line when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination, the first indicator being used to control the transmission of the data.

[0067] In a possible design, when the first chip select signal is in an invalid state and the second chip select signal is in an valid state, or when the first chip select signal and the second chip select signal are in a preset state combination, the SPI control logic unit may control the SPI controller to receive, via the SPI data port, a second indication transmitted on the data lines. In response to the second indication, the SPI controller may control the SPI data port to receive data transmitted on the data lines. The second indication is used to control the reception of the data.

[0068] In a possible design, the SPI control logic unit may control the SPI controller to receive a first indication transmitted on the data lines via the SPI data port when the first chip select signal is in an invalid state and the second chip select signal is in an valid state or when the first chip select signal and the second chip select signal are in a preset state combination. The SPI controller may control the SPI data port to transmit data on the data lines in response to the first indication. The first indication is used to control the transmission of the data.

[0069] In a possible design, when the first chip select signal is in an invalid state and the second chip select signal is in an valid state, or when the first chip select signal and the second chip select signal are in a preset state combination, the SPI control logic unit may control the SPI controller not to transmit data using the data lines and may control the SPI controller not to receive data using the data lines.

[0070] According to a seventh aspect, the present application provides a circuit, the circuit being connectable to a first camera according to the fifth aspect.

[0071] For example, the circuitry may include a control unit (also called a control circuit) and a SPI data port.

[0072] The SPI data port is configured for the first camera to acquire the first sensor data using the SPI protocol. The control circuitry may be configured to control the second camera to simultaneously acquire the first sensor data using the SPI protocol. The first camera is a master SPI device, and the second camera and the first sensor are slave SPI devices. The first sensor data originates from the first sensor.

[0073] In a possible design, the SPI data port is connected to the second camera and the first sensor using data lines.

[0074] In a possible design, the control circuit may output a first chip select signal to the second camera and the first sensor, and output a second chip select signal to the second camera and the first sensor, and a combination of states of the first chip select signal and the second chip select signal are used to control whether the second camera is enabled and whether the first sensor is enabled.

[0075] In a possible design, when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, the control circuit may control the first sensor to transmit data using the data lines, control the SPI data port to receive data transmitted by the first sensor using the data lines, and control the second camera to receive data transmitted by the first sensor to the first camera using the data lines.

[0076] In a possible design, when the first chip select signal and the second chip select signal are in a preset state combination, the control circuit may control the first sensor to transmit data using the data lines, control the SPI data port to receive data transmitted by the first sensor using the data lines, and control the second camera to receive data transmitted by the first sensor to the first camera using the data lines.

[0077] In a possible design, the control circuitry may control the SPI data port to transmit data to a first sensor using the data lines, and control a second camera to receive data transmitted by the first camera to the first sensor using the data lines.

[0078] In a possible design, the control circuitry may control the SPI data port to transmit a first indicator over the data lines when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination. The first indicator is used to control the transmission of data.

[0079] In a possible design, the control circuitry may control the SPI data port to transmit a first indicator over the data lines when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination. The first indicator is used to control the transmission of data.

[0080] According to an eighth aspect, the present application provides a camera module. The camera module may include a circuit according to any one of the designs of the sixth aspect or the sixth aspect, and may implement a function of the circuit according to any one of the designs of the sixth aspect or the sixth aspect. The camera module may further include a motor and a second camera. When the first sensor is a gyroscope sensor, the motor may be configured to obtain first sensor data (i.e., gyroscope data) using the circuit, and perform vibration control and / or auto focus (AF) of the camera based on the first sensor data.

[0081] According to a ninth aspect, the application provides a camera module. The camera module may include a circuit according to any one of the seventh aspect or the design of the seventh aspect, and may implement a function of the circuit according to any one of the seventh aspect or the design of the seventh aspect. The camera module may further include a motor and a first camera. If the first sensor is a gyroscope sensor, the motor may be configured to obtain first sensor data (i.e., gyroscope data) using the circuit, and perform vibration control and / or autofocus of the camera based on the first sensor data.

[0082] According to a tenth aspect, the application provides a terminal device. The terminal device may include a data transmission system according to the fifth aspect or any one of the designs of the fifth aspect, so that the terminal device may have functionality according to the fifth aspect or any one of the designs of the fifth aspect, and / or the terminal device may include a circuit according to the sixth aspect or any one of the designs of the sixth aspect, so that the terminal device may have functionality of a circuit according to the sixth aspect or any one of the designs of the sixth aspect, and / or the terminal device may include a circuit according to the seventh aspect or any one of the designs of the seventh aspect, so that the terminal device may have functionality of a circuit according to the seventh aspect or any one of the designs of the seventh aspect. The terminal device may implement the function of the circuit according to any one of the designs of the eighth aspect or the eighth aspect, and / or the terminal device may include a camera module according to any one of the designs of the eighth aspect or the eighth aspect, so that the terminal device may have the function of the camera module according to the eighth aspect or the eighth aspect, and / or the terminal device may include a camera module according to any one of the designs of the ninth aspect or the ninth aspect, so that the terminal device may have the function of the camera module according to any one of the designs of the ninth aspect or the ninth aspect, and / or the terminal device may be a photographing device. The terminal device may further include an image signal processing chip (image signal processing, ISP) configured to obtain an image signal from the camera module and process the image signal, for example, to perform high-definition processing on the image signal output by the camera module.

[0083] According to an eleventh aspect, the application provides a terminal device including a first camera module, a second camera module, and a gyroscope sensor configured to output gyroscope information. The first camera module, the second camera module, and the gyroscope sensor are connected using a serial peripheral interface SPI. The first camera module acts as a master SPI device, and the gyroscope sensor and the second camera module act as slave SPI devices, and the first camera module and the second camera module simultaneously acquire gyroscope information from the gyroscope sensor under control of an SPI chip select signal sent by the first camera module. The image processing unit is configured to acquire image signals from the first camera module and the second camera module.

[0084] In a possible design, both the first camera module and the second camera module are connected to the gyroscope sensor using data lines. When the SPI chip select signal sent by the first camera module is in a preset state combination, the first camera module and the second camera module simultaneously acquire gyroscope information from the gyroscope sensor.

[0085] In a possible design, both the first camera module and the second camera module are connected to the gyroscope sensor using data lines. When the SPI chip select signal sent by the first camera module enables the second camera module and the gyroscope sensor, the first camera module and the second camera module simultaneously obtain gyroscope information from the gyroscope sensor.

[0086] In a possible design, a second camera module and gyroscope sensor would simultaneously receive data from the first camera module.

[0087] For the beneficial effects of the second aspect and possible designs of the second aspect to the eleventh aspect and possible designs of the eleventh aspect, please refer to the description of the beneficial effects of the first aspect and possible designs of the first aspect. [Brief description of the drawings]

[0088] [Figure 1] 1 is a schematic diagram of the structure of a data transmission system according to an embodiment of this application;

[0089] [Diagram 2] FIG. 2 is a schematic diagram of a dual chip select logic decision result according to an embodiment of the present application.

[0090] [Diagram 3] FIG. 2 is a schematic diagram of a time sequence of data transmission according to an embodiment of the present application;

[0091] [Figure 4] FIG. 1 is a schematic diagram of the connection relationship of a data transmission system according to an embodiment of the present application.

[0092] [Diagram 5] FIG. 2 is a schematic diagram of the connection relationship of another data transmission system according to an embodiment of the present application.

[0093] [Figure 6] FIG. 2 is a schematic diagram of another time sequence of data transmission according to an embodiment of the present application;

[0094] [Figure 7] FIG. 2 is a schematic diagram of another time sequence of data transmission according to an embodiment of the present application;

[0095] [Figure 8] FIG. 2 is a schematic diagram of the connection relationship of another data transmission system according to an embodiment of the present application.

[0096] [Figure 9]FIG. 2 is a schematic diagram of the structure of a slave SPI device according to an embodiment of the present application.

[0097] [Figure 10] FIG. 1 is a schematic diagram of the structure of a data transmission system according to an embodiment of this application.

[0098] [Figure 11] FIG. 2 is a schematic diagram of the connection relationship of another data transmission system according to an embodiment of the present application.

[0099] [Figure 12] FIG. 2 is a schematic diagram of the connection relationship of another data transmission system according to an embodiment of the present application.

[0100] [Figure 13] FIG. 2 is a schematic diagram of the connection relationship of another data transmission system according to an embodiment of the present application.

[0101] [Figure 14] FIG. 2 is a schematic diagram of a circuit structure according to an embodiment of the present application. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0102] In order to make the objectives, technical solutions and advantages of this application clearer, this application will be described in more detail below with reference to the accompanying drawings. A specific operation method in a method embodiment may also be applied to an apparatus embodiment or a system embodiment.

[0103] The following explains the terms used in this application.

[0104] At least one means one or more, including one, two, three, or more.

[0105] Plurality means more than one, including two, three, or more.

[0106] Carrying may mean that the message is used to carry information or data, or that the message contains information.

[0107] A coupling is an indirect coupling or communication connection between devices, units or modules for the exchange of information between the devices, units or modules, and may be in the form of electrical, mechanical or other.

[0108] The SPI structure may include a master SPI device (also referred to as a master device or master device) and a slave SPI device (also referred to as a slave device or slave device), and SPI connection lines between the master SPI device and the slave SPI device. The SPI connection lines between the master SPI device and the slave SPI device may include a chip select signal line, a serial synchronous clock signal line (serial clock, SCK) (which may be referred to as a clock line hereinafter), a data line, etc. When the master SPI device is connected to multiple slave SPI devices using the clock line and the data line, the master SPI device may enable (or select) the slave SPI device using the chip select signal, and use an index bit on the data line and the clock line (hereinafter referred to as a write index bit) to indicate that the enabled slave SPI device will transmit data using the data line, and the master SPI device may read the data transmitted by the slave SPI device using the data line. Alternatively, the master SPI device may use an indicator bit on the data and clock lines (hereinafter referred to as the read indicator bit) to indicate to an enabled slave SPI device that it will read data using the data lines, and the master SPI device may further transmit data using the data lines for the slave SPI device to receive data using the data lines.

[0109] In this application, the chip select signal line refers to a signal line for transmitting a chip select signal (chip selection, CS). The chip select signal may include an active state and an inactive state. When the master SPI device drives the chip select signal to an active state, the chip select signal may be used to enable the slave SPI device. Alternatively, the master SPI device 101 may set the chip select signal to an inactive state to deselect the slave SPI device. For example, when the chip select signal is at a low level (e.g., a potential of 0), the chip select signal is in an active state, and when the chip select signal is at a high level (e.g., a potential of 1), the chip select signal is in an inactive state.

[0110] The clock line may be generated by the master SPI device and may be used to perform clock synchronization to the master SPI device and the slave SPI devices.

[0111] The data lines may include a serial data line (SDA) in 3-wire mode. SDA is a bidirectional data line. Alternatively, the data lines may include a serial data output (SDO) and a serial data input (SDI) in 4-wire mode. SDO and SDI are both unidirectional data lines. SDO may be configured for the SPI device to transmit data, and SDI may be configured for the SPI device to receive data. In 4-wire mode, the data line that transmits data from the master SPI device to the slave SPI device may also be called the master output / slave input data line (MOSI), and MOSI may be configured to transmit data transmitted by the master SPI device using SDO, and the slave SPI device may receive data using SDI. MISOThe data line that transmits data from the slave SPI device to the master SPI device may also be called the master input / slave output data line (MISO), i.e., MISO may be configured to transmit data transmitted by the slave SPI device using SDO, and the master SPI device may receive data from MOSI using SDI.

[0112] In the case of a data port, the SPI device may transmit data to or receive data from the data lines via the data port. In the case of a 3-wire mode, the SPI device may have at least one data port, which is a bidirectional data port and capable of supporting transmission and reception of data. In the 3-wire mode, the data port may be connected to SDA. In the case of a 4-wire mode, the SPI device may include at least two data ports. One data port may function as a transmit port configured to support transmission of data, and the transmit port is connected to SDO. One data port may function as a receive port configured to support reception of data, and Reception The port is connected to SDI.

[0113] The read / write indicator bits may include a read indicator bit and a write indicator bit. The read indicator bit may be used to control a slave SPI device receiving the read indicator to receive data using the data lines. For example, the read / write indicator bit may be the first data bit output by the master SPI device after the clock lines are started. For example, in a 3-wire mode, the read / write indicator bit may be the first data bit output by the master SPI device using SDA after the clock lines are started. For example, in a 4-wire mode, the read / write indicator bit may be the first data bit output by the master SPI device using SDO after the clock lines are started. If the first data bit after the clock lines are started is set to 1, that data bit may be referred to as a read indicator bit. The write indicator bit may be used to control a slave SPI device receiving the read indicator to receive data using the data lines. write The indicator may be used to control a slave SPI device that receives the indicator. For example, if the first data bit after the clock line starts is set to 0, the data bit may be referred to as a write index bit. It should be understood that in this application the write index bit may also be referred to as the first index. The read index bit may also be referred to as the second index.

[0114] Additionally, in the embodiments of this application, it should be understood that "and / or" describes the association relationship between related objects, and indicates that three relationships may exist. For example, A and / or B may indicate the case where only A exists, the case where both A and B exist, or the case where only B exists, and A and B may be singular or plural. The character " / " generally indicates an "or" relationship between related objects. "At least one of the following items" or similar expressions indicate any combination of these items, including any combination of a single item or multiple items. For example, at least one of a, b, or c may represent a, b, c, a and b, a and c, b and c, or a, b, and c, and a, b, and c may be singular or plural.

[0115] Hereinafter, embodiments of the present application will be described in detail with reference to the accompanying drawings.

[0116] The data transmission method provided in the embodiments of this application may be applied to an SPI bus system (also called an SPI structure). The system may include one master SPI device and at least two slave SPI devices, and the master SPI device is connected to the at least two slave SPI devices by using data lines.

[0117] As shown in FIG. 1, a data transmission system 100 provided in an embodiment of this application may include a master SPI device 101, a first slave SPI device 102, and a second slave SPI device 103.

[0118] The data transmission system 100 provided in this embodiment of the application may be applied to a terminal device or other electronic device having an SPI structure, for example, a device such as a mobile terminal or a computer. For example, a possible application scenario of the data transmission system 100 provided in this embodiment of the application is a photographing device including multiple camera modules. The photographing device may be a smartphone, a mobile smart device, a smart home device, a tablet computer, etc., with a photographing function, or may be a portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile device.

[0119] In this scenario, the master SPI device 101 may include one of multiple camera modules of the photography device (in this application, the camera module that functions as the master SPI device may be referred to as camera module A), the first slave SPI device 102 may include another camera module of the photography device (in this application, the camera module that functions as the slave SPI device may be referred to as camera module B), and the second slave SPI device 103 may include a gyroscope sensor of the photography device. The gyroscope sensor may be disposed on a main board of the photography device. For example, each camera module may include a motor drive chip, or what is called a motor drive integrated circuit (IC). The motor drive IC may be configured to output a current or pulse width modulation (PWM) signal to control the motor of the camera module to perform a movement motion as required to implement image stabilization.

[0120] In the data transmission system 100, the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 are connected using data lines. For example, if the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 are connected in a 3-wire mode, the data lines may include SDA. Alternatively, if the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 are connected in a 4-wire mode, the data lines may include SDO and SDI.

[0121] Additionally, the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 are further connected using a clock line.

[0122] 1, the master SPI device 101 outputs a first chip select signal (CS1) to the first slave SPI device 102 and outputs a second chip select signal (CS2) to the first slave SPI device 102. Thus, the master SPI device 101 may enable the first slave SPI device 102 to be in multiple operating modes using a combination of an enabled or disabled state of the first chip select signal and an enabled or disabled state of the second chip select signal.

[0123] The master SPI device 101 may further output a first chip select signal to the second slave SPI device 103 and enable the second slave SPI device 103 using the first chip select signal. Specifically, when the first chip select signal is in an enabled state, the first chip select signal enables the second slave SPI device 103, and the second slave SPI device 103 may transmit data using the data lines based on the write index bit output by the master SPI device 101. Alternatively, the second slave SPI device 103 may read data using the data lines based on the read index bit output by the master SPI device 101.

[0124] For example, the dual chip select logic determination result of the first slave SPI device 102 may be represented by Fig. 2. The dual chip select logic determination result is the working mode of the first slave SPI device 102. In Fig. 2, CS1=0 indicates that the first chip select signal is in a valid state, CS2=0 indicates that the second chip select signal is in a valid state, CS1=1 indicates that the first chip select signal is in an invalid state, and CS2=1 indicates that the second chip select signal is in an invalid state. "a&b" means a and b.

[0125] According to FIG2, when CS1=0&CS2=1, the dual chip select logic decision result is data listening mode, and the first slave SPI device 102 may enter the data listening mode based on the decision result (in other words, the first slave SPI device 102 enters the data listening mode). In the data listening mode, the first slave SPI device 102 may receive data using the data line, but does not transmit data using the data line. In other words, in the data listening mode, whether the master SPI device 101 outputs a write indicator bit or a read indicator bit, the first slave SPI device 102 only listens on the data line and receives data transmitted on the data line.

[0126] When CS1=1&CS2=0, the dual chip select logic decision result is the standard slave SPI device mode (or called standard slave mode), and the first slave SPI device 102 may enter the standard slave SPI device mode based on the decision result (in other words, the first slave SPI device 102 becomes the standard slave SPI device mode). In the standard slave mode, the first slave SPI device 102 may receive data using the data line based on the read index bit output by the master SPI device 101, and may also transmit data using the data line based on the write index bit output by the master SPI device 101.

[0127] Additionally, when CS1=1&CS2=1, the dual chip select logic decision result is the non-selection mode, and the first slave SPI device 102 may enter the non-selection mode based on the decision result (in other words, the first slave SPI device 102 enters the non-selection mode). In the non-selection mode, the first slave SPI device 102 does not receive data using the data line, and does not transmit data using the data line. In other words, in the non-selection mode, the first slave SPI device 102 does not respond to the index of the master SPI device 101, regardless of whether the master SPI device 101 outputs a write index bit or a read index bit.

[0128] The bus access mode of the first slave SPI device 102 in the data listening mode is described as an example with reference to Fig. 3. As shown in Fig. 3, when CS1=0&CS2=1, no matter whether the master SPI device 101 sets the first data bit (i.e., read / write indicator bit) after SCK starts to 0 (representing write) or 1 (representing read), the first slave SPI device 102 only supports data input and does not output data to the data lines (including SDA in 3-wire mode or SDO in 4-wire mode) because the first slave SPI device 102 is in the data listening mode.

[0129] Specifically, in the 3-wire mode, the connection relationship between the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 is shown in Figure 4. It can be seen that the data ports (data ports connected to SDA) of the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 all support bidirectional data transmission. For example, when in the 3-wire mode, the first slave SPI device 102 may set its data port to a bidirectional port.

[0130] 4, in the three-wire mode, when the master SPI device 101 drives the first chip select signal to an active state and drives the second chip select signal to an inactive state, if the master SPI device 101 transmits a write indicator bit using SDA, after receiving the write indicator bit using SDA, the second slave SPI device 103 may transmit data using SDA in response to the write indicator bit, the master SPI device 101 may receive data transmitted by the second slave SPI device 103 using SDA, and since the first slave SPI device 102 is in a data listening mode, the first slave SPI device 102 may receive data transmitted by the second slave SPI device 103 using SDA. Additionally, the first slave SPI device 102 does not transmit data on SDA in response to the write indicator bit transmitted by SDA to avoid data contention on SDA (in other words, the first slave SPI device 102 skips transmitting data in response to the write indicator bit).

[0131] The expression "an SPI device transmits data using SDA / SDO" in this application should be understood to mean that an SPI device transmits data to SDA / SDO via a transmit port connected to SDO, and SDA / SDO transmits data to another SPI device. The expression "an SPI device receives data using SDA / SDI" in this application should also be understood to mean that an SPI device receives data transmitted by another SPI device using the SDA / SDO of the other SPI device from SDA / SDI via a receive port connected to SDA / SDI.

[0132] Additionally, according to FIG. 4, in the three-wire mode, if the master SPI device 101 transmits a read indicator bit using SDA when the master SPI device 101 drives the first chip select signal to an active state and drives the second chip select signal to an inactive state, the master SPI device 101 may further transmit data using SDA. In this case, the second slave SPI device 103 may receive the data transmitted by the master SPI device 101 in response to the read indicator bit using SDA, and since the first slave SPI device 102 is in a data listening mode, the first slave SPI device 102 may receive the data transmitted by the master SPI device 101 using SDA. In this way, multiple slave SPI devices can simultaneously receive the data transmitted by the master SPI device, which improves the efficiency of receiving data from the master SPI device by multiple slave SPI devices.

[0133] In the case of the 4-wire mode, when the master SPI device 101 puts the first chip select signal in an active state and the second chip select signal in an inactive state, the connection relationship between the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 is shown in Fig. 5. It can be seen that the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 may transmit data through their respective transmit ports (the transmit port is connected to SDO) and receive data through their respective receive ports (the receive port is connected to SDI).

[0134] As shown in FIG. 5, in the 4-wire mode, when the master SPI device 101 transmits a write indicator bit using SDO, the second slave SPI device 103 may transmit data using SDO in response to the write indicator bit, the master SPI device 101 may receive data transmitted by the second slave SPI device 103 using SDO using SDI, and since the first slave SPI device 102 is in a data listening mode, the first slave SPI device 102 may receive data transmitted by the second slave SPI device 103 using SDO using SDI. Additionally, the SDO of the first slave SPI device 102 does not receive the write indicator bit transmitted by the master SPI device 101 using SDO. Therefore, the first slave SPI device 102 does not transmit data in response to the write indicator bit transmitted by the master SPI device 101 to avoid data transmission contention (in other words, the first slave SPI device 102 skips transmitting data in response to the write indicator bit).

[0135] Additionally, as shown in FIG. 5, in the case of 4-wire mode, when the master SPI device 101 asserts the first chip select signal and asserts the second chip select signal, the master SPI device 101 may transmit a read indicator bit using SDO and transmit data using SDO, and the second slave SPI device 103 may receive data using SDI in response to the read indicator bit.

[0136] The bus access mode of the first slave SPI device 102 in the standard slave SPI device mode is described as an example with reference to FIG. 6 and FIG. 7. As shown in FIG. 6, in the standard slave SPI device mode, the first slave SPI device 102 operates in the standard slave SPI device mode, and if the master SPI device 101 sets the first data bit after the SCK starts to 0, the first slave SPI device 102 may read data transmitted on the data line (SDA or SDI) under the control of the master SPI device 101. As shown in FIG. 7, in the standard slave SPI device mode, if the master SPI device 101 sets the first data bit after the SCK starts to 1, the first slave SPI device 102 may transmit data using the data line (SDA or SDO) under the control of the master SPI device 101. Thus, in the standard slave SPI device mode, the first slave SPI device 102 may implement data transmission between the first slave SPI device 102 and the master SPI device 101 under the control of the master SPI device 101.

[0137] Specifically, in the case of the 3-wire mode, the connection relationship between the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 is shown in Figure 4. When the master SPI device 101 drives the first chip select signal to an inactive state and drives the second chip select signal to an active state, if the master SPI device 101 uses SDA to send a write indicator bit, since the first slave SPI device 102 is in the standard slave mode, First Slave SPI Device 102 After receiving the write indicator bit using SDA, the master SPI device 101 may send data using SDA in response to the write indicator bit, and the master SPI device 101 may receive data sent by the first slave SPI device 102 using SDA. In this case, the second slave SPI device 103 is in a non-selected state and does not respond to the write indicator bit sent by SDA.

[0138] Additionally, in the case of 3-wire mode, when the master SPI device 101 disables the first chip select signal and enables the second chip select signal, if the master SPI device 101 transmits a read indicator bit using SDA and transmits data using SDA, the first slave SPI device 102 may receive data using SDA in response to the read indicator bit transmitted by SDA, since the first slave SPI device 102 is in standard slave mode. Additionally, in this case, the second slave SPI device 103 is in a non-selected state and does not respond to the read indicator bit transmitted by SDA.

[0139] In the 4-wire mode, the connection relationship between the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 is shown in FIG. invalid state and the second chip select signal valid If the master SPI device 101 sends a write index bit using SDO when driving the first slave SPI device 102 to the unselected state, the first slave SPI device 102 may receive the write index bit using SDI and send data using SDO in response to the write index bit, and the master SPI device 101 may use SDI to receive the data sent using SDO by the first slave SPI device 102. Additionally, in this case, the second slave SPI device 103 is in the unselected state and does not respond to the write index bit sent using SDO by the master SPI device 101.

[0140] Additionally, as shown in FIG. 8, the master SPI device 101 may generate a first chip select signal invalid state, and the second chip select signal validIf the master SPI device 101 sends a read indicator bit using SDO and sends data using SDO when in the selected state, the first slave SPI device 102 may receive the read indicator bit using SDI and read data using SDI in response to the read indicator bit since the first slave SPI device 102 is in standard slave mode. Additionally, in this case, the second slave SPI device 103 is in the unselected state and does not respond to the read indicator bit sent by the master SPI device 101 using SDO.

[0141] It should be understood that in the non-selection mode, in the case of the 3-wire mode, the connection relationship between the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 is shown in Fig. 4. Additionally, in the non-selection mode, in the case of the 4-wire mode, the connection relationship between the master SPI device 101, the first slave SPI device 102, and the second slave SPI device 103 is shown in Fig. 8.

[0142] Optionally, the dual chip selection logic decision result may alternatively be represented by Table 1. [Table 1]

[0143] As shown in FIG. 2 or Table 1, when the state of the first chip select signal is a valid state and the state of the second chip select signal is an invalid state, the first slave SPI device 102 may be enabled to enter a data listening mode. When the state of the first chip select signal is an invalid state and the state of the second chip select signal is a valid state, the first slave SPI device 102 may be enabled to enter a standard slave SPI device mode. When the state of the first chip select signal is an invalid state and the state of the second chip select signal is an invalid state, the first slave SPI device 102 may be enabled to enter a non-select mode.

[0144] Referring to the operation modes of the first slave SPI device 102 and the second slave SPI device 103 shown in Table 1, when the master SPI device 101 drives the first chip select signal to an active state and drives the second chip select signal to an inactive state, the master SPI device 101 may control the second slave SPI device 103 to transmit data using the data line, and may receive data transmitted by the second slave SPI device 103 using the data line. In this case, since the first slave SPI device 102 is in a data listening mode, the first slave SPI device 102 may receive data using the data line. Therefore, when the master SPI device 101 drives the first chip select signal to an active state and drives the second chip select signal to an inactive state, the master SPI device 101 and the first slave SPI device 103 can simultaneously receive data transmitted by the second slave SPI device 103, thereby improving the data transmission efficiency between the master SPI device and multiple slave SPI devices.

[0145] When the master SPI device 101 includes one of the multiple camera modules of the photographing device, the first slave SPI device 102 includes another camera module of the photographing device, and the second slave SPI device 103 includes a gyroscope sensor of the photographing device, the multiple camera modules including the master SPI device 101 and the first slave SPI device 102 can simultaneously receive the gyroscope information (or called gyroscope sensor data) transmitted by the gyroscope sensor. Here, the gyroscope information may include data such as X / Y / Z three-axis angular velocity information of the gyroscope. A camera module that supports optical image stabilization may calculate the camera shake during shooting based on the X / Y / Z three-axis angular velocity information of the gyroscope, and use a motor (e.g., a motor integrated in the camera module) to control the lens to perform image stabilization. The data transmission method can improve the efficiency of receiving the gyroscope information by the multiple camera modules, thereby optimizing the optical image stabilization effect.

[0146] Additionally, master SPI device 101 should avoid simultaneously driving the first chip select signal to a valid state and the second chip select signal to a valid state. If master SPI device 101 erroneously drives the first chip select signal and the second chip select signal to a valid state simultaneously, first slave SPI device 102 may determine that the driving state is incorrect and not respond to bus operations.

[0147] In a possible example, the first slave SPI device 102 may switch its data ports to implement switching between the connections shown in Figures 5 and 8 without changing the connection lines between the chips. Switching data ports includes, but is not limited to, switching a data port from a unidirectional data port to a bidirectional data port, switching a transmit port to a receive port, or switching a receive port to a transmit port.

[0148] When CS1=1 & CS2=0, the transmit port of the first slave SPI device 102 is connected to the receive port of the master SPI device 101 (in other words, the transmit port of the first slave SPI device 102 is connected to the receive port of the master SPI device 101 and the transmit port of the second slave SPI device 103), and the receive port of the first slave SPI device 102 is connected to the transmit port of the master SPI device 101 (in other words, the receive port of the first slave SPI device 102 is connected to the transmit port of the master SPI device 101 and the transmit port of the second slave SPI device 103). 5. In this case, when the first slave SPI device 102 is connected to the receive port of the master SPI device 101, in response to CS1 and CS2, the first slave SPI device 102 may switch the transmit port of the first slave SPI device 102 to the receive port (in other words, the first slave SPI device 102 switches the SDO of the first slave SPI device 102 to SDI) and switch the receive port of the first slave SPI device 102 to the transmit port (in other words, the first slave SPI device 102 switches the SDI of the first slave SPI device 102 to SDO) to obtain the connection relationship shown in FIG. 5. In this case, the receive port of the first slave SPI device 102 is connected to the receive port of the master SPI device 101, and the transmit port of the first slave SPI device 102 is connected to the transmit port of the master SPI device 101.

[0149] Additionally, when CS≠1 or CS≠0, if the receive port of the first slave SPI device 102 is connected to the receive port of the master SPI device 101 and the transmit port of the first slave SPI device 102 is connected to the transmit port of the master SPI device 101, in response to CS1 and CS2, the first slave SPI device 102 may switch the receive port of the first slave SPI device 102 to the transmit port (in other words, the first slave SPI device 102 switches the SDI of the first slave SPI device 102 to SDO) and switch the transmit port of the first slave SPI device 102 to the receive port (in other words, the first slave SPI device 102 switches the SDO of the first slave SPI device 102 to SDI), thereby obtaining the connection relationship shown in FIG. 8.

[0150] With reference to FIG. 9, the manner in which the first slave SPI device 102 performs data port switching will now be described.

[0151] As shown in FIG. 9, the first slave SPI device 102 may include an SPI controller, an SPI control logic unit (or called an SPI control logic circuit), an SPI data receive / transmit switch unit (or called an SPI data receive / transmit switch circuit), an SPI data port (or called a data port), etc.

[0152] For example, the SPI controller may be configured to process data that the first slave SPI device 102 needs to transmit, or may be configured to process data that the first slave SPI device 102 receives using the data lines. For example, the SPI controller may include a transmit module and a receive module. The transmit module may be configured to process and transmit data that needs to be transmitted to a transmit port, and the receive module may be configured to receive and process data from a receive port. The SPI controller may further control the reception and / or transmission of data based on an operation mode of the first slave SPI device 102. For example, when the first slave SPI device 102 is in a listening mode, the SPI controller may not transmit data that needs to be transmitted to the transmit port. In another example, when the first slave SPI device 102 is in a non-selected mode, the SPI controller may not transmit data that needs to be transmitted to the transmit port, and the SPI controller may not process data from the receive port using the receive module.

[0153] The SPI control logic unit may receive the first chip select signal and the second chip select signal, and determine a dual chip select logic decision result based on the first chip select signal and the second chip select signal. The decision result may be shown in FIG. 2 or Table 1. The SPI control logic unit may be further configured to output the logic decision result to the SPI controller to indicate an operation mode of the first slave SPI device 102. The SPI control logic unit may be further configured to set a transmission direction of the SPI data port based on the logic decision result. The SPI control logic unit may be further configured to control the SPI data receive / transmit switch unit to connect the SPI data port with a transmit module and / or a receive module in the SPI controller.

[0154] The SPI data receive / transmit switch unit may be configured to connect the SPI data port and a transmit module in the SPI controller under the control of the SPI control logic unit to form a transmit channel. The transmit channel may be configured for the first slave SPI device 102 to transmit data to the SDO. The SPI data receive / transmit switch unit may be further configured to connect the SPI data port and a receive module in the SPI controller under the control of the SPI control logic unit to form a receive channel. The receive channel may be configured for the first slave SPI device 102 to receive data from the SDI.

[0155] For example, the first slave SPI device 102 may include at least one SPI data port. When the number of SPI data ports is 1, the first slave SPI device 102 supports only the 3-wire mode. When the number of SPI data ports is 2 or more, the first slave SPI device 102 may support both the 3-wire mode and the 4-wire mode.

[0156] For example, the SPI data port includes SPI data port 1 and SPI data port 2. During port switching, in the case of a 3-wire mode, the SPI control logic unit may switch the SPI data port 1 (or data port 2) to a bidirectional data port. Specifically, the SPI control logic unit may use the setting interface 1 to set the transmission direction of the SPI data port 1 (or data port 2) to bidirectional transmission, and use the setting interface 2 to control the SPI data port 1 (or data port 2) to connect to the transmitting module and the receiving module of the SPI controller.

[0157] For example, the SPI data port includes SPI data port 1 and SPI data port 2. During port switching, in 4-wire mode, when CS1=0&CS2=1, the SPI control logic unit may use setting interface 1 to set the transmission direction of SPI data port 1 and data port 2.

[0158] For example, in 4-wire mode, when CS1≠0 or CS2≠1, the transmission direction of SPI Data Port 1 is the send direction and the transmission direction of SPI Data Port 2 is the receive direction, i.e., SPI Data Port 1 is the send port (in this case, the data line connected to SPI Data Port 1 is SDO) and SPI Data Port 2 is the receive port (in this case, the data line connected to SPI Data Port 2 is SDI), then when CS1=0&CS2=1, the SPI control logic unit may use the configuration interface 1 to set the transmission direction of SPI Data Port 1 to the receive direction and use the configuration interface 1 to set the transmission direction of SPI Data Port 2 to the send direction, i.e., the SPI control logic unit may use the configuration interface 1 to set SPI Data Port 1 to the receive port (in this case, the data line connected to SPI Data Port 1 is SDI) and use the configuration interface 1 to set SPI Data Port 2 to the send port (in this case, the data line connected to SPI Data Port 2 is SDO). Additionally, the SPI control logic unit further controls the SPI data receive / transmit switching unit to connect the SPI data interface 1 to a receiving module of the SPI controller using the setting interface 2 to form a receiving channel, and the SPI control logic unit further controls the SPI data receive / transmit switching unit to connect the SPI data interface 2 to a transmitting module of the SPI controller using the setting interface 2 to form a transmitting channel. So far, the switching of the transmitting port and the receiving port has been completed.

[0159] Additionally, in 4-wire mode, when the state of CS1 and CS2 is changed from CS1=0&CS2=1 to CS1≠0 or CS2≠1 (e.g., CS1=1 or CS2=0), if the transmission direction of SPI Data Port 1 is the receive direction and the transmission direction of SPI Data Port 2 is the transmit direction, the SPI control logic unit uses configuration interface 1 to set the transmission direction of SPI Data Port 1 to the transmit direction (in this case, the data line connected to SPI Data Port 1 is SDO) and uses configuration interface 1 to set the transmission direction of SPI Data Port 2 to the receive direction (in this case, the data line connected to SPI Data Port 2 is SDI). Additionally, the SPI control logic unit further controls the SPI data receive / transmit switching unit to connect the SPI data interface 1 to a transmitting module of the SPI controller using the setting interface 2 to form a transmitting channel, and the SPI control logic unit further controls the SPI data receive / transmit switching unit to connect the SPI data interface 2 to a receiving module of the SPI controller using the setting interface 2 to form a receiving channel. So far, the switching of the transmitting port and the receiving port has been completed.

[0160] For example, the functionality of the SPI control logic unit, the SPI controller, the SPI data receive / transmit switch unit, or some or all of the components of the SPI data port shown in FIG. 9 may be implemented by an integrated circuit or logic circuit.

[0161] It should be understood that FIG. 1 only shows a data transmission system including, for example, one master SPI device and two slave SPI devices, and the present application is not limited thereto and may be applied to a data transmission system including more slave SPI devices. For example, the data transmission system may include at least one master SPI device and two or more slave SPI devices (including slave SPI device A and slave SPI device B, or including slave SPI device A, slave SPI device B and further SPI devices). The master SPI device outputs at least two SPI chip select signals. The chip select signal CS1 is connected to all slave SPI devices simultaneously, and another chip select signal CS2 is connected to only one slave SPI device B. CS1=0&CS 2 When CS1=1&CS2=1, the master SPI device can select one slave SPI device A and perform data read / write operations to the slave SPI device A, and the slave SPI device B works in data listening mode. 2 When B = 0, the master SPI device may perform read / write operations to the slave SPI device B.

[0162] Based on the same concept, this application further provides a chip, which may have the function of the first slave SPI device 102. In other words, the first slave SPI device shown in FIG. 1 may be replaced by the chip.

[0163] For example, the chip may have a structure shown in Fig. 9. As shown in Fig. 9, the chip may include an SPI controller, an SPI control logic unit (or called an SPI control logic circuit), an SPI data receive / transmit switch unit (or called an SPI data receive / transmit switch circuit), and an SPI data port (or called a data port).

[0164] The SPI control logic unit may be configured to receive a first chip select signal and a second chip select signal from the master SPI device. A combination of the first chip select signal and the second chip select signal is used to enable the chip. The SPI data port may be connected to the master SPI device and the second slave SPI device using data lines. The SPI control logic unit may be configured to control the SPI controller to receive data transmitted by the second slave SPI device on the data lines via the SPI data port when the master SPI device drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state.

[0165] Optionally, the SPI data port may include a transmit port and a receive port, the transmit port connected to the receive port of the master SPI device with a data line, the receive port connected to the transmit port of the master SPI device with a data line, the transmit port configured for the chip to transmit data on the data lines, and the receive port configured for the chip to receive data transmitted on the data lines. The SPI control logic unit may be further configured to configure the transmit port to receive data transmitted on the data lines when the master SPI device drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state.

[0166] The chip may further include an SPI data receive / transmit switch unit. The SPI controller may include a transmit module and a receive module. The transmit module is configured to transmit data, and the receive module is configured to receive data. The SPI control logic unit may be further configured to control the SPI data receive / transmit switch unit to connect the transmit port to the receive module when the master SPI device drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state.

[0167] The SPI control logic unit may be further configured to configure the SPI data port as a bidirectional data port, the bidirectional data port supporting both receiving and transmitting data.

[0168] The SPI control logic unit may be further configured to control the SPI controller to not transmit data in response to a first indicator transmitted over the data lines when the master SPI device drives the first chip select signal to an enabled state and the second chip select signal to an disabled state, the first indicator being used to control the transmission of the data.

[0169] The SPI control logic unit may be further configured to control the SPI controller to receive data transmitted on the data lines via the SPI data port when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state. The SPI controller may be further configured to receive a second indication transmitted on the data lines when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state, the second indication being used to control reception of the data, and to receive the data transmitted on the data lines in response to the second indication via the SPI data port.

[0170] The SPI control logic unit may be further configured to control the SPI controller to receive data transmitted on the data lines via the SPI data port when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state. The SPI controller may be further configured to receive a first indication transmitted on the data lines when the master SPI device drives the first chip select signal to an invalid state and the second chip select signal to an valid state, the first indication being used to control transmission of the data, and to transmit the data on the data lines via the SPI data port in response to the first indication.

[0171] The SPI control logic unit may be further configured to control the SPI controller not to transmit data over the data lines and to control the SPI controller not to receive data over the data lines when the master SPI device drives the first chip select signal to an invalid state and drives the second chip select signal to an invalid state.

[0172] Based on the same concept, this application further provides a camera module. The camera module may include a chip or may include a first slave SPI device 102. For example, the first slave SPI device 102 is a motor driving IC in the camera module or functions as a component of a motor driving IC in the camera module. For example, the camera module may support image stabilization.

[0173] The camera module may further include a motor and a camera. When the second slave SPI device includes a gyroscope sensor, the motor may be configured to obtain gyroscope sensor data from the chip to perform vibration control and / or autofocus of the camera based on the gyroscope sensor data.

[0174] When a camera module (hereinafter referred to as camera module 1) serves as a first slave SPI device 102, another camera module (hereinafter referred to as camera module 2) serves as a master SPI device 101, and the gyroscope sensor serves as a second slave SPI device 103, camera module 1 may receive gyroscope information from the gyroscope sensor using the data line when the master SPI device drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state, and at the same time, camera module 2 may also receive gyroscope information from the gyroscope sensor using the data line, which is different from the conventional technology in which camera module 2 first receives gyroscope data from the gyroscope sensor, and then camera module 2 transmits the gyroscope data to camera module 1. Therefore, in this embodiment of the application, the receiving efficiency of gyroscope information by camera module 1 and camera module 2 can be improved, and the image stabilization effect of the camera module can be improved.

[0175] For example, in the above example, the master SPI device 101 may function as a motor drive IC for the camera module 2 or a component of the motor drive IC for the camera module 2.

[0176] Based on the same concept, the application further provides a terminal device, which may be a smartphone, a mobile smart device, a smart home device, a tablet computer, etc., or may be a portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile device.

[0177] For example, the terminal device may include a data transmission system. Alternatively, the terminal device may include a chip.

[0178] Alternatively, the terminal device may include a camera module. In this case, the terminal device may be a photographing device, which may perform photographing using the camera module and implement image stabilization and autofocus in the photographing process. The terminal device may further include an image processing chip configured to obtain an image signal from the camera module and process the image signal.

[0179] Based on the same concept, this application further provides another data transmission system. As shown in FIG. 10, the data transmission system 1000 may include a first camera module 1001, a second camera module 1002, and a first sensor 1003. The first camera module 1001 serves as a master SPI device. The second camera module 1002 and the first sensor 1003 serve as slave SPI devices. The first camera module 1001, the second camera module 1002, and the first sensor 1003 communicate with each other using the SPI protocol. When the first camera and the second camera work simultaneously, the first camera acquires the first sensor data using the SPI protocol, and the second camera acquires the first sensor data using the SPI protocol simultaneously, thereby improving the efficiency of acquiring sensor data by multiple cameras in the SPI system.

[0180] It should be understood that the data transmission system 1000 may be applied to a terminal device or another electronic device having an SPI structure, for example, a device such as a mobile terminal or a computer. For example, a possible application scenario of the data transmission system 1000 provided in this embodiment of the application is a photographing device including multiple camera modules. The photographing device may be a smartphone, a mobile smart device, a smart home device, a tablet computer, etc., with a photographing function, or may be a portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile device.

[0181] In this scenario, the first camera module 1001 may include one camera module or camera of a plurality of camera modules of the imaging device, the second camera module 1002 may include another camera module or camera of the imaging device, and the first sensor 1003 may include a gyroscope sensor of the imaging device. The gyroscope sensor may be disposed on a main board of the imaging device. For example, the first camera module 1001 and the second camera module 1002 may each include at least one motor drive chip, or what is called a motor drive integrated circuit (IC). The motor drive IC may be configured to output a current or pulse width modulation (PWM) signal to control the motor of the camera module to perform a movement motion as required to implement image stabilization.

[0182] The following describes the connection and operation of each component of the data transmission system 1000. In the following description, it should be understood that the first camera module 1001 may be replaced with a first camera, and the second camera module 1002 may be replaced with a second camera.

[0183] In the data transmission system 1000, the first camera module 1001, the second camera module 1002, and the first sensor 1003 are connected using data lines. For example, any two of the first camera module 1001, the second camera module 1002, and the first sensor 1003 are connected using a data line, or the first camera module 1001, the second camera module 1002, and the first sensor 1003 are connected using the same data line. For example, if the first camera module 1001, the second camera module 1002, and the first sensor 1003 are connected in a 3-wire mode, the data line may include SDA. Alternatively, if the first camera module 1001, the second camera module 1002, and the first sensor 1003 are connected in a 4-wire mode, the data line may include SDO and SDI.

[0184] Additionally, the first camera module 1001, the second camera module 1002, and the first sensor 1003 are further connected using a clock line.

[0185] 10, the first camera module 1001 outputs a first chip select signal (CS1) to the second camera module 1002 and outputs a second chip select signal (CS2) to the second camera module 1002. Thus, the first camera module 1001 may enable the second camera module 1002 to be in one of a plurality of operating modes using a combination of an enabled or disabled state of the first chip select signal and an enabled or disabled state of the second chip select signal.

[0186] The multiple operating modes may include a data listening mode, a standard slave SPI device mode, and a non-selected mode.

[0187] In the data listening mode, the second camera module 1002 may receive data transmitted by the first sensor 1003 to the first camera module 1001 and / or receive data transmitted by the first camera module 1001 to the first sensor 1003 using the data line. Additionally, in the data listening mode, the second camera module 1002 does not transmit data using the data line. Thus, even if a write indicator bit from the first camera module 1001 is received, the second camera module 1002 does not transmit data in response to the write indicator bit.

[0188] In the standard slave SPI device mode, the second camera module 1002 may transmit data using the data lines based on a write index bit from the first camera module 1001 and / or receive data using the data lines based on a read index bit from the first camera module 1001. Thus, when the second camera module 1002 receives a write index bit from the first camera module 1001, it transmits data in response to the write index bit. Alternatively, when the second camera module 1002 receives a read index bit from the first camera module 1001, it receives data in response to the read index bit.

[0189] For example, the data listening mode may correspond to a preset state combination of the first chip select signal and the second chip select signal, such as when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, the second camera module 1002 is in the data listening mode.

[0190] The standard slave SPI device mode may correspond to different preset state combinations of the first chip select signal and the second chip select signal, for example, when the first chip select signal is in an invalid state and the second chip select signal is in an valid state, the second camera module 1002 is in the standard slave SPI device mode.

[0191] The non-select mode may correspond to another preset state combination of the first chip select signal and the second chip select signal, for example, when the first chip select signal is in an invalid state and the second chip select signal is in an invalid state, the second camera module 1002 is in the non-select mode.

[0192] It should be understood that the above correspondence between the multiple operation modes and the state combinations of the first and second chip select signals are merely examples for explanation, and the correspondence between the operation modes and the state combinations of the chip select signals may be flexibly adjusted based on application requirements. For example, a setting that when the first chip select signal is in an enabled state and the second chip select signal is in an enabled state, the second camera module 1002 is in a data listening mode may alternatively be used. Additionally, the correspondence between the multiple operation modes of the second camera module 1002 and the state combinations of the first and second chip select signals may alternatively be set by the master SPI device, i.e., the first camera module 1001.

[0193] For example, the dual chip select logic decision result of the second camera module 1002 may be represented by Fig. 2. The dual chip select logic decision result is the working mode of the second camera module 1002. In Fig. 2, CS1=0 indicates that the first chip select signal is in an enabled state, CS2=0 indicates that the second chip select signal is in an enabled state, CS1=1 indicates that the first chip select signal is in an disabled state, and CS2=1 indicates that the second chip select signal is in an disabled state. "a&b" means "a and b".

[0194] According to FIG. 2, when CS1=0&CS2=1, or when CS1 and CS2 are in a preset state combination (e.g., a state combination corresponding to the data listening mode of the second camera module 1002), the dual chip selection logic decision result is the data listening mode, and the second camera module 1002 may enter the data listening mode based on the decision result (i.e., the second camera module 1002 is in the data listening mode). In the data listening mode, the second camera module 1002 may receive data using the data line, but does not transmit data using the data line. In other words, in the data listening mode, regardless of whether the first camera module 1001 outputs a write indicator bit or a read indicator bit, the second camera module 1002 only listens on the data line and receives data transmitted on the data line.

[0195] When CS1=1&CS2=0, or when CS1 and CS2 are in a preset state combination (e.g., a state combination corresponding to the standard slave SPI device mode of the second camera module 1002), the dual chip select logic decision result is the standard slave SPI device mode (or called standard slave mode), and the second camera module 1002 may enter the standard slave SPI device mode based on the decision result (in other words, the second camera module 1002 is in the standard slave SPI device mode). In the standard slave mode, the second camera module 1002 may receive data using the data line based on the read index bit output by the first camera module 1001, and may also transmit data using the data line based on the write index bit output by the first camera module 1001.

[0196] Additionally, when CS1=1&CS2=1, or when CS1&CS2 are in a preset state combination (e.g., a state combination corresponding to the non-selection mode of the second camera module 1002), the dual chip select logic decision result is the non-selection mode, and the second camera module 1002 may enter the non-selection mode based on the decision result (in other words, the second camera module 1002 is in the non-selection mode). In the non-selection mode, the second camera module 1002 does not receive data using the data lines, and does not transmit data using the data lines. In other words, in the non-selection mode, the second camera module 1002 does not respond to the index of the first camera module 1001, regardless of whether the first camera module 1001 outputs a write index bit or a read index bit.

[0197] The bus access mode of the second camera module 1002 in the data listening mode is described as an example with reference to Fig. 3. As shown in Fig. 3, when CS1=0&CS2=1, no matter whether the first camera module 1001 sets the first data bit (i.e., read / write indicator bit) after SCK starts to 0 (representing write) or 1 (representing read), the second camera module 1002 only supports data input and does not output data to the data lines (including SDA in 3-wire mode or SDO in 4-wire mode) because the second camera module 1002 is in the data listening mode.

[0198] Specifically, in the case of the 3-wire mode, the connection relationship between the first camera module 1001, the second camera module 1002, and the first sensor 1003 is shown in Figure 11. It can be seen that the respective data ports (data ports connected to SDA) of the first camera module 1001, the second camera module 1002, and the first sensor 1003 all support bidirectional data transmission. For example, when in the 3-wire mode, the second camera module 1002 may set its data port to a bidirectional port.

[0199] 11, in the three-wire mode, when the first camera module 1001 drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state, if the first camera module 1001 transmits a write indicator bit using SDA, after receiving the write indicator bit using SDA, the first sensor 1003 may transmit data using SDA in response to the write indicator bit, the first camera module 1001 may receive data transmitted by the first sensor 1003 using SDA, and the second camera 1002 may receive data transmitted by the first sensor 1003 using SDA because the second camera 1002 is in a data listening mode. Additionally, the second camera module 1002 does not transmit data on SDA in response to the write indicator bit transmitted by SDA to avoid data contention on SDA (in other words, the second camera module 1002 skips transmitting data in response to the write indicator bit).

[0200] The expression "an SPI device transmits data using SDA / SDO" in this application should be understood to mean that an SPI device transmits data to SDA / SDO via a transmit port connected to SDO, and SDA / SDO transmits data to another SPI device. The expression "an SPI device receives data using SDA / SDI" in this application should also be understood to mean that an SPI device receives data transmitted by another SPI device using the SDA / SDO of the other SPI device from SDA / SDI via a receive port connected to SDA / SDI.

[0201] Additionally, according to FIG. 11, in the three-wire mode, when the first camera module 1001 drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state, if the first camera module 1001 transmits a read indicator bit using SDA, the first camera module 1001 may further transmit data using SDA. In this case, the first sensor 1003 may receive data transmitted by the master SPI device 101 in response to the read indicator bit using SDA, and since the second camera module 1002 is in a data listening mode, the second camera module 1002 may receive data transmitted by the master SPI device 101 using SDA. In this way, multiple slave SPI devices can simultaneously receive data transmitted by the master SPI device, which improves the efficiency of receiving data from the master SPI device by multiple slave SPI devices.

[0202] In the case of the 4-wire mode, when the first camera module 1001 puts the first chip select signal in an active state and the second chip select signal in an inactive state, the connection relationship between the first camera module 1001, the second camera module 1002, and the first sensor 1003 is shown in Fig. 12. It can be seen that the first camera module 1001, the second camera module 1002, and the second slave SPI device 10 may transmit data through their respective transmit ports (the transmit port is connected to SDO) and receive data through their respective receive ports (the receive port is connected to SDI).

[0203] 12, in the 4-wire mode, when the first camera module 1001 transmits a write indicator bit using SDO, the first sensor 1003 may transmit data using SDO in response to the write indicator bit, the first camera module 1001 may receive the data transmitted by the first sensor 1003 using SDO using SDI, and since the second camera module 1002 is in a data listening mode, the second camera module 1002 may receive the data transmitted by the first sensor 1003 using SDO using SDI. Additionally, the SDO of the second camera module 1002 does not receive the write indicator bit transmitted by the first camera module 1001 using SDO. Therefore, the second camera module 1002 does not send data in response to the write indicator bit sent by the first camera module 1001 to avoid data transmission contention (in other words, the second camera module 1002 skips sending data in response to the write indicator bit).

[0204] Additionally, as shown in FIG. 12, in the case of 4-wire mode, when the first camera module 1001 enables the first chip select signal and disables the second chip select signal, the first camera module 1001 may send a read indicator bit using SDO and when sending data using SDO, the first sensor 1003 may receive data using SDI in response to the read indicator bit.

[0205] The bus access mode of the second camera module 1002 in the standard slave SPI device mode is described as an example with reference to FIG. 6 and FIG. 7. As shown in FIG. 6, in the standard slave SPI device mode, the second camera module 1002 operates in the standard slave SPI device mode, and if the first camera module 1001 sets the first data bit after SCK starts to 0, the second camera module 1002 may read data transmitted on the data line (SDA or SDI) under the control of the first camera module 1001. As shown in FIG. 7, in the standard slave SPI device mode, if the first camera module 1001 sets the first data bit after SCK starts to 1, the second camera module 1002 may transmit data using the data line (SDA or SDO) under the control of the first camera module 1001. Thus, in the standard slave SPI device mode, the second camera module 1002 may implement data transmission between the second camera module 1002 and the first camera module 1001 under the control of the first camera module 1001.

[0206] Specifically, in the case of the 3-wire mode, the connection relationship between the first camera module 1001, the second camera module 1002, and the first sensor 1003 is shown in Figure 11. When the first camera module 1001 drives the first chip select signal to the disabled state and drives the second chip select signal to the enabled state, if the first camera module 1001 sends a write index bit using SDA, since the second camera module 1002 is in the standard slave mode, Second Camera Module 1002 After receiving the write indicator bit using SDA, the first camera module 1001 may receive data sent by the second camera module 1002 using SDA in response to the write indicator bit. In this case, the first sensor 1003 is in a non-selected state and does not respond to the write indicator bit sent by SDA.

[0207] Additionally, in the case of 3-wire mode, when the first camera module 1001 disables the first chip select signal and enables the second chip select signal, the first camera module 1001 may transmit a read indicator bit using SDA and transmit data using SDA, since the second camera module 1002 is in standard slave mode, the second camera module 1002 may receive data using SDA in response to the read indicator bit transmitted by SDA. Additionally, in this case, the first sensor 1003 is in a non-selected state and does not respond to the read indicator bit transmitted by SDA.

[0208] Specifically, in the case of the 4-wire mode, the connection relationship between the first camera module 1001, the second camera module 1002, and the first sensor 1003 is shown in FIG. 13. The first camera module 1001 outputs a first chip select signal invalid state and the second chip select signal valid When driving to the selected state, if the first camera module 1001 sends a write index bit using SDO, the second camera module 1002 is in standard slave mode, so the second camera module 1002 may receive the write index bit using SDI and send data using SDO in response to the write index bit, and the first camera module 1001 may receive, using SDI, the data sent using SDO by the second camera module 1002. Additionally, in this case, the first sensor 1003 is in the unselected state and does not respond to the write index bit sent using SDO by the first camera module 1001.

[0209] Additionally, as shown in FIG. 13, the first camera module 1001 outputs a first chip select signal invalid state, and the second chip select signal validWhen in the selected state, if the first camera module 1001 transmits a read indicator bit using SDO and transmits data using SDO, the second camera module 1002 may receive the read indicator bit using SDI and read data using SDI in response to the read indicator bit since the second camera module 1002 is in standard slave mode. Additionally, in this case, the first sensor 1003 is in a non-selected state and does not respond to the read indicator bit transmitted by the first camera module 1001 using SDO.

[0210] In the non-selection mode, it should be understood that in the 3-wire mode, the connection relationship between the first camera module 1001, the second camera module 1002, and the first sensor 1003 is shown in Fig. 11. Additionally, in the 4-wire mode, the connection relationship between the first camera module 1001, the second camera module 1002, and the first sensor 1003 is shown in Fig. 13.

[0211] Optionally, the dual chip selection logic decision result may be represented by Table 1.

[0212] As shown in FIG. 2 or Table 1, when the state of the first chip select signal is a valid state and the state of the second chip select signal is an invalid state, the second camera module 1002 may be enabled to enter a data listening mode. When the state of the first chip select signal is an invalid state and the state of the second chip select signal is a valid state, the second camera module 1002 may be enabled to enter a standard slave SPI device mode. When the state of the first chip select signal is an invalid state and the state of the second chip select signal is an invalid state, the second camera module 1002 may be enabled to enter a non-select mode.

[0213] Additionally, the first camera module 1001 may output a first chip select signal and a second chip select signal to the first sensor 1003, and use the first chip select signal and the second chip select signal to control whether to enable the first sensor 1003. Thus, the first camera module 1001 may use a combination of an enabled or disabled state of the first chip select signal and an enabled or disabled state of the second chip select signal to enable the first sensor 1003 to be in multiple operation modes. For example, the multiple operation modes of the first sensor 1003 may include a data listening mode, a standard slave SPI device mode, and a non-selection mode. Alternatively, the multiple operation modes of the first sensor 1003 may include a standard slave SPI device mode, and a non-selection mode.

[0214] For example, the first sensor 1003 is in a standard slave SPI device mode or a non-selected mode when the second camera module 1002 is in a listening mode, and / or the second camera module 1002 is in a standard slave SPI device mode or a non-selected mode when the first sensor 1003 is in a listening mode. For the operation modes of the first sensor 1003, see the description of the operation modes of the second camera module 1002 in this application.

[0215] With reference to the operation modes of the second camera module 1002 and the first sensor 1003 shown in Table 1, when the first camera module 1001 drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state, the first camera module 1001 may control the first sensor 1003 to transmit data using the data line, and may receive data transmitted by the first sensor 1003 using the data line. In this case, since the second camera module 1002 is in a data listening mode, the second camera module 1002 may receive data using the data line. Thus, when the first camera module 1001 drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state, the first camera module 1001 and Second Camera Module 1002 can simultaneously receive the data transmitted by the first sensor 1003, thereby improving the data transmission efficiency between the master SPI device and multiple slave SPI devices.

[0216] When the first camera module 1001 includes one of the multiple camera modules of the photographing device, the second camera module 1002 includes another camera module of the photographing device, and the first sensor 1003 includes a gyroscope sensor of the photographing device, the multiple camera modules including the first camera module 1001 and the second camera module 1002 can simultaneously receive the gyroscope information (or called gyroscope sensor data) transmitted by the gyroscope sensor. Here, the gyroscope information may include data such as X / Y / Z three-axis angular velocity information of the gyroscope. A camera module supporting optical image stabilization may calculate the camera shake during shooting based on the X / Y / Z three-axis angular velocity information of the gyroscope, and control the lens to perform image stabilization using a motor (e.g., a motor integrated in the camera module). The data transmission method can improve the efficiency of receiving the gyroscope information by the multiple camera modules, thereby optimizing the optical image stabilization effect.

[0217] Additionally, the first camera module 1001 should avoid simultaneously driving the first chip select signal to an enabled state and the second chip select signal to an enabled state. If the first camera module 1001 erroneously drives the first chip select signal and the second chip select signal to an enabled state simultaneously, the second camera module 1002 may determine that the drive state is incorrect and not respond to bus operations.

[0218] In a possible example, the second camera module 1002 may switch its data ports to implement switching between the connections shown in Figures 12 and 13 without changing the connection lines between the chips. Switching data ports includes, but is not limited to, switching a data port from a unidirectional data port to a bidirectional data port, switching a transmit port to a receive port, or switching a receive port to a transmit port.

[0219] When CS1=0&CS2=1, or when CS1 and CS2 are in a preset state combination (e.g., a state combination corresponding to the data listening mode of the second camera module 1002), the transmit port of the second camera module 1002 is connected to the receive port of the first camera module 1001 using a first data line (in other words, the transmit port of the second camera module 1002 is connected to the receive port of the first camera module 1001 and the transmit port of the first sensor 1003 using a first data line), and the receive port of the second camera module 1002 is connected to the transmit port of the first camera module 1001 using a second data line (in other words, the transmit port of the second camera module 1002 is connected to the transmit port of the first camera module 1001 using a second data line). 12 ), in response to CS1 and CS2, the second camera module 1002 may switch the transmission port of the second camera module 1002 to the reception port (in other words, the second camera module 1002 switches the SDO of the second camera module 1002 to SDI) and switch the reception port of the second camera module 1002 to the transmission port (in other words, the second camera module 1002 switches the SDI of the second camera module 1002 to SDO), thereby obtaining the connection relationship shown in FIG. 12 . In this case, the receive port of the second camera module 1002 is connected to the receive port of the first camera module 1001, and the transmit port of the second camera module 1002 is connected to the transmit port of the first camera module 1001.

[0220] Additionally, when CS1 ≠ 0 or CS2 ≠ 1, or when CS1 and CS2 are in a preset state combination (e.g., any combination that is not a state combination corresponding to a data listening mode of the second camera module 1002), if the receive port of the second camera module 1002 is connected to the receive port of the first camera module 1001 and the transmit port of the second camera module 1002 is connected to the transmit port of the first camera module 1001, then CS1 and In response to CS1 and CS2, the second camera module 1002 may switch the receiving port of the second camera module 1002 to a transmitting port (in other words, the second camera module 1002 switches the SDI of the second camera module 1002 to SDO) and switch the transmitting port of the second camera module 1002 to a receiving port (in other words, the second camera module 1002 switches the SDO of the second camera module 1002 to SDI) to obtain the connection relationship shown in FIG. 13.

[0221] With reference to FIG. 9, the following describes how the second camera module 1002 performs data port switching. It should be understood that the second camera module 1002 may include components such as a circuit, a camera, and a motor. The circuit may be configured to receive and / or transmit data based on a chip select signal using an SPI protocol. The camera may be configured to capture an image or video. The motor may be configured to perform vibration control and / or autofocus for the camera.

[0222] As shown in FIG. 9, the circuit may include an SPI controller, an SPI control logic unit (or referred to as an SPI control logic circuit), an SPI data receive / transmit switch unit (or referred to as an SPI data receive / transmit switch circuit), and an SPI data port (or referred to as a data port).

[0223] For example, the SPI controller may be configured to control the SPI data port to acquire the first sensor data when the first camera module 1001 acquires the first sensor data using an SPI protocol. The SPI data port is configured for the second camera module 1002 to perform SPI protocol communication with the first camera module 1001 and / or the first sensor 1003. The first camera module 1001 is a master SPI device, and the second camera 1002 and the first sensor 1003 are slave SPI devices.

[0224] Specifically, the SPI controller may be configured to process data that needs to be transmitted and may be configured to process data received using the data line. For example, the SPI controller may include a transmit module and a receive module. The transmit module may be configured to process and transmit data that needs to be transmitted to a transmit port, and the receive module may be configured to receive and process data from a receive port. The SPI controller may further control the reception and / or transmission of data based on the operation mode of the second camera module 1002. For example, when the second camera module 1002 is in a data listening mode, the SPI controller may control the SPI data port not to transmit data that needs to be transmitted to the transmit port. In another example, when the second camera module 1002 is in a non-select mode, the SPI controller may control the SPI data port not to transmit data that needs to be transmitted to the transmit port and control the SPI data port not to receive data from the data line using the receive module.

[0225] The SPI control logic unit may receive the first chip select signal and the second chip select signal, and determine a dual chip select logic decision result based on the first chip select signal and the second chip select signal. The decision result may be shown in FIG. 2 or Table 1. The SPI control logic unit may be further configured to output the logic decision result to the SPI controller to indicate an operation mode of the second camera module 1002. The SPI control logic unit may be further configured to set a transmission direction of the SPI data port based on the logic decision result. The SPI control logic unit may be further configured to control the SPI data receive / transmit switch unit to connect the SPI data port with a transmitting module and / or a receiving module in the SPI controller.

[0226] The SPI data receive / transmit switching unit may be configured to connect the SPI data port and a transmit module in the SPI controller under the control of the SPI control logic unit to form a transmit channel. The transmit channel may be configured to transmit data to the SDO. The SPI data receive / transmit switching unit may be further configured to connect the SPI data port and a receive module in the SPI controller under the control of the SPI control logic unit to form a receive channel. The receive channel may be configured to receive data from the SDI.

[0227] For example, the circuit may include at least one SPI data port. When the number of SPI data ports is 1, the second camera module 1002 supports only the 3-wire mode. When the number of SPI data ports is 2 or more, the second camera module 1002 may support the 3-wire mode and the 4-wire mode.

[0228] For example, the SPI data port includes SPI data port 1 and SPI data port 2. During port switching, in the case of a 3-wire mode, the SPI control logic unit may switch the SPI data port 1 (or data port 2) to a bidirectional data port. Specifically, the SPI control logic unit may use the setting interface 1 to set the transmission direction of the SPI data port 1 (or data port 2) to bidirectional transmission, and use the setting interface 2 to control the SPI data port 1 (or data port 2) to connect to the transmitting module and the receiving module of the SPI controller.

[0229] For example, the SPI data port includes SPI data port 1 and SPI data port 2. During port switching, in the case of 4-wire mode, when CS1=0&CS2=1, or when CS1 and CS2 are in a preset state combination (e.g., a state combination corresponding to the data listening mode of the second camera module 1002), the SPI control logic unit may use the setting interface 1 to set the transmission direction between SPI data port 1 and data port 2.

[0230] For example, in the 4-wire mode, when CS1 ≠ 0 or CS2 ≠ 1, or when CS1 and CS2 are in a preset state combination (e.g., any combination that is not a state combination corresponding to the data listening mode of the second camera module 1002), the transmission direction of SPI data port 1 is the transmit direction and the transmission direction of SPI data port 2 is the receive direction, i.e., when SPI data port 1 is the transmit port (in this case, the data line connected to SPI data port 1 is SDO) and SPI data port 2 is the receive port (in this case, the data line connected to SPI data port 2 is SDI), when CS1=0&CS2=1, or when CS1 and CS2 are in the preset state combination (e.g., any combination that is not a state combination corresponding to the data listening mode of the second camera module 1002), When entering a reset state combination (for example, a state combination corresponding to the data listening mode of the second camera module 1002), the SPI control logic unit uses the setting interface 1 to set the transmission direction of the SPI data port 1 to the receive direction, and uses the setting interface 1 to set the transmission direction of the SPI data port 2 to the transmit direction, that is, the SPI control logic unit uses the setting interface 1 to set the SPI data port 1 to the receive port (in this case, the data line connected to the SPI data port 1 is SDI), and uses the setting interface 1 to set the SPI data port 2 to the transmit port (in this case, the data line connected to the SPI data port 2 is SDO). Additionally, the SPI control logic unit uses the setting interface 2 to further control the SPI data receive / transmit switch unit to connect the SPI data interface 1 to the receive module of the SPI controller to form a receive channel, and the SPI control logic unit uses the setting interface 2 to further control the SPI data receive / transmit switch unit to connect the SPI data interface 2 to the transmit module of the SPI controller to form a transmit channel. So far, the switching of the transmit port and the receive port has been completed.

[0231] Additionally, in the 4-wire mode, when the state of CS1 and CS2 changes from CS1=0&CS2=1 to CS1≠0 or CS2≠1 (e.g., CS1=1 or CS2=0), or when CS1 and CS2 change from one preset state combination (e.g., a state combination corresponding to the data listening mode of the second camera module 1002) to another preset state combination (e.g., any combination other than the state combination corresponding to the data listening mode of the second camera module 1002), if the transmission direction of SPI data port 1 is the receive direction and the transmission direction of SPI data port 2 is the transmit direction, the SPI control logic unit uses the setting interface 1 to set the transmission direction of SPI data port 1 to the transmit direction (in this case, the data line connected to SPI data port 1 is SDO) and sets the transmission direction of SPI data port 2 to the receive direction (in this case, the data line connected to SPI data port 2 is SDI). Additionally, the SPI control logic unit further controls the SPI data receive / transmit switching unit to connect the SPI data interface 1 to a transmitting module of the SPI controller using the setting interface 2 to form a transmitting channel, and the SPI control logic unit further controls the SPI data receive / transmit switching unit to connect the SPI data interface 2 to a receiving module of the SPI controller using the setting interface 2 to form a receiving channel. So far, the switching of the transmitting port and the receiving port has been completed.

[0232] For example, the functionality of the SPI control logic unit, the SPI controller, the SPI data receive / transmit switch unit, or some or all of the components of the SPI data port shown in Figure 9 may be implemented by a chip, integrated circuit, or logic circuit. Each component of the circuit shown in Figure 9 may be implemented in an integrated manner, a discrete manner, or using a chip or chip system including multiple chips.

[0233] Based on the same concept, this application further provides a circuit, which may be connected to a second camera to implement the functionality shown in the second camera module 1002.

[0234] For example, the circuit may have a structure shown in Figure 9. As shown in Figure 9, the circuit may include an SPI controller, an SPI control logic unit (or referred to as an SPI control logic circuit), an SPI data receive / transmit switch unit (or referred to as an SPI data receive / transmit switch circuit), and an SPI data port (or referred to as a data port).

[0235] The SPI controller may be configured to control the SPI data port to acquire the first sensor data when the first camera acquires the first sensor data using an SPI protocol. The SPI data port is configured for the second camera to perform SPI protocol communication with the first camera and / or the first sensor. The first camera is a master SPI device, and the second camera and the first sensor are slave SPI devices.

[0236] In a possible design, the SPI data port may transmit acquired first sensor data to a second camera.

[0237] In a possible design, the SPI data port is connected to the first camera and the first sensor using data lines.

[0238] In a possible design, the circuit further includes an SPI control logic unit configured to receive a first chip select signal and a second chip select signal from the first camera. A combination of the first chip select signal and the second chip select signal is used to control whether to enable the second camera. When the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, the SPI control logic circuit may control the SPI controller to control the SPI data port to receive data transmitted by the first sensor on the data line to the first camera.

[0239] In a possible design, the circuit further includes an SPI control logic unit configured to receive a first chip select signal and a second chip select signal from the first camera. A combination of the first chip select signal and the second chip select signal is used to control whether to enable the second camera. When the first chip select signal and the second chip select signal are in a preset state combination, the SPI control logic circuit may control the SPI controller to control the SPI data port to receive data transmitted by the first sensor on the data line to the first camera.

[0240] In a possible design, the SPI control logic unit may further control the SPI controller to control the SPI data port to receive data transmitted by the first camera to the first sensor on the data line.

[0241] In a possible design, when the second camera's transmit port is connected to the first camera's receive port using a first data line, and the second camera's receive port is connected to the first camera's transmit port using a second data line, the data lines include a first data line and a second data line, the second camera's transmit port and the first camera's transmit port are configured to transmit data, and the second camera's receive port and the first camera's receive port are configured to receive data, the SPI control logic unit may further configure the transmit port to receive data transmitted on the data lines when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination.

[0242] In a possible design, the circuit further includes an SPI data receive / transmit switching circuit. The SPI controller may include a transmit module and a receive module. The transmit module is configured to transmit data, and the receive module is configured to receive data. The SPI control logic unit may further control the SPI data receive / transmit switching circuit to connect the transmit port to the receive module when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, or when the first chip select signal and the second chip select signal are in a preset state combination.

[0243] In a possible design, the SPI control logic unit may further configure the SPI data port to be a bi-directional data port, supporting both receiving and transmitting data.

[0244] In a possible design, the SPI control logic unit may further control the SPI controller to not transmit data in response to a first indicator transmitted over the data line when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination, the first indicator being used to control the transmission of the data.

[0245] In a possible design, when the first chip select signal is in an invalid state and the second chip select signal is in an valid state, or when the first chip select signal and the second chip select signal are in a preset state combination, the SPI control logic unit may control the SPI controller to receive, via the SPI data port, a second indication transmitted on the data lines. In response to the second indication, the SPI controller may control the SPI data port to receive data transmitted on the data lines. The second indication is used to control the reception of the data.

[0246] In a possible design, the SPI control logic unit may control the SPI controller to receive a first indication transmitted on the data lines via the SPI data port when the first chip select signal is in an invalid state and the second chip select signal is in an valid state or when the first chip select signal and the second chip select signal are in a preset state combination. The SPI controller may control the SPI data port to transmit data on the data lines in response to the first indication. The first indication is used to control the transmission of the data.

[0247] In a possible design, when the first chip select signal is in an invalid state and the second chip select signal is in an valid state, or when the first chip select signal and the second chip select signal are in a preset state combination, the SPI control logic unit controls the SPI controller not to transmit data over the data lines and controls the SPI controller not to receive data over the data lines.

[0248] Based on the same concept, this application further provides a circuit, which may be connected to the first camera to implement the functionality shown in the first camera module 1001.

[0249] For example, the circuit may have a structure as shown in Figure 14. As shown in Figure 14, the circuit may include components such as a control unit (or control circuit) and an SPI data port (or referred to as a data port).

[0250] The SPI data port is configured for the first camera module 1001 to obtain the first sensor data by using the SPI protocol. The control circuitry may be configured to control the second camera module 1002 to obtain the first sensor data by simultaneously using the SPI protocol. The first camera module 1001 is a master SPI device, and the second camera 1002 and the first sensor 1003 are slave SPI devices. The first sensor data originates from the first sensor 1003.

[0251] In a possible design, the SPI data port is connected to the second camera module 1002 and the first sensor 1003 using data lines.

[0252] In a possible design, the control circuit may output a first chip select signal to the second camera module 1002 and the first sensor 1003, and output a second chip select signal to the second camera module 1002 and the first sensor 1003. A state combination of the first chip select signal and the second chip select signal is used to control whether the second camera module 1002 is enabled and is used to control whether the first sensor 1003 is enabled.

[0253] In a possible design, when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state, the control circuit may control the first sensor 1003 to transmit data using the data lines, control the SPI data port to receive data transmitted by the first sensor 1003 using the data lines, and control the second camera module 1002 to receive data transmitted by the first sensor 1003 to the first camera module 1001 using the data lines.

[0254] In a possible design, when the first chip select signal and the second chip select signal are in a preset state combination (e.g., a state combination corresponding to a data listening mode of the second camera module 1002), the control circuit may control the first sensor 1003 to transmit data using the data line, control the SPI data port to receive data transmitted by the first sensor 1003 using the data line, and control the second camera module 1002 to receive data transmitted by the first sensor 1003 to the first camera module 1001 using the data line.

[0255] In a possible design, the control circuit may control the SPI data port to transmit data to the first sensor 1003 using the data lines, and control the second camera module 1002 to receive data transmitted by the first camera module 1001 to the first sensor 1003 using the data lines.

[0256] In a possible design, the control circuitry may control the SPI data port to transmit a first indicator over the data lines when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination. The first indicator is used to control the transmission of data.

[0257] In a possible design, the control circuitry may control the SPI data port to transmit a first indicator over the data lines when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in a preset state combination. The first indicator is used to control the transmission of data.

[0258] Based on the same concept, this application further provides a camera module, which may include a first camera module 1001 or a second camera module 1002.

[0259] For example, a first camera module 1001 may include the circuitry, motor, and first camera shown in Figure 14. The circuitry shown in Figure 14 may be specifically implemented by a motor drive IC or as a component of a motor drive IC within the camera module.

[0260] The second camera module 1002 may include the circuitry, motor, and second camera shown in Figure 9. The circuitry shown in Figure 9 may be specifically implemented by a motor drive IC or as a component of a motor drive IC within the camera module.

[0261] When the first sensor includes a gyroscope sensor, the motors in the first camera module 1001 and the second camera module 1002 may be configured to obtain gyroscope sensor data using circuitry and perform vibration control and / or autofocus for the cameras based on the gyroscope sensor data.

[0262] When the first camera module 1001 functions as a master SPI device, and the second camera module 1002 and the gyroscope sensor function as slave SPI devices, the first camera module 1001 can receive gyroscope information from the gyroscope sensor using the data line when it drives the first chip select signal to an enabled state and drives the second chip select signal to an disabled state, and at the same time, the second camera module 1002 may receive gyroscope information from the gyroscope sensor using the data line, which means that the first camera module 1001 first receives gyroscope data from the gyroscope sensor, and then the first camera module 1001 transmits the gyroscope data to the gyroscope sensor. Second Camera Module 1002 Therefore, in this embodiment of the application, the efficiency of receiving gyroscope information by the camera module can be improved, and the image stabilization effect of the camera module can be improved.

[0263] Based on the same concept, the application further provides a terminal device, which may be a smartphone, a mobile smart device, a smart home device, a tablet computer, etc., and may be a portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile device.

[0264] The terminal device may be a photographing device, and the photographing device may perform photographing using the first camera module and / or the second camera module, and may implement image stabilization and autofocus in the photographing process. The terminal device may further include an image processing chip configured to obtain an image signal from the camera module and process the image signal.

[0265] The terminal device may include some or all of the components of the circuit shown in Figure 9, the circuit shown in Figure 14, the first camera (or the first camera module 1001), and the second camera (or the second camera module 1002). The terminal device may further include a first sensor, where the first sensor includes a gyroscope sensor.

[0266] Alternatively, the terminal device may include a first camera module, a second camera module, and a gyroscope sensor configured to output gyroscope information. The first camera module, the second camera module, and the gyroscope sensor are connected using a serial peripheral interface SPI. The first camera module acts as a master SPI device, and the gyroscope sensor and the second camera module act as slave SPI devices, and the first camera module and the second camera module simultaneously acquire gyroscope information from the gyroscope sensor under control of an SPI chip select signal sent by the first camera module. The image processing unit is configured to acquire image signals from the first camera module and the second camera module.

[0267] In a possible design, both the first camera module and the second camera module are connected to the gyroscope sensor using data lines. When the SPI chip select signal sent by the first camera module is in a preset state combination, the first camera module and the second camera module simultaneously acquire gyroscope information from the gyroscope sensor.

[0268] In a possible design, both the first camera module and the second camera module are connected to the gyroscope sensor using data lines. When the SPI chip select signal sent by the first camera module enables the second camera module and the gyroscope sensor, the first camera module and the second camera module simultaneously obtain gyroscope information from the gyroscope sensor.

[0269] In a possible design, a second camera module and gyroscope sensor would simultaneously receive data from the first camera module.

[0270] The above description is merely a specific implementation of this application, but is not intended to limit the scope of protection of this application. Any modifications or replacements that can be easily understood by those skilled in the art within the technical scope disclosed in this application shall be included in the scope of protection of this application. Therefore, the scope of protection of this application shall be subject to the scope of protection of the claims.

Claims

1. 1. A data transmission system including a master SPI device, a first slave SPI device, and a second slave SPI device, The master SPI device configured to output a first chip select signal to the first slave SPI device and to the second slave SPI device and to output a second chip select signal to the first slave SPI device, a combination of the first chip select signal and the second chip select signal being used to enable the first slave SPI device and the first chip select signal being used to enable the second slave SPI device, the master SPI device, the first slave SPI device and the second slave SPI device being further connected using data lines; The master SPI device the master SPI device is further configured to control the second slave SPI device to transmit data using the data lines when the master SPI device drives the first chip select signal to an active state and the second chip select signal to an inactive state, and to receive the data transmitted by the second slave SPI device using the data lines; the second slave SPI device the master SPI device is configured to transmit the data using the data lines under control of the master SPI device when the master SPI device drives the first chip select signal to the valid state and the second chip select signal to the invalid state; the first slave SPI device 1. A data transmission system comprising: a data transmission unit configured to receive, using the data lines, the data transmitted by the second slave SPI device when the master SPI device drives the first chip select signal to the valid state and drives the second chip select signal to the invalid state.

2. a transmit port of the first slave SPI device is connected to a receive port of the master SPI device using a first data line, and a receive port of the first slave SPI device is connected to a transmit port of the master SPI device using a second data line, the data lines including the first data line and the second data line, the transmit port of the first slave SPI device and the transmit port of the master SPI device are configured to transmit data, and the receive port of the first slave SPI device and the receive port of the master SPI device are configured to receive data; the first slave SPI device 2. The data transmission system of claim 1, further configured to switch the transmit port of the first slave SPI device to the receive port and switch the receive port of the first slave SPI device to the transmit port when the master SPI device drives the first chip select signal to the valid state and the second chip select signal to the invalid state.

3. the first slave SPI device 2. The data transmission system of claim 1, further configured to set a data port of the first slave SPI device to a bidirectional data port, the bidirectional data port supporting transmission and reception of data.

4. The master SPI device the master SPI device is configured to transmit a first indicator over the data lines when the master SPI device drives the first chip select signal to the valid state and the second chip select signal to the invalid state, the first indicator being used to control transmission of data; the first slave SPI device 4. The data transmission system of claim 1, further configured to skip transmitting data in response to the first indication when the master SPI device drives the first chip select signal to the valid state and the second chip select signal to the invalid state.

5. The master SPI device the master SPI device is further configured to transmit a second indicator and data using the data lines when the master SPI device drives the first chip select signal to the invalid state and the second chip select signal to the valid state, the second indicator being used to control reception of data; the first slave SPI device 5. The data transmission system of claim 1, further configured to receive the second indication using the data lines when the master SPI device drives the first chip select signal to the invalid state and the second chip select signal to the valid state, and to receive the data using the data lines in response to the second indication.

6. The master SPI device the master SPI device is further configured to transmit the first indication over the data lines and receive data from the first slave SPI device over the data lines when the master SPI device drives the first chip select signal to the invalid state and the second chip select signal to the valid state, the first indication being used to control the transmission of data; the first slave SPI device 5. The data transmission system of claim 4, wherein the master SPI device is further configured to receive the first indication over the data lines and to transmit the data over the data lines in response to the first indication when the master SPI device drives the first chip select signal to the invalid state and the second chip select signal to the valid state.

7. the first slave SPI device 7. The data transmission system of claim 1, further configured to skip transmitting data over the data lines and skip receiving data over the data lines when the master SPI device drives the first chip select signal to the invalid state and drives the second chip select signal to the invalid state.

8. 2. The data transmission system of claim 1, wherein the master SPI device is a first camera, the first slave SPI device is a second camera, and the second slave SPI device is a sensor.

9. 9. The data transmission system of claim 8, wherein the sensor is a gyroscope sensor.

10. A chip including an SPI control logic circuit, an SPI controller, and an SPI data port, the SPI control logic is configured to receive a first chip select signal and a second chip select signal from a master SPI device, a combination of the first chip select signal and the second chip select signal being used to enable the chip; the SPI data port is connected to the master SPI device and to a second slave SPI device using data lines; The SPI control logic circuit includes: a chip configured to control the SPI controller to receive, via the SPI data port, data transmitted by the second slave SPI device on the data lines when the master SPI device drives the first chip select signal to an active state and the second chip select signal to an inactive state.

11. The SPI data port may include a transmit port and a receive port, the transmit port being connected to a receive port of the master SPI device using the data lines, the receive port being connected to a transmit port of the master SPI device using the data lines, the transmit port being configured for the chip to transmit data on the data lines, and the receive port being configured for the chip to receive data transmitted on the data lines; The SPI control logic circuit includes:

11. The chip of claim 10, further configured to configure the transmit port to receive data transmitted on the data lines when the master SPI device drives the first chip select signal to the valid state and the second chip select signal to the invalid state.

12. The chip further includes an SPI data receive / transmit switching circuit, the SPI controller includes a transmit module and a receive module, the transmit module is configured to transmit data, and the receive module is configured to receive data; The SPI control logic circuit includes:

12. The chip of claim 11, further configured to control the SPI data receive / transmit switch circuit to connect the transmit port to the receive module when the master SPI device drives a first chip select signal to an active state and a second chip select signal to an inactive state.

13. The SPI control logic circuit includes:

11. The chip of claim 10, further configured to configure the SPI data port as a bi-directional data port, the bi-directional data port supporting both transmission and reception of data.

14. The SPI control logic circuit includes:

14. The chip of claim 10, further configured to control the SPI controller to not transmit data in response to a first indication transmitted over the data lines when the master SPI device drives the first chip select signal to the valid state and the second chip select signal to the invalid state, the first indication being used to control the transmission of data.

15. The SPI control logic circuit includes: the master SPI device is further configured to control the SPI controller to receive, via an SPI data port, data transmitted on the data lines when the master SPI device drives the first chip select signal to the invalid state and the second chip select signal to the valid state; The SPI controller includes:

15. The chip of claim 10, further configured to receive a second indication transmitted on the data lines when the master SPI device drives the first chip select signal to the invalid state and the second chip select signal to the valid state, and to receive data transmitted on the data lines via the SPI data port in response to the second indication, the second indication being used to control reception of data.

16. The SPI control logic circuit includes: the master SPI device is further configured to control the SPI controller to receive, via the SPI data port, data transmitted on the data lines when the master SPI device drives the first chip select signal to the invalid state and the second chip select signal to the valid state; The SPI controller includes:

15. The chip of claim 14, further configured to receive the first indication transmitted on the data lines when the master SPI device drives the first chip select signal to the invalid state and the second chip select signal to the valid state, and to transmit the data on the data lines via the SPI data port in response to the first indication, the first indication being used to control the transmission of data.

17. The SPI control logic circuit includes:

16. The chip of claim 10, wherein the master SPI device controls the SPI controller not to transmit data over the data lines and controls the SPI controller not to receive data over the data lines when the master SPI device drives the first chip select signal to the invalid state and drives the second chip select signal to the invalid state.

18. A camera system including a first camera, a second camera, and a first sensor, wherein the first camera, the second camera, and the first sensor communicate with each other using an SPI protocol, the first camera being a master SPI device, and the second camera and the first sensor being slave SPI devices, and when the first camera and the second camera operate simultaneously, the first camera acquires first sensor data using the SPI protocol, and the second camera acquires first sensor data simultaneously using the SPI protocol; The first camera includes: outputting a first chip select signal to the second camera and the first sensor, and outputting a second chip select signal to the second camera and the first sensor, where a state combination of the first chip select signal and the second chip select signal is used to control whether to enable the second camera and is used to control whether to enable the first sensor, and the first camera, the second camera, and the first sensor are further connected using data lines; controlling the first sensor to transmit data using the data lines when the first chip select signal is in an active state and the second chip select signal is in an inactive state, and receiving the data transmitted by the first sensor using the data lines; The first sensor includes: configured to transmit data under control of the first camera using the data lines when the first chip select signal is in the valid state and the second chip select signal is in the invalid state; The second camera is a camera system configured to receive the data transmitted by the first sensor using the data line when the first chip select signal is in the valid state and the second chip select signal is in the invalid state.

19. A camera system including a first camera, a second camera, and a first sensor, wherein the first camera, the second camera, and the first sensor communicate with each other using an SPI protocol, the first camera being a master SPI device, and the second camera and the first sensor being slave SPI devices, wherein when the first camera and the second camera operate simultaneously, the first camera acquires first sensor data using the SPI protocol, and the second camera simultaneously acquires first sensor data using the SPI protocol; The first camera includes: outputting a first chip select signal to the second camera and the first sensor, and outputting a second chip select signal to the second camera and the first sensor, where a state combination of the first chip select signal and the second chip select signal is used to control whether to enable the second camera and is used to control whether to enable the first sensor, and the first camera, the second camera, and the first sensor are further connected using data lines; controlling the first sensor to transmit data using the data lines when the first chip select signal and the second chip select signal are in a preset state combination; and receiving data transmitted by the first sensor using the data lines; The first sensor includes: configured to transmit data under control of the first camera using the data line when the first chip select signal and the second chip select signal are in the state combination; The second camera is 20. The camera system of claim 18, configured to receive the data transmitted by the first sensor to the first camera using the data line when the first chip select signal and the second chip select signal are in the state combination.

20. The first camera includes: further configured to transmit data to the second camera using the data line; The first sensor includes: further configured to receive the data transmitted by the first camera using the data line; The second camera is 20. A camera system according to claim 18 or 19, further configured to receive the data transmitted by the first camera to the first sensor using the data line.

21. a transmit port of the second camera is connected to a receive port of the first camera using a first data line, and a receive port of the second camera is connected to a transmit port of the first camera using a second data line, the data lines include the first data line and the second data line, the transmit port of the second camera and the transmit port of the first camera are configured to transmit data, and the receive port of the second camera and the receive port of the first camera are configured to receive data; The second camera is 20. The camera system of claim 19, further configured to switch the transmit port of the second camera to the receive port and switch the receive port of the second camera to the transmit port when the first chip select signal is in an enabled state and the second chip select signal is in an disabled state or when the first chip select signal and the second chip select signal are in the preset state combination.

22. The second camera is 22. A camera system according to any one of claims 18 to 21, further configured to set a data port of the second camera to a bidirectional data port, the bidirectional data port supporting reception and transmission of data.

23. Specifically, the first camera includes: configured to transmit a first indication using the data lines when the first chip select signal is in the valid state and the second chip select signal is in the invalid state or when the first chip select signal and the second chip select signal are in the preset state combination, the first indication being used to control transmission of data; The second camera is 22. The camera system of claim 21, further configured to skip transmitting data in response to the first indication when the first chip select signal is in the valid state and the second chip select signal is in the invalid state, or when the first chip select signal and the second chip select signal are in the preset state combination.

24. The first camera includes: the first chip select signal is in the invalid state and the second chip select signal is in the valid state, or the first chip select signal and the second chip select signal are in the preset state combination; and the second indicator is used to control reception of the data; The second camera is 22. The camera system of claim 21, further configured to receive the second indication using the data lines when the first chip select signal is in the invalid state and the second chip select signal is in the valid state or when the first chip select signal and the second chip select signal are in the preset state combination, and to receive the data using the data lines in response to the second indication.

25. The first camera includes: the first chip select signal is in the invalid state and the second chip select signal is in the valid state or the first chip select signal and the second chip select signal are in the preset state combination, the first indicator is used to control the transmission of data; and The second camera is 25. The camera system of claim 21 or 24, further configured to receive the first indication using the data lines and transmit data using the data lines in response to the first indication when the first chip select signal is in the invalid state and the second chip select signal is in the valid state or when the first chip select signal and the second chip select signal are in the preset state combination.

26. The second camera includes:

26. The camera system of claim 21, 24 or 25, further configured to skip transmitting data over the data lines and skip receiving data over the data lines when the first chip select signal is in the invalid state and the second chip select signal is in the invalid state or when the first chip select signal and the second chip select signal are in the preset state combination.

27. The camera system of any one of claims 18 to 26, wherein the first sensor includes a gyroscope sensor.

Citation Information

Patent Citations

  • Electronic control unit

    JP2001216284A

  • Communication system, real time controller and information processing system

    JP2005141412A

  • Lens system for stereoscopic camera

    JP2007033624A

  • Semiconductor device, communication system, camera shake correction controller, imaging apparatus, and electronic apparatus

    JP2014153822A

  • Direct Slave-to-Slave Data Transfer on a Master-Slave Bus

    US20100199007A1