Pin detection method and device for vehicle-mounted universal interface

By introducing multiple pins into the vehicle-mounted universal interface and using polling detection methods, the communication protocol used by the slave device is automatically identified, which solves the problem that the host device needs to agree on a communication protocol in advance, and improves the adaptability and flexibility of the vehicle.

CN119854183AActive Publication Date: 2025-04-18ZHEJIANG GEELY HLDG GRP CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411754108.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-02
Publication Date
2025-04-18
Estimated Expiration
2044-12-02

AI Technical Summary

Technical Problem

In the prior art, the host device needs to pre-arrange the communication protocol between the slave device, resulting in the host device need to reserve multiple interfaces to support different protocols, poor flexibility and waste interface space.

Method used

By introducing multiple pins into the on-board universal interface, each pin can be used to transmit data signals of multiple communication protocols, and the communication protocol used by the slave device is automatically identified using the polling detection method.

Benefits of technology

It realizes that the vehicle can support multiple communication protocols without pre-arranged interface protocols, improving the vehicle's adaptability and flexibility in wired communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854183A_ABST
    Figure CN119854183A_ABST
Patent Text Reader

Abstract

The invention provides a pin detection method and device for a vehicle-mounted universal interface, the universal interface comprises a plurality of pins, each pin can be used for transmitting data signals of various communication protocols, the method comprises the following steps: determining n target pins physically connected to slave equipment from the plurality of pins, n being a positive integer; under the condition that n is greater than or equal to 2, polling and detecting each target pin to determine the current target protocol to which the target pin belongs according to the target protocol of which the required pin is not greater than n in the plurality of communication protocols; wherein any target pin is detected to determine the target protocol to which the target pin belongs currently, and the method comprises the following steps of: respectively generating a target detection signal following each target protocol, and at least sending the target detection signal to the corresponding slave equipment through any target pin; and under the condition of receiving a target detection response returned for a target detection signal following any target protocol, determining that any target pin belongs to any target protocol currently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data transmission, and in particular to a pin detection method and device for a vehicle-mounted universal interface. Background Art

[0002] In the wired access communication mode, if a communication connection is to be successfully established between a host device and a slave device, the communication protocol used between the two must be agreed upon in advance during the development phase.

[0003] However, there are many different wired communication protocols in the related art, and the manufacturers of slave devices may use any of these communication protocols when producing slave devices. In this case, if the host device only has one interface that supports a fixed communication protocol, the types of slave devices that can be connected and the control data will be restricted; and if the host device wants to support various slave devices using different communication protocols, it needs to reserve multiple different interfaces corresponding to different communication protocols, and it cannot be dynamically modified later, which has poor flexibility and wastes the interface space on the host device. Summary of the invention

[0004] In view of this, the present application provides a pin detection method and device for a vehicle-mounted universal interface to solve the defects existing in the related art. The technical solution of the present application is as follows:

[0005] According to an embodiment of the first aspect of the present application, a pin detection method for a vehicle-mounted universal interface is provided, wherein the vehicle-mounted universal interface includes a plurality of pins, each pin being used to transmit data signals of a plurality of communication protocols, and the method includes:

[0006] Determine n target pins physically connected to the slave device from the plurality of pins, where n is a positive integer;

[0007] In the case of n≥2, for the target protocols requiring no more than n pins among the plurality of communication protocols, each target pin is polled and detected to determine the target protocol to which it currently belongs;

[0008] Wherein, detecting any target pin to determine the target protocol to which it currently belongs includes:

[0009] Generate a target detection signal that complies with each target protocol respectively, and send the target detection signal to the corresponding slave device through at least any one of the target pins;

[0010] In the case of receiving a target detection response returned in response to a target detection signal complying with any target protocol, it is determined that the any target pin currently belongs to the any target protocol.

[0011] According to an embodiment of the second aspect of the present application, a pin detection device for a vehicle-mounted universal interface is provided, wherein the vehicle-mounted universal interface includes a plurality of pins, each pin being used to transmit data signals of a plurality of communication protocols, and the device includes:

[0012] a determining unit, configured to determine n target pins physically connected to the slave device from the plurality of pins, where n is a positive integer;

[0013] A polling unit, for, when n≥2, for a target protocol whose required pins are not greater than n among the plurality of communication protocols, polling and detecting each target pin to determine the target protocol to which it currently belongs;

[0014] Wherein, detecting any target pin to determine the target protocol to which it currently belongs includes:

[0015] Generate a target detection signal that complies with each target protocol respectively, and send the target detection signal to the corresponding slave device through at least any one of the target pins;

[0016] In the case of receiving a target detection response returned in response to a target detection signal complying with any target protocol, it is determined that the any target pin currently belongs to the any target protocol.

[0017] According to an embodiment of the third aspect of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the computer program.

[0018] According to an embodiment of the fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0019] According to an embodiment of the fifth aspect of the present application, a computer program product is proposed, including a computer program / instruction, and when the computer program / instruction is executed by a processor, the method described in the first aspect is implemented.

[0020] In the technical solution provided by the present application, a universal interface can be equipped on the vehicle, and the slave device can establish a physical connection with the vehicle through the universal interface. The universal interface includes a plurality of pins, each of which can be used to transmit data signals of multiple communication protocols. On this basis, each target pin that has established a physical connection with the slave device can be determined first, and when the number of target pins is greater than two, the target protocol whose required number of pins is not greater than the number of target pins is determined, and each target pin is polled for the determined target protocol. During the specific detection, a target detection signal can be generated according to each target protocol, and the target detection signal can be sent to the corresponding slave device at least through the target pin; since the slave device will return a corresponding response signal when receiving the detection signal based on the communication protocol supported by itself, when the vehicle receives the target detection response for any target protocol returned by the slave device, it can be determined that the target pin belongs to any target protocol.

[0021] It can be seen that the present application scheme can automatically identify the communication protocol used by the slave device when the slave device is inserted into the universal interface of the vehicle, so that the slave device can successfully establish a wired communication connection with the vehicle, and the vehicle does not need to agree on an interface protocol with the slave in advance, nor does it need to reserve multiple different interfaces, so as to support multiple different communication protocols; at the same time, in the case of modification or addition and deletion of the target protocol, only an update at the software level is required to generate a target detection signal of the changed communication protocol, thereby achieving successful detection of the changed communication protocol, thereby improving the adaptability and flexibility of the vehicle in wired communication.

[0022] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory and do not limit the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0024] Figure 1 is a schematic diagram of an application scenario shown in an exemplary embodiment of the present application;

[0025] Figure 2 is a flow chart of a pin detection method for a vehicle-mounted universal interface shown in an exemplary embodiment of the present application;

[0026] Figure 3is a schematic diagram of a connection between a vehicle-mounted universal interface and multiple slave devices shown in an exemplary embodiment of the present application;

[0027] Figure 4 It is an overall flow chart showing an exemplary embodiment of the present application;

[0028] Figure 5 is a schematic diagram of a pin detection device for a vehicle-mounted universal interface shown in an exemplary embodiment of the present application;

[0029] Figure 6 It is a schematic diagram of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0030] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of the present application. Instead, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of the present application as detailed in the appended claims.

[0031] It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this application. In some other embodiments, the steps included in the method may be more or less than those described in this application. In addition, a single step described in this application may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this application may also be combined into a single step for description in other embodiments.

[0032] Wired access refers to a communication method connected by physical cables or wires. It is usually more stable than wireless connections and is suitable for scenarios that require high reliability and high-speed transmission. The devices connected at both ends of the physical cable or wire are the host device and the slave device respectively. Among them, the host device is a device that controls and manages the entire communication process during the communication process. It is usually responsible for initiating communication, sending commands and receiving responses. It can include personal computers, vehicle computers, and servers, etc.; the slave device is a device that responds to the commands of the host device and performs corresponding operations during the communication process. It usually only transmits data when receiving a request from the host device. It can include sensors, vehicle-mounted equipment (such as vehicle air conditioners, vehicle refrigerators, vehicle fragrances, vehicle drone nests, etc.) and display devices, etc.

[0033] In the wired access communication mode, if the host device and the slave device want to successfully establish a communication connection, the communication protocol used between the two must be agreed upon in advance during the development stage, including but not limited to IIC (Inter-Integrated Circuit, or I 2 C), UART (Universal Asynchronous Receiver / Transmitter) SPI (Serial Peripheral Interface).

[0034] It can be seen that there are many different wired communication protocols in the relevant technology, and the manufacturer of the slave device may adopt any of the communication protocols when producing the slave device. In this case, if the host device only has an interface that supports a fixed communication protocol, the category and control data of the connectable slave device will be restricted. If the host device only has an interface for the IIC protocol, then the slave device using the SPI protocol cannot successfully establish a communication connection with the host device. If the host device wants to support various slave devices using different communication protocols, it is necessary to reserve multiple different interfaces corresponding to different communication protocols, such as equipping an interface for the IIC protocol and an interface for the SPI protocol at the same time. However, when this method is used, the equipped interface cannot be modified later. For example, after the host leaves the factory, a slave device uses the latest public communication protocol, then the host device cannot successfully establish a communication connection with the slave device. At the same time, this method will also waste the interface space on the host device.

[0035] In order to solve the above problems, the present application proposes a pin detection solution for the vehicle-mounted universal interface, which performs polling detection on the target pins that establish a physical connection with the slave device to determine the target protocol to which each target pin belongs. The embodiments of the present application are described in detail below.

[0036] Figure 1 FIG. 1 is a schematic diagram of an application scenario shown in an exemplary embodiment of the present application. Figure 1 As shown, the scenario may include a vehicle 11 and slave devices 12 , 13 , and 14 .

[0037] The vehicle 11 may include vehicles driven by multiple energy sources and of multiple structural types, such as fuel vehicles, electric vehicles, hybrid vehicles, etc., or sedans, pickup trucks, SUVs, etc., and this application does not limit this. The slave devices 12-14 may include various electronic or mechanical devices installed inside or outside the vehicle to enhance the vehicle's functionality, comfort, safety, or entertainment. These devices may be pre-installed when the vehicle leaves the factory, or they may be purchased and installed separately by the user later, such as a car refrigerator, a car camera, a car drone nest, and the like.

[0038] In the case where the user subsequently purchases a slave device separately, the newly added slave device needs to establish a communication connection with the vehicle, so that on the basis of the vehicle supplying power to the slave device, the user can also control and adjust the operating parameters of the slave device through the vehicle computer. For example, suppose that the user of vehicle 11 purchases slave devices 12-14 separately, slave device 12 is a car refrigerator, slave device 13 is a car camera, and slave device 14 is a car drone nest. Among them, the car refrigerator only needs to be powered by the vehicle, so the communication protocol used by slave device 12 can be a common I / O protocol; the car camera needs to be functionally controlled by the vehicle and transmit the image it captures to the vehicle, so the communication protocol used by slave device 13 can be the SPI protocol; and the car drone nest may also need to perform two-way data interaction with the vehicle so that the user can control the function of the drone nest through the car computer, so the communication protocol used by slave device 14 can be the UART protocol. In the case where the vehicle needs to establish a communication connection with slave devices 12-14 at the same time, each slave device can be connected to the vehicle 11 through the vehicle universal interface at the same time. Here, the vehicle-mounted universal interface can be a universal interface of various forms in the relevant technology, such as USB Type-A, USB Type-C, etc., or it can be a universal interface designed by technicians according to needs that can match the interface size of multiple slave devices. The vehicle-mounted universal interface can be connected to the adapter cable to support multiple slave devices to establish a physical connection with the vehicle at the same time. For example, the vehicle 11 is equipped with a USB Type-A vehicle-mounted universal interface. At this time, a "one-to-three" adapter cable can be inserted to expand a single interface into three independent interfaces, thereby allowing slave devices 12-14 to be connected to the same universal interface at the same time. Specifically, the design of this adapter cable may include a USB Type-A female interface for connecting to the universal interface on the vehicle, and at the other end, the adapter cable is bifurcated into three independent male interfaces (such as three USB Type-A interfaces, or various types of interfaces such as UART, IIC, SPI, etc.), each of which can be connected to a slave device. Of course, technicians can also implement the vehicle-mounted universal interface configured on the vehicle in other ways, and this application does not limit the physical form of the vehicle-mounted universal interface.

[0039] It is understandable that, since the vehicle-mounted universal interface supports access to multiple slave devices using different communication protocols, when the vehicle-mounted universal interface establishes a physical connection with a certain slave device, it is necessary to determine the protocol used by the slave device before data can be successfully exchanged with the slave device based on the determined communication protocol. The method for determining the communication protocol will be described in detail below.

[0040] Figure 2 is a flow chart of a pin detection method for a vehicle-mounted universal interface shown in an exemplary embodiment of the present application, wherein the vehicle-mounted universal interface includes a plurality of pins, each of which can be used to transmit data signals of a plurality of communication protocols. Figure 2 , the method comprising:

[0041] Step 201 : determining n target pins physically connected to a slave device from the plurality of pins, where n is a positive integer.

[0042] In one embodiment, the vehicle-mounted universal interface includes a plurality of pins (also referred to as pins), each of which is not fixed for a particular communication protocol, but can be flexibly configured to support a variety of different communication protocols. For example, a pin can be configured as an SCL line of IIC for transmitting a clock signal in the IIC protocol, or can be configured as a Tx line of UART for transmitting a data signal in the UART protocol. That is, the same pin can transmit different types of signals of different protocols in different situations.

[0043] In one embodiment, the target pins may be pins in the vehicle-mounted universal interface that establish a physical connection with the slave device. After determining the communication protocol used by the slave device, data can be exchanged with the slave device through these target pins based on the communication protocol. Assume that the vehicle-mounted universal interface has 10 pins (such as pin 1 to pin 10), and at this time, there are two slave devices that establish physical connections with the universal interface, and pin 1, pin 2, and pin 3 are connected. In this case, n=3 and the n target pins are pin 1, pin 2, and pin 3, respectively.

[0044] Specifically, whether any pin is a target pin can be determined in the following way: when the voltage value of any pin indicates that it is connected to a pull-up resistor, the pin is determined to be a target pin physically connected to the slave device. In the present application, when any pin in the vehicle-mounted universal interface is not connected to a power supply or ground, it is in a floating state, and the level of the pin is not stable at this time. After any pin establishes a physical connection with the slave device, since the interface of the slave device is equipped with a pull-up resistor, it is possible to determine whether the pin is connected to a pull-up resistor by detecting the voltage value of any pin in the vehicle-mounted universal interface, and when it is determined that it is connected to a pull-up resistor, the pin is determined to be a target pin.

[0045] Step 202, when n≥2, for the target protocols whose required pins are not greater than n among the plurality of communication protocols, poll each target pin to determine the target protocol to which it currently belongs.

[0046] In one embodiment, the multiple communication protocols that can be transmitted by any pin include a common I / O protocol. Common I / O protocols usually only implement simple digital input and output functions, and only need one signal line to realize basic communication or control functions: when a slave device uses a common I / O protocol, after the slave device establishes a physical connection with a pin in the vehicle-mounted universal interface, the vehicle can read the level (high level or low level) of the target pin to determine the state of the external device, and can output a high level or a low level through the pin to control the state of the external device. Therefore, when only one pin in the vehicle-mounted universal interface establishes a physical connection with the slave device, that is, when the number of target pins is 1 (i.e., n=1), it can be directly determined that the target pin belongs to the common I / O protocol.

[0047] In one embodiment, when there are two or more pins in the vehicle-mounted universal interface that establish a physical connection with the slave device, that is, when the number of target pins is 2 or more (i.e., n≥2), a target protocol that meets the conditions can be determined from a plurality of communication protocols. It is understandable that when the number of target pins is n, that is, only n pins in the vehicle-mounted universal interface establish a physical connection with the slave device, then the number of pins used by the communication protocol to which any target pin belongs will definitely not be greater than n. For example, when the number of target pins is 3, since the SPI protocol requires 4 pins to work, the slave device that establishes a physical connection at this time will definitely not use the SPI protocol, and any of the three target pins cannot belong to the SPI protocol. Therefore, a communication protocol with a required number of pins not greater than n can be determined as a target protocol, and the number of target protocols can be one or more. After determining the target protocol, each target pin can be polled for these target protocols to determine the target protocol to which each pin belongs.

[0048] Specifically, detecting any target pin to determine the target protocol to which it currently belongs includes: generating a target detection signal that complies with each target protocol respectively, and sending the target detection signal to the corresponding slave device through at least any target pin; and upon receiving a target detection response returned for the target detection signal that complies with any target protocol, determining that any target pin currently belongs to any target protocol.

[0049] In the related art, each public communication protocol has a specific number of signal lines and signal characteristics. Any two communication protocols have certain differences in the number of signal lines or signal characteristics. For example, the SPI protocol uses four signal lines, the IIC protocol and the UART protocol use two signal lines, and the two signal lines of the IIC protocol are used to transmit clock signals and data signals respectively, and the two signal lines of the UART are used to send data signals and receive data signals respectively. Therefore, in this embodiment, the number of signal lines and signal characteristics used by any communication protocol are different from those of other communication protocols. Then, when multiple target protocols are determined, the target detection signal that follows the target protocol can be generated according to the number of signal lines and signal characteristics used by each target protocol, and multiple target detection signals can be obtained. For example, if the target protocol is the IIC protocol, since the IIC protocol uses two signal lines, which are used to transmit clock signals and data signals respectively, the target detection signal generated for the IIC protocol can include a clock signal and a data signal.

[0050] Afterwards, for any target pin, the generated target detection signal can be sent to the slave device through the target pin, or the target pin combination composed of the target pin and other target pins. For example, the IIC protocol requires the use of two signal lines, so it is necessary to send the target detection signal of the IIC protocol to the slave device through two target pins. At this time, the two target pins used constitute the target pin combination. And because the slave device will return a response signal to the sending end when it receives a data signal that complies with its own communication protocol. Therefore, after sending any target detection signal, if the vehicle receives a target detection response returned by the slave device, it can be considered that the target protocol corresponding to the target detection signal is the communication protocol used by the slave device, and it can be determined that the target pin currently belongs to the target protocol.

[0051] In one embodiment, if a target detection signal for any protocol is sent through any target pin or a target pin combination that communicates with other target pins, and a target detection response returned from the slave device is not received, the target pin can be replaced and the detection can be performed again in the same way until all target pins are traversed; if no target detection response is received, the target detection signal of other target protocols is used for traversal. The above traversal method involves a two-layer loop process, the inner loop is "each target pin" and the outer loop is "each target protocol". In another traversal method, the inner loop can also be set to "each target protocol" and the outer loop can be set to "each target pin": if a target detection signal for any protocol is sent through any target pin or a target pin combination that communicates with other target pins, and a target detection response returned from the slave device is not received, the target detection signal can be replaced and the replaced target detection signal can be sent again through the same target pin or target pin combination until all target detection signals of the target protocols are traversed; if no target detection response is received, other target pins or target pin combinations are used for traversal. This traversal method is more suitable for situations where the number of signal lines used by the two target protocols is the same. For example, the IIC protocol and the UART protocol both use two signal lines. After sending the target detection signal for the IIC protocol through target pin 1 and target pin 2, if no target detection response is received, the target detection signal for the UART protocol can be sent immediately through target pin 1 and target pin 2. If the target detection response is still not received, detection can be performed after replacing the target pin, such as sending target detection signals for the IIC protocol and for the UART protocol through target pin 1 and target pin 3, and so on. The specific traversal method can be set by the technician according to the actual situation and needs, and this application does not limit this.

[0052] In one embodiment, after determining the target protocols to which the target pins belong, communication data may be sent to the corresponding slave device based on the pins and the target protocols to which they belong, or communication data sent by the corresponding slave device may be received.

[0053] It can be seen from the above embodiments that the present application scheme can automatically identify the communication protocol used by the slave device by traversal detection when the slave device is inserted into the universal interface of the vehicle, so that the slave device can successfully establish a wired communication connection with the vehicle, and the vehicle does not need to agree on an interface protocol with the slave in advance, nor does it need to reserve multiple different interfaces, so as to support multiple different communication protocols; at the same time, in the case of modification or addition and deletion of the target protocol, only an update at the software level is required to generate a target detection signal of the changed communication protocol, thereby achieving successful detection of the changed communication protocol, thereby improving the adaptability and flexibility of the vehicle in wired communication.

[0054] In one embodiment, the multiple communication protocols that can be transmitted by any pin include the UART protocol. The UART protocol requires two signal lines, one signal line is used to send data (also called the Tx line), and the other signal line is used to receive data (also called the Rx line). When using the UART protocol, data can be sent to the slave device through the Tx line based on a preset baud rate, and response data returned by the slave device can be received through the Rx line.

[0055] Therefore, in one way, when the number of target pins is not less than two (i.e., n≥2), if detection is performed on any target pin, the any target pin can be used as the first target pin, and any other target pin that is different from the target pin can be used as the second target pin, so that the first target pin and the second target pin together constitute a target pin combination. In an embodiment of the present application, the first target pin and the second target pin are only used to distinguish two different target pins, and do not specifically refer to a specific target pin. The first target pin and the second target pin can be any target pin. For example, in the presence of target pin 1, target pin 2, and target pin 3, if target pin 1 is used as the first target pin, then target pin 2 and target pin 3 can both be used as the second target pin. This method will also be used in subsequent embodiments to distinguish the target pins, and the third target pin and the fourth target pin will be defined in the same way, which will not be repeated hereafter.

[0056] Afterwards, a data signal can be generated as a target detection signal, and the generated data signal can be sent through the first target pin based on the preset baud rate, and when the second target pin receives the target detection response returned by the slave device, it is determined that the current first target pin and the second target pin belong to the UART protocol. If the target detection response is not received through the second target pin after the generated data signal is sent through the first target pin based on the preset baud rate, it can be considered that the target pin combination composed of the first target pin and the second target pin does not belong to the UART protocol. At this time, the actual pin corresponding to the second target pin can be replaced (such as from target pin 2 to target pin 3) and then detected again, or as described in the above embodiment, the target detection signal corresponding to other target protocols can be used to detect the current target pin combination, which will not be repeated here.

[0057] In another method, multiple other target pins different from the first target pin can also be used as second target pins at the same time. After the generated data signal is sent through the first target pin, if a target detection response returned by the slave device is received through any second target pin, it can be directly determined that the first target pin and the second target pin that receives the target detection response belong to the UART protocol. Through the method of this embodiment, the communication protocol to which the target pin belongs can be determined more quickly, which significantly improves the efficiency of protocol detection.

[0058] In addition, whether a communication connection can be successfully established through the UART protocol is also closely related to the baud rate setting. Therefore, when using the target detection signal corresponding to the UART protocol for any target pin combination, it is also necessary to try using different baud rates. For example, when the first target pin and the second target pin constitute a target pin combination, based on a variety of different baud rates, the generated data signal is sent through the first target pin, and it is detected whether the second target pin receives a target detection response. When using any baud rate, if a target detection response is received through the second target pin, it can be considered that the target pin combination formed by the first target pin and the second target pin does not belong to the UART protocol.

[0059] In one embodiment, after determining that the slave device uses the UART protocol, it can be further determined whether the slave device is equipped with a Bluetooth module. Specifically, since the UART protocol requires two data lines, and two target pins (i.e., a combination of target pins) are used simultaneously to attempt detection during detection, when determining that any target pin belongs to the UART protocol, another target pin associated with the any target pin and belonging to the UART protocol can be determined at the same time. Afterwards, an HCI reset instruction (Host Controller Interface Reset instruction, also known as an HCI RST instruction) can be sent to the slave device through the pin of the two pins that access the Tx line, and detect whether the other pin that accesses the Rx line receives the HCI completion instruction (Host Controller Interface Complete instruction, also known as HCIOMPLETE instruction) returned by the slave device. In the case of receiving the HCI completion instruction, it can be determined that the slave device is equipped with a Bluetooth module. If, after issuing the HCI reset instruction, the received instruction is not an HCI completion instruction but an initialization instruction corresponding to other hardware modules, the hardware modules equipped by the slave device are determined according to the received initialization instruction, including but not limited to a Wi-Fi network card, a 433MHz RF module, an infrared (IR) module, a CAN bus controller, a LIN bus controller, an RS485 transceiver, etc.

[0060] In one embodiment, the multiple communication protocols that can be transmitted by any pin include the IIC protocol. The IIC protocol requires two signal lines, one signal line is used to transmit a clock signal (also called an SCL line), and the other signal line is used to transmit data (also called an SDA line). When using the IIC protocol, the signal synchronization can be performed through the SCL line, and data can be sent and received through the SDA line. It should be noted that when the number of target pins is different, the present application can use different methods to perform polling detection for the IIC protocol.

[0061] In one embodiment, when the number of target pins is not less than two and less than four (i.e., 2≤n<4), a clock signal and a data signal can be generated as a target detection signal, and the generated clock signal is sent through the first target pin, and the generated data signal is sent through the second target pin. In the case where a target detection response returned by the slave device is received through the second target pin, it can be determined that the current first target pin and the second target pin belong to the IIC protocol. If, after sending the generated clock signal through the first target pin and sending the generated data signal through the second target pin at the same time, no target detection response is received through the second target pin, it can be considered that the target pin combination formed by the first target pin and the second target pin does not belong to the IIC protocol. At this time, the actual pin corresponding to the second target pin can be replaced and then detected again, which will not be repeated here.

[0062] Similarly, when detecting the IIC protocol, multiple other target pins different from the first target pin can also be used as second target pins at the same time. While sending the generated clock signal through the first target pin, the generated data signal is sent through multiple second target pins. If a target detection response returned by the slave device is received through any second target pin, it can be directly determined that the first target pin and the second target pin that receives the target detection response belong to the IIC protocol.

[0063] It should be noted that the detection method for the IIC protocol recorded in the above embodiment can also be applied to the case where the number of target pins is not less than four, and this method can also accurately detect whether the target pin belongs to the IIC protocol. However, considering that when the number of target pins is not less than four, the communication protocol may also use the SPI protocol, the present application provides another more efficient detection method, which will be described in detail below.

[0064] In another way, when the number of target pins is not less than four (i.e., n≥4), if the multiple communication protocols that can be transmitted by any pin include both the IIC protocol and the SPI protocol, the detection process of the two can be improved to achieve simultaneous detection of the IIC protocol and the SPI protocol. The SPI protocol requires four signal lines, one signal line for transmitting the clock signal (also called the SCLK line), one signal line for sending data to the slave device (also called the MOSI line), one signal line for receiving data (also called the MISO line), and one signal line for transmitting the chip select signal (also called the SS line or the CS line). When using the SPI protocol, the signal synchronization can be performed through the SCLK line, and the data and chip select signals can be sent through the MOSI and SS / CS lines, and the data signal returned by the slave device can be received through the MISO line. It can be seen that the SPI protocol is similar to the IIC protocol in the use of some signal lines: both require a signal line for transmitting the clock signal and a signal line for sending the data signal. The difference between the two is that when the IIC protocol receives the target detection response, it also receives it through the signal line that sends the data signal, that is, the same signal line is used for sending the data signal and receiving the return signal; while the SPI protocol receives the target detection response through another signal line, that is, the sending data signal and receiving the return signal use two different signal lines.

[0065] Therefore, in the above case, a clock signal, a data signal and a chip select signal can be generated as a target detection signal, and a clock signal is sent to the slave device through the first target pin, a data signal is sent to the slave device through the second target pin, and a chip select signal is sent to the slave device through the third target pin. Afterwards, if the target detection response returned by the slave device is received through the second target pin, that is, the response signal is received through the signal line that sends the data signal, it can be determined that the first target pin and the second target pin belong to the IIC protocol; and if the target detection response returned by the slave device is received through the fourth target pin, that is, the response signal is received through another signal line (different from the signal line that sends the data signal), it can be determined that the first target pin, the second target pin, the third target pin and the fourth target pin belong to the SPI protocol.

[0066] It can be seen from the above embodiments that the present application combines and improves the detection processes of the IIC protocol and the SPI protocol based on the number of signal lines and signal characteristics used by the two protocols. When detecting a single IIC protocol, sending a detection signal once may only result in two results: belonging to the IIC protocol, or not belonging to the IIC protocol. After the improvement, sending a target detection signal once may result in three results: belonging to the IIC protocol, belonging to the SPI protocol, or neither belonging to the IIC protocol nor the SPI protocol. It can be seen that this improvement increases the possibility of detection results, reduces the need for repeated detection, can more efficiently determine the communication protocol to which the target pin belongs, and improves detection efficiency.

[0067] In one embodiment, after the polling detection is completed, if there are still remaining target pins whose target protocols have not been determined, the communication protocol to which each remaining target pin belongs can be determined as a common I / O protocol. Since the common I / O protocol only requires one signal line to successfully establish a communication connection, the remaining target pins do not affect each other and each belongs to a common I / O protocol. It should be noted here that the completion of the polling detection includes two situations: in one case, all target pin combinations have been tentatively detected based on the target detection signal of a certain target protocol; in another case, during the polling process for a certain target protocol, the target pin corresponding to the target protocol has been determined, resulting in the early termination of the polling for the target protocol. When the above two situations occur, it can be considered that the polling for the target protocol has been completed.

[0068] The following will be combined Figure 3 and Figure 4 , one implementation process of the present application is described through a specific example. Among them, Figure 3 is a schematic diagram showing a connection between a vehicle-mounted universal interface and multiple slave devices according to an exemplary embodiment of the present application. Figure 4 It is an overall flow chart showing an exemplary embodiment of the present application.

[0069] like Figure 3 As shown, the vehicle universal interface has a total of 5 pins (pin 1, pin 2, pin 3, pin 4 and target pin 5), and establishes physical connections with three slave devices at the same time (assuming that slave device 12 uses the IIC protocol, slave device 13 uses the UART protocol, and slave device 14 uses the ordinary I / O protocol).

[0070] First, step 401 is executed to detect whether the pin is connected to a pull-up resistor, and it is determined that there are 5 target pins at this time, that is, n = 5. Since all pins are target pins at this time, each pin will be referred to as a target pin below.

[0071] Execute step 402 to determine the target protocol according to the number of target pins. Since the number of pins required by the target protocol must not be greater than the number of target pins, if the multiple communication protocols include ordinary I / O protocol, IIC protocol, UART protocol and SPI protocol, then the above communication protocols can all be used as target communication protocols.

[0072] Execute step 403, and perform polling detection on the target pin through the improved detection process for the IIC protocol and the SPI protocol to determine whether the target pin belongs to the IIC protocol or the SPI protocol. This step may specifically include steps 4031 to 4036.

[0073] Wherein, step 4031 is to send a clock signal through the first target pin, send a data signal through the second target pin, and send a chip select signal through the third target pin. Figure 3 As shown, target pin 1 can be selected as the first target pin, target pin 2 can be selected as the second target pin, and target pin 3 can be selected as the third target pin. At this time, these three target pins together constitute a target pin combination.

[0074] Step 4032 determines whether a target detection response returned by the slave device in response to the current target detection signal is received.

[0075] If no target detection response is received, execute step 4033 to check whether all target pins have been polled in the above manner: if polling is not completed, return to step 4031 and replace the pin actually corresponding to the target pin combination (such as using target pin 4 as the third target pin, etc.); if polling is completed, you can enter the detection process for other target protocols, such as executing step 404.

[0076] When a target detection response is received, execute step 4034 to determine whether the pin that receives the target detection response is the pin for sending a data signal: if so, it means that the sending data signal and the receiving return signal use the same signal line, execute step 4035 to determine that the first target pin and the second target pin belong to the IIC protocol; if not, it means that the sending data signal and the receiving return signal use different signal lines, execute step 4036 to determine that the first target pin, the second target pin, the third target pin and the fourth target pin belong to the SPI protocol.

[0077] exist Figure 4 In the example, after target pin 1 is used as the first target pin to send a clock signal and target pin 2 is used as the second target pin to send a data signal, a target detection response can be received through the second target pin. At this time, it means that target pin 1 and target pin 2 belong to the IIC protocol, and target pin 1 is connected to the signal line corresponding to the clock signal, and target pin 2 is connected to the signal line corresponding to the data signal.

[0078] It can be understood that step 403 is a loop process, until all target pin combinations are tentatively detected through the process of step 4031 to step 4044, the detection process for other target protocols can be entered. In the case where the target protocol also includes the UART protocol, step 404 can be executed to determine whether the target pin belongs to the UART protocol. It should also be noted that in the actual implementation process, when detecting two different communication protocols, if the two do not affect each other, then the execution order can be set by the technician according to actual needs, such as the execution order of step 403 and step 404 in this process can be interchanged.

[0079] Step 404 may specifically include steps 4041 to 4044 .

[0080] Wherein, step 4041 is to send a data signal based on a preset baud rate through the first target pin. Step 4042 is to detect whether a target detection response returned by the slave device for the target detection signal is received through the second target pin. Figure 4 As shown, in the case of the remaining target pin 3, target pin 4 and target pin 5, target pin 3 can be selected as the first target pin, and target pin 4 can be selected as the second target pin.

[0081] If no target detection response is received, execute step 4043 to check whether all target pins have been polled in the above manner: if the polling is not completed, return to step 4041 and replace the pin actually corresponding to the target pin combination (such as using target pin 5 as the second target pin, etc.); if the polling is completed, you can enter the detection process for other target protocols.

[0082] When the target detection response is received, step 4044 is executed to determine whether the first target pin and the second target pin belong to the UART protocol.

[0083] exist Figure 4 In the example, after target pin 3 is used as the first target pin to send a data signal based on the preset baud rate, a target detection response can be received through target pin 4 which is used as the second target pin. At this time, it means that target pin 3 and target pin 4 belong to the UART protocol, and target pin 3 is connected to the Tx line and target pin 4 is connected to the Rx line.

[0084] After executing the above steps 401 to 404, the polling process for the IIC protocol, SPI protocol and UART protocol has been completed. Figure 4In the example, there is still a target pin 5 whose target protocol has not been determined. Since the number of target pins is only one at this time, step 405 can be executed to directly determine that the target pin 5 belongs to the common I / O protocol.

[0085] So far, it has been determined Figure 4 The communication protocols to which each target pin in the example belongs, namely, target pin 1 and target pin 2 belong to the IIC protocol, target pin 3 and target pin 4 belong to the UART protocol, and target pin 5 belongs to the common I / O protocol, match the communication protocols used by each slave device connected to the target pin.

[0086] Based on the pin detection method for the vehicle-mounted universal interface provided by the present application, the present application also provides a pin detection device for the vehicle-mounted universal interface, see Figure 5 ,include:

[0087] A determining unit 51 is used to determine n target pins physically connected to the slave device from the plurality of pins, where n is a positive integer;

[0088] A polling unit 52, configured to, when n≥2, for m target protocols whose required pins are not greater than n among the plurality of communication protocols, poll each target pin to determine the target protocol to which it currently belongs;

[0089] Wherein, detecting any target pin to determine the target protocol to which it currently belongs includes:

[0090] Generate a target detection signal that complies with each target protocol respectively, and send the target detection signal to the corresponding slave device through at least any one of the target pins;

[0091] In the case of receiving a target detection response returned in response to a target detection signal complying with any target protocol, it is determined that the any target pin currently belongs to the any target protocol.

[0092] Optionally, the multiple communication protocols include a common I / O protocol, and the device further includes:

[0093] The first determining unit 53 is used to determine, when n=1, that the target pin currently belongs to the common I / O protocol.

[0094] Optionally, the multiple communication protocols include a UART protocol, and when n≥2, the polling unit 52 is specifically used for:

[0095] generating a data signal as the target detection signal, and sending the data signal through the first target pin based on a preset baud rate;

[0096] In a case where the second target pin receives a target detection response returned in response to the target detection signal, it is determined that the first target pin and the second target pin belong to a UART protocol.

[0097] Optionally, the multiple communication protocols include the IIC protocol, and when 2≤n<4, the polling unit 52 is specifically used for:

[0098] Generate a clock signal and a data signal as the target detection signal, and send the clock signal to the slave device through a first target pin, and send the data signal to the slave device through a second target pin;

[0099] In a case where the second target pin receives a target detection response returned in response to the target detection signal, it is determined that the first target pin and the second target pin belong to the IIC protocol.

[0100] Optionally, the multiple communication protocols include IIC and SPI protocols. When n≥4, the polling unit 52 is specifically used for:

[0101] Generate a clock signal, a data signal and a chip select signal as the target detection signal, send the clock signal to the slave device through a first target pin, send the data signal to the slave device through a second target pin, and send the chip select signal to the slave device through a third target pin;

[0102] When the second target pin receives a target detection response returned in response to the target detection signal, determining that the first target pin and the second target pin belong to the IIC protocol;

[0103] When the fourth target pin receives a target detection response returned in response to the target detection signal, it is determined that the first target pin, the second target pin, the third target pin, and the fourth target pin belong to the SPI protocol.

[0104] Optionally, the device further comprises:

[0105] The second determining unit 54 is configured to determine, when the polling detection is completed and there are remaining target pins whose target protocols have not been determined, whether the remaining target pins belong to the common I / O protocol.

[0106] Optionally, the device further includes a Bluetooth determination unit 55, configured to:

[0107] When it is determined that any target pin belongs to the UART protocol, sending an HCI reset instruction to the slave device through the any target pin or a target pin associated with the any target pin;

[0108] And when the HCI completion instruction returned by the slave device is received, it is determined that the slave device is equipped with a Bluetooth module for communicating based on the UART protocol.

[0109] Optionally, each pin in the universal interface is in a floating input state, and the determining unit 51 is specifically configured to:

[0110] In the case where the voltage value of any pin indicates that it is connected to a pull-up resistor, the pin is determined to be a target pin physically connected to the slave device.

[0111] Optionally, the device further comprises a communication unit 56, configured to:

[0112] Based on the target protocols to which each target pin belongs, communication data is sent and / or received with the corresponding slave device.

[0113] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0114] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0115] Correspondingly, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the pin detection method for the vehicle-mounted universal interface as described in any of the above embodiments is implemented.

[0116] See also Figure 6 At the hardware level, the electronic device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610, and may also include hardware required for other services. The processor 602 reads the corresponding computer program from the non-volatile memory 610 into the memory 608 and then runs it, forming a device corresponding to the above method at the logical level. Of course, in addition to the software implementation, this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0117] Correspondingly, the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the pin detection method for the vehicle-mounted universal interface as described in any of the above embodiments is implemented.

[0118] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.

[0119] In a typical configuration, a computer includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0120] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0121] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.

[0122] Based on the same concept as the above method, this specification also provides a computer program product, including a computer program / instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.

Claims

1. A pin detection method for a vehicle-mounted universal interface, characterized in that: The vehicle-mounted universal interface includes a plurality of pins, each of which can be used to transmit data signals of a plurality of communication protocols. The method includes: Determine n target pins physically connected to the slave device from the plurality of pins, where n is a positive integer; In the case of n≥2, for the target protocols requiring no more than n pins among the plurality of communication protocols, each target pin is polled and detected to determine the target protocol to which it currently belongs; Wherein, detecting any target pin to determine the target protocol to which it currently belongs includes: Generate a target detection signal that complies with each target protocol respectively, and send the target detection signal to the corresponding slave device through at least any one of the target pins; In the case of receiving a target detection response returned in response to a target detection signal complying with any target protocol, it is determined that the any target pin currently belongs to the any target protocol.

2. The method according to claim 1, characterized in that The plurality of communication protocols include a common I / O protocol, and the method further includes: In the case of n=1, it is determined that the target pin currently belongs to the common I / O protocol.

3. The method according to claim 1, characterized in that The plurality of communication protocols include a UART protocol. When n≥2, detecting any target pin to determine the target protocol to which it currently belongs includes: generating a data signal as the target detection signal, and sending the data signal through the first target pin based on a preset baud rate; In a case where the second target pin receives a target detection response returned in response to the target detection signal, it is determined that the first target pin and the second target pin belong to a UART protocol.

4. The method according to claim 1, characterized in that: The plurality of communication protocols include the IIC protocol. When 2≤n<4, the detecting any target pin to determine the target protocol to which it currently belongs includes: Generate a clock signal and a data signal as the target detection signal, and send the clock signal to the slave device through a first target pin, and send the data signal to the slave device through a second target pin; In a case where the second target pin receives a target detection response returned in response to the target detection signal, it is determined that the first target pin and the second target pin belong to the IIC protocol.

5. The method according to claim 1, characterized in that The multiple communication protocols include IIC and SPI protocols. When n≥4, detecting any target pin to determine the target protocol it currently belongs to includes: Generate a clock signal, a data signal and a chip select signal as the target detection signal, send the clock signal to the slave device through a first target pin, send the data signal to the slave device through a second target pin, and send the chip select signal to the slave device through a third target pin; When the second target pin receives a target detection response returned in response to the target detection signal, determining that the first target pin and the second target pin belong to the IIC protocol; When the fourth target pin receives a target detection response returned in response to the target detection signal, it is determined that the first target pin, the second target pin, the third target pin, and the fourth target pin belong to the SPI protocol.

6. The method according to claim 1, characterized in that Also includes: If the polling detection is completed and there are remaining target pins whose target protocols have not been determined, it is determined that each of the remaining target pins belongs to a common I / O protocol.

7. The method according to claim 1, characterized in that Also includes: In the case of determining that any target pin belongs to the UART protocol, sending an HCI reset instruction to the slave device through the any target pin and a target pin associated with the any target pin; When the HCI completion instruction returned by the slave device is received, it is determined that the slave device is equipped with a Bluetooth module.

8. The method according to claim 1, characterized in that: Each pin in the universal interface is in a floating input state, and determining n target pins physically connected to the slave device from the plurality of pins includes: In the case where the voltage value of any pin indicates that it is connected to a pull-up resistor, the pin is determined to be a target pin physically connected to the slave device.

9. A pin detection device for a vehicle-mounted universal interface, characterized in that: The vehicle-mounted universal interface includes a plurality of pins, each of which can be used to transmit data signals of a plurality of communication protocols. The device includes: a determining unit, configured to determine n target pins physically connected to the slave device from the plurality of pins, where n is a positive integer; A polling unit, for, when n≥2, for a target protocol whose required pins are not greater than n among the plurality of communication protocols, polling and detecting each target pin to determine the target protocol to which it currently belongs; Wherein, detecting any target pin to determine the target protocol to which it currently belongs includes: Generate a target detection signal that complies with each target protocol respectively, and send the target detection signal to the corresponding slave device through at least any one of the target pins; In the case of receiving a target detection response returned in response to a target detection signal complying with any target protocol, it is determined that the any target pin currently belongs to the any target protocol.

10. An electronic device, characterized in that: include: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method according to any one of claims 1 to 8 by executing the executable instructions.

11. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

12. A computer program product, characterized in that The method comprises a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • CAN communication protocol type identification method, communication device and storage medium

    CN117560308A

  • Protocol adaptive diagnosis method and device supporting vehicle OBD interface

    CN117590835A

  • OBD interface bus type detection method and device

    WO2019128929A1