Pin detection method and device for vehicle-mounted universal interface

By using a pin detection method for the vehicle-mounted universal interface, the problem of the host device's inability to flexibly support multiple slave devices is solved, enabling automatic identification and flexible adaptation to multiple communication protocols and reducing interface waste.

CN119854183BActive Publication Date: 2025-10-17ZHEJIANG GEELY HLDG GRP CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, the host device needs to pre-determine the communication protocol, which makes it impossible to flexibly support multiple slave devices and results in a serious waste of interface space.

Method used

By using the pin detection method of the vehicle general interface, the target pin that is physically connected to the slave device is determined, and polling detection is performed for multiple communication protocols to generate target detection signals to identify the protocol of the slave device.

Benefits of technology

It enables support for multiple communication protocols without pre-determining the interface protocol, improving the vehicle's adaptability and flexibility in wired communication and reducing interface waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854183B_ABST
    Figure CN119854183B_ABST
Patent Text Reader

Abstract

The application provides a pin detection method and device for a vehicle-mounted general interface. The general 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 determining n target pins physically connected to slave devices from the plurality of pins, n being a positive integer; in the case of n≥2, for a target protocol in which the required pins are not more 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 generating a target detection signal complying with each target protocol respectively, and sending the target detection signal to the corresponding slave device through at least the any target pin; in the case of receiving a target detection response returned for the target detection signal complying with any target protocol, it is determined that the any target pin currently belongs to the any target protocol.
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

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

[0003] However, there are many different wired communication protocols in the related art, and the manufacturer of the slave device may use any one 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 types of connectable slave devices and control data will be restricted. 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 cannot be dynamically modified later, which is not flexible and wastes interface space on the host device. SUMMARY

[0004] Therefore, the present application provides a pin detection method and device for a vehicle-mounted universal interface to solve the defects in the related art. The technical solutions of the present application are 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, the vehicle-mounted universal interface including a plurality of pins, each pin being used to transmit data signals of a plurality of communication protocols, and the method comprising:

[0006] determining n target pins physically connected to slave devices from the plurality of pins, n being a positive integer;

[0007] in the case of n≥2, for a target protocol in the plurality of communication protocols, the required pins of which are not more than n, polling each target pin 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 comprises:

[0009] generating a target detection signal following each target protocol, respectively, and sending the target detection signal to the corresponding slave device through at least the any target pin;

[0010] in the case of receiving a target detection response returned for the target detection signal following any target protocol, determining 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 general interface is provided, the vehicle general interface comprising a plurality of pins, each pin being capable of transmitting data signals of a plurality of communication protocols, the device comprising:

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

[0013] a polling unit configured to, in a case that n>2, for a target protocol of the plurality of communication protocols, polling each target pin to determine a target protocol to which the target pin currently belongs, in a case that a number of pins required by the target protocol is not greater than n;

[0014] wherein polling any target pin to determine a target protocol to which the target pin currently belongs comprises:

[0015] generating a target detection signal complying with each target protocol respectively, and sending the target detection signal to a corresponding slave device through at least the any target pin;

[0016] in a case that a target detection response returned for the target detection signal complying with any target protocol is received, determining 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 executes the computer program to implement the method of the first aspect.

[0018] According to an embodiment of the fourth aspect of the present application, a computer readable storage medium is provided, having a computer program stored thereon, wherein the computer program is executable by a processor to implement the steps of the method of the first aspect.

[0019] According to an embodiment of the fifth aspect of the present application, a computer program product is provided, comprising computer programs / instructions executable by a processor to implement the method of the first aspect.

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

[0021] It can be seen that, in the case that the slave device is inserted into the general interface of the vehicle, the communication protocol used by the slave device can be automatically identified by the application solution, so that the slave device can successfully establish a wired communication connection with the vehicle, and the vehicle does not need to pre-arrange an interface protocol with the slave device, nor need to reserve a plurality of different interfaces, so as to support a plurality of different communication protocols. Meanwhile, in the case that the target protocol is modified or added or deleted, only the software layer is updated, so that the target detection signal of the changed communication protocol can be generated, the changed communication protocol can be successfully detected, and the adaptability and flexibility of the vehicle in wired communication are improved.

[0022] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the embodiments of the application. BRIEF DESCRIPTION OF DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments described in the embodiments of the application, and other drawings can also be obtained by those skilled in the art based on these drawings.

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

[0025] Figure 2 is a pin detection method flow chart for a vehicle general interface according to an exemplary embodiment of the application;

[0026] Figure 3Fig. 1 is a schematic diagram of a connection between a vehicle-mounted universal interface and a plurality of slave devices according to an example embodiment of the present application;

[0027] Figure 4 Fig. 2 is a schematic diagram of an overall flow according to an example embodiment of the present application;

[0028] Figure 5 Fig. 3 is a schematic diagram of a pin detection device for a vehicle-mounted universal interface according to an example embodiment of the present application;

[0029] Figure 6 Fig. 4 is a schematic diagram of an electronic device according to an example embodiment of the present application. DETAILED DESCRIPTION

[0030] The example embodiments will be described in detail herein with reference to the attached drawings. The following description is made with reference to the accompanying drawings in which like reference numerals refer to like elements, unless otherwise indicated. The following description of example embodiments does not represent all embodiments consistent with one or more embodiments of the present application. Rather, they are merely examples of apparatuses 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 the steps of the methods in other embodiments are not necessarily performed in the order shown and described herein. In some other embodiments, the steps of the methods can include more or fewer steps than those described herein. Furthermore, a single step described herein can be split into multiple steps in other embodiments; and multiple steps described herein can be combined into a single step in other embodiments.

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

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

[0034] It can be seen that there are many different wired communication protocols in the related art, and the manufacturers of slave devices may use any of the communication protocols when producing slave devices. In this case, if the host device only has an interface that supports a fixed communication protocol, the types of connectable slave devices and control data will be restricted. For example, if the host device only has an IIC protocol interface, 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 needs to reserve multiple different interfaces corresponding to different communication protocols, such as an IIC protocol interface and an SPI protocol interface. However, in this way, the interfaces provided cannot be modified later, for example, after the host device is shipped, a slave device uses the latest public communication protocol, and the host device cannot successfully establish a communication connection with the slave device. At the same time, this approach also wastes interface space on the host device.

[0035] To solve the above problems, the present application proposes a pin detection scheme for a vehicle-mounted universal interface, which polls and detects target pins that establish a physical connection with a slave device to determine the target protocol to which each target pin belongs. Next, the embodiments of the present application will be described in detail.

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

[0037] ​The vehicle 11 can include vehicles of various energy sources and various structural types, such as fuel vehicles, electric vehicles, hybrid vehicles, etc., or sedans, pickup trucks, SUVs, etc., and the present application does not limit this. The slave devices 12-14 can include various electronic or mechanical devices installed inside or outside the vehicle for improving the functionality, comfort, safety or entertainment of the vehicle. These devices can be pre-installed when the vehicle is shipped, or purchased and installed separately by the user later, such as a car refrigerator, a car camera, a car drone nest, etc.

[0038] In the case where the user subsequently purchases the 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. For example, assuming that the user of the vehicle 11 purchases the slave devices 12-14 separately, the slave device 12 is a car refrigerator, the slave device 13 is a car camera, and the 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 the slave device 12 can be a common I / O protocol; the car camera needs to be functionally controlled by the vehicle and transmit the images it captures to the vehicle, so the communication protocol used by the slave device 13 can be an SPI protocol; and the car drone nest can also need to interact with the vehicle for bidirectional data, so that the user can control the function of the drone nest through the vehicle. Therefore, the communication protocol used by the slave device 14 can be a UART protocol. In the case where the vehicle needs to establish a communication connection with the slave devices 12-14 at the same time, each slave device can be connected to the vehicle 11 through a vehicle universal interface at the same time. Here, the vehicle universal interface can be various forms of universal interfaces in related technologies, such as USB Type-A, USB Type-C, etc., or a universal interface designed by the technician to match the interface size of multiple slave devices. The vehicle universal interface can support multiple slave devices to establish physical connections with the vehicle through the access of an adapter cable. For example, the vehicle 11 is equipped with a USB Type-A vehicle universal interface, which can be inserted into a "one-to-three" adapter cable to expand one single interface into three independent interfaces, thereby allowing the slave devices 12-14 to be connected to the same universal interface at the same time. Specifically, the design of this adapter cable can include a USB Type-A female interface for connecting the universal interface on the vehicle, and at the other end, the adapter cable branches 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 connect a slave device. Of course, the technician can also implement the vehicle universal interface configured on the vehicle in other ways, and the present application does not limit the physical form of the vehicle universal interface.

[0039] It can be understood that, since the vehicle universal interface supports access of multiple slave devices using different communication protocols, when the vehicle universal interface has a physical connection with a slave device, the communication protocol used by the slave device needs to be determined, so that data interaction with the slave device can be successfully performed based on the determined communication protocol. The method for determining the communication protocol will be described in detail below.

[0040] Figure 2 is a pin detection method flowchart for a vehicle universal interface according to an exemplary embodiment of the present application, wherein the vehicle universal interface includes multiple pins, each of which can be used to transmit data signals of multiple communication protocols. Referring to Figure 2 , the method includes:

[0041] Step 201: determining n target pins physically connected to slave devices from the multiple pins, n being a positive integer.

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

[0043] In an embodiment, the target pins can be the pins of the vehicle universal interface that have a physical connection with the slave devices, and after the communication protocol used by the slave devices is determined, data interaction with the slave devices can be performed through the target pins based on the communication protocol. Assuming that the vehicle universal interface has 10 pins (such as pin 1 to pin 10), and two slave devices have a physical connection with the universal interface and connect pin 1, pin 2 and pin 3. In this case, n = 3 and the n target pins are pin 1, pin 2 and pin 3.

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

[0045] In step 202, in the case that n≥2, for target protocols in the plurality of communication protocols, the number of required pins of which is not greater than n, each target pin is polled to determine the target protocol to which the pin currently belongs.

[0046] In an embodiment, the plurality of communication protocols that any pin can transmit includes a general I / O protocol. The general I / O protocol generally only implements simple digital input and output functions, and only one signal line is needed to implement basic communication or control functions: when a slave device uses the general I / O protocol, after the slave device is physically connected to a pin in the vehicle-mounted universal interface, the vehicle can read the level (high or low) of the target pin to determine the state of the external device, and can output a high or low level through the pin to control the state of the external device. Therefore, in the case that only one pin in the vehicle-mounted universal interface is physically connected to the slave device, i.e., in the case that the number of target pins is 1 (i.e., n=1), it can be directly determined that the target pin belongs to the general I / O protocol.

[0047] In an embodiment, in the case that two or more pins in the vehicle-mounted universal interface are physically connected to the slave device, i.e., in the case that the number of target pins is 2 or more (i.e., n≥2), target protocols that meet the conditions can be determined from the plurality of communication protocols. It can be understood that when the number of target pins is n, i.e., only n pins in the vehicle-mounted universal interface are physically connected to the slave device, the number of pins used by the communication protocol to which any target pin belongs must 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 is physically connected must not use the SPI protocol, and any pin of the 3 target pins cannot belong to the SPI protocol. Therefore, the communication protocol of which the number of required pins is not greater than n can be determined as a target protocol, and the number of target protocols can be one or more. After the target protocols are determined, each target pin can be polled to determine the target protocol to which each pin belongs.

[0048] Specifically, the detection of any target pin to determine its current belonging target protocol includes: generating target detection signals respectively complying with each target protocol, and sending the target detection signals to the corresponding slave device through at least the any target pin; in the case of receiving a target detection response returned for the target detection signal complying with any target protocol, it is determined that the any target pin currently belongs to the any target protocol.

[0049] In the related art, each public communication protocol has a specific number of signal lines and signal characteristics, and 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 for transmitting clock signals and data signals, and the two signal lines of the UART are used for transmitting data signals and receiving data signals. Therefore, in the embodiment, the number of signal lines and the signal characteristics used by any communication protocol are different from those of other communication protocols. Therefore, in the case of determining multiple target protocols, target detection signals complying with each target protocol can be generated according to the number of signal lines and the 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 for transmitting clock signals and data signals, the target detection signal for the IIC protocol can include clock signals and data signals.

[0050] Then, for any target pin, the generated target detection signal can be sent to the slave device through the target pin or a target pin combination formed by the target pin and other target pins. For example, the IIC protocol requires 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 form a target pin combination. Since the slave device will return a response signal to the sending end when receiving a data signal complying with its own communication protocol, 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 an embodiment, if no target probe response is received from the slave device after sending a target probe signal for any protocol through any target pin or any combination of target pins, the detection can be performed again in the same way after changing the target pin until all target pins are traversed; if no target probe response is received, the detection can be performed again using a target probe signal of another target protocol. The above traversal method involves two layers of loop, the inner loop is "each target pin" and the outer loop is "each target protocol". In another traversal method, the inner loop can be set as "each target protocol" and the outer loop can be set as "each target pin": if no target probe response is received from the slave device after sending a target probe signal for any protocol through any target pin or any combination of target pins, the detection can be performed again through the same target pin or combination of target pins after changing the target probe signal until all target probe signals of all target protocols are traversed; if no target probe response is received, the detection can be performed again using another target pin or combination of target pins. This traversal method is more suitable for the case where the number of signal lines used by two target protocols is the same. For example, IIC protocol and UART protocol both use two signal lines, if no target probe response is received after sending a target probe signal for IIC protocol through target pin 1 and target pin 2, a target probe signal for UART protocol can be sent through target pin 1 and target pin 2 immediately, if no target probe response is received, the detection can be performed again after changing the target pin, for example, sending a target probe signal for IIC protocol and a target probe signal for 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, which is not limited in the present application.

[0052] In an embodiment, after determining the target protocol to which each target pin belongs, the communication data can be sent to the corresponding slave device or received from the corresponding slave device based on the target pin and the target protocol to which the target pin belongs.

[0053] From the above embodiments, the application can automatically identify the communication protocol used by the slave device through the traversal detection method in the case of inserting the slave device into the general interface of the vehicle, so that the slave device can successfully establish a wired communication connection with the vehicle. The vehicle does not need to pre-agree with the slave device on the interface protocol, nor does it need to reserve multiple different interfaces to support multiple different communication protocols. At the same time, in the case of modification or addition and deletion of the target protocol, only the software layer needs to be updated to generate the target detection signal of the changed communication protocol, successfully detect the changed communication protocol, and improve the adaptability and flexibility of the vehicle in wired communication.

[0054] In an embodiment, the plurality of communication protocols that any pin can transmit includes a UART protocol. The UART protocol requires two signal lines, one for sending data (also known as the Tx line) and the other for receiving data (also known as 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, in the case where the number of target pins is not less than two (i.e., n≥2), if any target pin is detected, the any target pin can be used as a first target pin, and any other target pin different from the target pin can be used as a second target pin, so that the first target pin and the second target pin together constitute a target pin combination. In the embodiments of the application, the first target pin and the second target pin are only used to distinguish two different target pins and do not refer to a specific target pin. The first target pin and the second target pin can be any target pin. For example, in the case where there are target pin 1, target pin 2, and target pin 3, if the target pin 1 is used as the first target pin, the target pin 2 and the target pin 3 can both be used as the second target pin. The same way will be used to distinguish the target pins in the subsequent embodiments, and the third target pin and the fourth target pin will be defined in the same way, and will not be described again.

[0056] Afterwards, the data signal can be generated as the target detection signal, and the generated data signal is sent through the first target pin based on the preset baud rate, and in the case that the target detection response returned by the slave device is received at the second target pin, it is determined that the current first target pin and the second target pin belong to the UART protocol. If the generated data signal is sent through the first target pin based on the preset baud rate, and no target detection response is received through the second target pin, 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 replacing the target pin 2 with the target pin 3) and then the detection is performed again, or the target detection signal corresponding to other target protocols can be used to detect the current target pin combination as described in the above embodiment, which will not be repeated here.

[0057] In another specific manner, a plurality of other target pins different from the first target pin can also be used as the second target pin at the same time. After the generated data signal is sent through the first target pin, if the 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 receiving the target detection response belong to the UART protocol. Through the method of the embodiment, the communication protocol to which the target pin belongs can be determined more quickly, and the efficiency of protocol detection is significantly improved.

[0058] In addition, whether the communication connection can be successfully established through the UART protocol is also closely related to the setting of the baud rate. Therefore, when using the target detection signal corresponding to the UART protocol to detect any target pin combination, different baud rates need to be used for trial. For example, in the case that the first target pin and the second target pin form a target pin combination, the generated data signal is sent through the first target pin based on a plurality of different baud rates, and it is detected whether the target detection response is received by the second target pin. In the case of using any baud rate, if the target detection response is received through the second target pin, 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.

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

[0060] In an embodiment, the multiple communication protocols that can be transmitted by any pin include IIC protocol. IIC protocol requires two signal lines, one for transmitting clock signal (also referred to as SCL line), and the other for transmitting data (also referred to as SDA line). When IIC protocol is used, signal synchronization can be performed through SCL line, and data can be sent and received through SDA line. It should be noted that in the case of different number of target pins, different ways can be used to poll and detect IIC protocol.

[0061] In one mode, when the number of target pins is not less than two and less than four (i.e. 2≤n<4), the clock signal and the data signal can be generated as the target detection signals, 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 that the 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 the generated clock signal is sent through the first target pin and the generated data signal is sent through the second target pin, and no target detection response is received through the second target pin, it can be considered that the target pin combination of 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 detection can be performed again, which will not be described here.

[0062] Similarly, when detecting the IIC protocol, the plurality of other target pins different from the first target pin can also be used as the second target pin at the same time. The generated data signal is sent through the plurality of second target pins while the generated clock signal is sent through the first target pin. If the 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 receiving the target detection response belong to the IIC protocol.

[0063] It should be noted that the detection method for the IIC protocol described in the above embodiments 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 the communication protocol can also use the SPI protocol when the number of target pins is not less than four, the present application provides another more efficient detection method, which will be described in detail below.

[0064] In another mode, in the case that the number of target pins is not less than four (i.e. n≥4), if any one pin can transmit both IIC protocol and SPI protocol, the detection process of the two protocols can be improved to realize simultaneous detection of IIC protocol and SPI protocol. SPI protocol requires four signal lines, one of which is used to transmit clock signal (also referred to as SCLK line), one of which is used to send data to slave device (also referred to as MOSI line), one of which is used to receive data (also referred to as MISO line), and one of which is used to transmit chip select signal (also referred to as SS line or CS line). In the use of SPI protocol, signal synchronization can be performed through SCLK line, data and chip select signal can be sent through MOSI and SS / CS lines, and data signal returned by slave device can be received through MISO line. It can be seen that the use of SPI protocol in some signal lines is similar to IIC protocol: both require a signal line for transmitting clock signal and a signal line for sending data signal. The difference between the two lies in that IIC protocol receives target detection response through the signal line for sending data signal, i.e. the same signal line is used for sending data signal and receiving return signal; while SPI protocol receives target detection response through another signal line, i.e. different signal lines are used for sending data signal and receiving return signal.

[0065] Therefore, in the above case, clock signal, data signal and chip select signal can be generated as target detection signal, clock signal is sent to slave device through the first target pin, data signal is sent to slave device through the second target pin, and chip select signal is sent to slave device through the third target pin. Then, if the target detection response returned by slave device is received through the second target pin, i.e. the response signal is received through the signal line for sending data signal, it can be determined that the first target pin and the second target pin belong to IIC protocol; while if the target detection response returned by slave device is received through the fourth target pin, i.e. the response signal is received through another signal line (different from the signal line for sending 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 SPI protocol.

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

[0067] In an embodiment, after the polling detection is completed, if there are still remaining target pins whose target protocol is not determined, the communication protocol to which each remaining target pin belongs can be determined as a general I / O protocol. Since the general I / O protocol only needs one signal line to successfully establish a communication connection, each remaining target pin does not affect each other and belongs to the general I / O protocol. It should be noted that the completion of the polling detection includes two cases: one case is that all target pin combinations have been attemptedly detected based on the target detection signal of a certain target protocol; the other case is that the target pin corresponding to a certain target protocol has been determined in the polling process of the target protocol, so that the polling of the target protocol is prematurely terminated. When the above two cases occur, it can be considered that the polling of the target protocol has been completed.

[0068] In the following, one of the implementation processes of the application will be described through a specific example. Figure 3 and Figure 4 , wherein Figure 3 is a connection diagram of a vehicle-mounted universal interface and a plurality of slave devices shown by an example embodiment of the application, Figure 4 is a whole flowchart shown by an example embodiment of the application.

[0069] As shown in Figure 3 , the vehicle-mounted universal interface has a total of 5 pins (pin 1, pin 2, pin 3, pin 4, and target pin 5), and simultaneously establishes a physical connection with three slave devices (it is assumed that the slave device 12 uses the IIC protocol, the slave device 13 uses the UART protocol, and the slave device 14 uses the general I / O protocol).

[0070] First, step 401 is performed, and it is determined that there are 5 target pins at this time by detecting whether the pins are connected with pull-up resistors, that is, n = 5. Since all the pins are target pins at this time, the pins will be referred to as target pins in the following.

[0071] In step 402, the target protocol is determined according to the number of target pins. Since the number of pins required by the target protocol must be no more than the number of target pins, if the communication protocols include the common I / O protocol, the IIC protocol, the UART protocol and the SPI protocol, any of the above communication protocols can be the target communication protocol.

[0072] In step 403, the target pins are polled and detected to determine whether the target pins belong to the IIC protocol or the SPI protocol through the improved detection process for the IIC protocol and the SPI protocol. The step can include steps 4031 to 4036.

[0073] In step 4031, the clock signal is sent through the first target pin, the data signal is sent through the second target pin, and the chip select signal is sent through the third target pin. As shown in Figure 3 The target pin 1 can be selected as the first target pin, the target pin 2 can be selected as the second target pin, and the target pin 3 can be selected as the third target pin, and the three target pins together form a target pin combination.

[0074] In step 4032, it is determined whether the target detection response returned by the slave device for the target detection signal is received.

[0075] If the target detection response is not received, in step 4033, it is determined whether all target pins have been polled in the above manner. If not, the step 4031 is returned, and the pins actually corresponding to the target pin combination are changed (for example, the target pin 4 is selected as the third target pin). If all target pins have been polled, the detection process for other target protocols can be performed, for example, step 404.

[0076] If the target detection response is received, in step 4034, it is determined whether the pin receiving the target detection response is the pin sending the data signal. If yes, it means that the data signal and the return signal use the same signal line, and step 4035 is performed to determine that the first target pin and the second target pin belong to the IIC protocol. If no, it means that the data signal and the return signal use different signal lines, and step 4036 is performed 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] In Figure 4 In the example, after the target pin 1 is selected as the first target pin to send the clock signal and the target pin 2 is selected as the second target pin to send the data signal, the target detection response can be received through the second target pin. At this time, it is determined that the target pin 1 and the target pin 2 belong to the IIC protocol, and the target pin 1 is connected to the signal line corresponding to the clock signal and the 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, and after all the target pin combinations are tried to be detected through the processes of step 4031 to step 4044, the detection process for other target protocols can be entered. In the case that the target protocol also includes the UART protocol, step 404 can be performed to determine whether the target pin belongs to the UART protocol. It should be noted that in the actual implementation process, when the detection is performed for two different communication protocols, if the two protocols do not affect each other, the execution order can be set by the technician according to the actual needs, such as the execution order of step 403 and step 404 in the process can be exchanged.

[0079] Step 404 can specifically include step 4041 to step 4044.

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

[0081] In the case that the target detection response is not received, step 4043 is performed to detect whether all the target pins have been polled in the above manner: if not, return to step 4041 and change the pins actually corresponding to the target pin combination (such as taking the target pin 5 as the second target pin, etc.); if yes, the detection process for other target protocols can be entered.

[0082] In the case that the target detection response is received, step 4044 is performed to determine that the first target pin and the second target pin belong to the UART protocol.

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

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

[0085] Up to now, it has been determined that Figure 4 In the example, the communication protocols to which the target pins belong are matched with the communication protocols used by the slave devices connected to the target pins, that is, the target pin 1 and the target pin 2 belong to the IIC protocol, the target pin 3 and the target pin 4 belong to the UART protocol, and the target pin 5 belongs to the general I / O protocol.

[0086] Based on the pin detection method for the vehicle-mounted universal interface provided in the application, the application further provides a pin detection device for the vehicle-mounted universal interface, which is described with reference to Figure 5 , and includes:

[0087] A determination unit 51 is configured to determine n target pins physically connected to slave devices from the plurality of pins, n being a positive integer.

[0088] A polling unit 52 is configured to, in the case of n≥2, poll each target pin to determine a target protocol to which the target pin currently belongs, for m target protocols in the plurality of communication protocols, the number of required pins of the m target protocols being not greater than n.

[0089] The polling each target pin to determine a target protocol to which the target pin currently belongs includes:

[0090] Generating a target detection signal complying with each target protocol, and sending the target detection signal to the corresponding slave device through at least the target pin;

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

[0092] Optionally, the plurality of communication protocols includes a general I / O protocol, and the device further includes:

[0093] A first determination unit 53 is configured to, in the case of n=1, determine that the target pin currently belongs to the general I / O protocol.

[0094] Optionally, the plurality of communication protocols includes a UART protocol, and in the case of n≥2, the polling unit 52 is specifically configured to:

[0095] Generate a data signal as the target detection signal, and send 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 for the target detection signal, it is determined that the first target pin and the second target pin belong to the UART protocol.

[0097] Optionally, the plurality of communication protocols includes IIC protocol, and in a case where 2≤n<4, the polling unit 52 is specifically configured to:

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

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

[0100] Optionally, the plurality of communication protocols includes IIC and SPI protocol, and in a case where n≥4, the polling unit 52 is specifically configured to:

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

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

[0103] In a case where the fourth target pin receives a target detection response returned for 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 determination unit 54 is configured to, in a case where the polling detection is completed and there are remaining target pins which have not been determined to belong to a target protocol, determine that each of the remaining target pins belongs to a general I / O protocol.

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

[0107] In a case where it is determined that any target pin belongs to the UART protocol, send 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 in the case of receiving the HCI completion instruction returned by the slave device, it is determined that the slave device is equipped with a Bluetooth module for communication based on the UART protocol.

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

[0110] In the case that the voltage value of any pin indicates that it is connected with a pull-up resistor, it is determined that the pin is 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 protocol to which each target pin belongs, the corresponding slave device is sent and / or receives communication data.

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

[0114] For the device embodiment, since it basically corresponds to the method embodiment, the relevant part can be referred to the part of the method embodiment. The device embodiments described above are only schematic, and the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. According to the actual needs, some or all of the modules can be selected to achieve the purpose of the present application scheme. Those skilled in the art can understand and implement without creative labor.

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

[0116] Referring to Figure 6 At the hardware level, the electronic device comprises a processor 602, an internal bus 604, a network interface 606, a memory 608 and a non-volatile memory 610, and of course can also include other hardware required by the business. The processor 602 reads the corresponding computer program from the non-volatile memory 610 into the memory 608 and then runs, and at the logical level, forms the device corresponding to the above method. Of course, in addition to the software implementation, the present application does not exclude other implementation manners, such as logic devices or software and hardware combined manner, etc., that is, the execution subject of the following processing flow is not limited to each logical unit, but also can be hardware or logic device.

[0117] Accordingly, the application also provides a computer readable storage medium, having stored thereon a computer program, which when executed by a processor implements the pin detection method for vehicle general interface according to any one of the above embodiments.

[0118] The systems, apparatuses, modules or units illustrated by the above embodiments can be specifically implemented by a computer chip or entity, or by a product with certain functions. A typical implementation device is a computer, and the specific form of the computer can be 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 e-mail device, 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 (CPUs), input / output interfaces, network interfaces, and memory.

[0120] The memory can include non-persistent memory in computer readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or Flash memory. The memory is an example of computer readable media.

[0121] Computer readable media includes permanent and non-permanent, removable and non-removable media implemented by any method or technology for storing information. 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 technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, disk storage, quantum memory, graphene-based storage medium or other magnetic storage device, or any other non-transmission medium that can be used to store information accessible by a computing device. According to the definition herein, computer readable media does not include transitory computer readable media, such as modulated data signals and carriers.

[0122] Based on the same concept as the above method, the specification also provides a computer program product, including computer programs / instructions, which when executed by a processor implements the steps of the method according to any one of the above embodiments.

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 pin being capable of transmitting 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 that n≥2, for target protocols requiring no more than n pins among the plurality of communication protocols, each target pin is polled to determine the target protocol to which it currently belongs; Probing any target pin to determine the target protocol it currently belongs to includes: respectively generating a target detection signal complying with each target protocol, and sending the target detection signal to the corresponding slave device via at least any one of the target pins; In a case where a target detection response returned in response to a target detection signal complying with any target protocol is received, 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 multiple communication protocols include the UART protocol. When n≥2, detecting any target pin to determine the target protocol it currently belongs to 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 the UART protocol.

4. The method according to claim 1, wherein The multiple communication protocols include the IIC protocol. When 2≤n<4, detecting any target pin to determine the target protocol it currently belongs to includes: generating a clock signal and a data signal as the target detection signal, and sending the clock signal to the slave device through a first target pin, and sending 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, wherein 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: generating a clock signal, a data signal, and a chip select signal as the target detection signal, sending the clock signal to the slave device through a first target pin, sending the data signal to the slave device through a second target pin, and sending 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: When it is determined that any target pin belongs to the UART protocol, an HCI reset instruction is sent 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 a pull-up resistor is connected to the pin, 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 multiple 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 configured to, when n is greater than or equal to 2, poll each target pin of a target protocol requiring no more than n pins among the plurality of communication protocols to determine the target protocol to which it currently belongs; Probing any target pin to determine the target protocol it currently belongs to includes: respectively generating a target detection signal complying with each target protocol, and sending the target detection signal to the corresponding slave device via at least any one of the target pins; In a case where a target detection response returned in response to a target detection signal complying with any target protocol is received, 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 implements the steps of the method according to any one of claims 1 to 8 when the computer program / instruction is executed by a processor.

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