Automatic identification method, device and equipment for identity of one-way controller and medium
By simulating serial port data to transmit identity identifiers between single-line controllers and using level signals and verification mechanisms, the high cost and low efficiency problems of automatic identification of single-line controller serial numbers are solved in hardware, and an efficient and low-cost identity is achieved Identify and identify stability.
Patent Information
- Application Number
- CN202411211295.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-06
AI Technical Summary
In the prior art, the automatic identification of single-line controller serial numbers has high cost and low efficiency through hardware, which limits its application in large-scale systems.
The analog serial port data is used to transmit identity identification between single-line controllers through hand-in-hand, and the identity identification is achieved using a simple level signal and verification mechanism, and the identity identification is saved in off-chip Flash to ensure fault tolerance.
Without increasing hardware costs, the system complexity and cost are reduced, the automatic identification efficiency and reliability of single-line controllers are improved, and it is suitable for low-cost or small single-line controllers.
Smart Images

Figure CN119087976A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of controller identification, and more particularly to a method, device, equipment and medium for automatically identifying the identity of a single-row controller. Background Art
[0002] In the field of automated control systems, image recognition technology, and electronic equipment control systems, single-line controllers are common devices that are mainly used to control individual devices. Single-line controllers usually require input and output through specific pins to facilitate signal transmission and control. In practical applications, single-line controllers need to be able to automatically identify their position in the entire system in order to perform correct control.
[0003] In the prior art, a common solution is to realize automatic identification of the serial number of the single-row controller by hardware, for example, the hardware address of each single-row controller can be set, and then the position of the single-row controller can be identified by reading the hardware address.
[0004] However, the existing technology has some problems in practical application. First, the hardware method to realize the automatic identification of the serial number of a single-row controller requires additional hardware costs, and the setting and reading of the hardware address requires a special hardware circuit, which increases the complexity and cost of the system. In addition, when processing the automatic identification of a large number of single-row controller serial numbers through the hardware method, the efficiency is relatively low, which limits the application of single-row controllers in large-scale systems. Summary of the invention
[0005] In order to reduce the complexity and cost of automatic identification of single-row controller serial numbers and improve the efficiency of automatic identification of a large number of single-row controllers, the present application provides a method, device, equipment and medium for automatic identification of the identity of a single-row controller.
[0006] In a first aspect, the present application provides a method for automatically identifying the identity of a single-row controller, comprising:
[0007] Determine whether the current identity of the current single-row controller is the identity corresponding to the first single-row controller;
[0008] If the current identity identifier is not the identity identifier corresponding to the first single-row controller, then based on the input pin reserved by the current single-row controller, the analog serial port data sent by the previous single-row controller is received, the output pin reserved in the previous single-row controller is communicatively connected with the input pin of the current single-row controller, and the analog serial port data is data including the identity identifier of the previous single-row controller;
[0009] Based on the simulated serial port data, obtaining the current identity;
[0010] Based on the current identity, generate new simulated serial port data;
[0011] Based on the output pins reserved by the current single-row controller, the new simulated serial port data is sent to the next single-row controller, and the input pins reserved in the next single-row controller are communicatively connected with the output pins of the current single-row controller.
[0012] The beneficial effects of the present application are as follows: a single-row controller specifies two pins as an input pin and an output pin respectively, and each single-row controller is connected in a hand-in-hand manner to transmit analog serial port data containing identity identification, thereby achieving automatic identification of the serial numbers of each single-row controller without increasing hardware costs, reducing the complexity and cost of the system, and improving the efficiency of automatic identification of a large number of single-row controllers, and is suitable for low-cost or small single-row controllers.
[0013] Further, the determining whether the current identity of the current single-row controller is the identity corresponding to the first single-row controller includes:
[0014] If the reserved input pin detects a low level, a timer is started to record the holding time of the low level;
[0015] If the holding time of the low level exceeds a preset first time threshold, it is determined that the current identity identifier is the identity identifier corresponding to the first controller.
[0016] The beneficial effect of adopting the above further solution is: automatic recognition of the identity of the single-row controller is achieved through a simple level signal, which simplifies the operation process.
[0017] Further, after receiving the simulated serial port data sent by the previous single-line controller, the method further includes:
[0018] Verifying the simulated serial port data to obtain a verification result;
[0019] Determine whether the verification result of the simulated serial port data is valid data, and if the verification result of the simulated serial port data is valid data, execute the step of obtaining the current identity;
[0020] If the verification result of the simulated serial port data verification is invalid data, the simulated serial port data is discarded.
[0021] The beneficial effect of adopting the above further scheme is: by verifying the analog serial port data and determining whether the analog serial port data is valid data, the reliability of analog serial port data recognition can be significantly improved, thereby avoiding unnecessary processing of erroneous analog serial port data and improving the recognition efficiency and stability of the identity identification of each single-row controller.
[0022] Further, the simulated serial port data includes start bit information, data bit information, check bit information and stop bit information, and the step of determining whether the check result of the simulated serial port data is valid data includes:
[0023] If the stop bit information is received, checking the data bit information;
[0024] If the verification result of the data bit information is consistent with the verification bit information, it is determined that the verification result of the simulated serial port data is valid data.
[0025] The beneficial effect of adopting the above further scheme is that by clearly using the stop bit information as a sign of data transmission completion, it can be ensured that the current single-line controller performs verification after receiving the simulated serial port data completely, thereby reducing the possibility of verification errors or data loss caused by incomplete reception of the simulated serial port data. By verifying the data bit information and comparing the result with the check bit information, it is possible to effectively detect whether an error has occurred in the data transmission process of the simulated serial port data, and to more accurately determine the validity of the simulated serial port data.
[0026] Further, after obtaining the current identity, the method further includes:
[0027] Obtaining a previous identity identifier stored in an off-chip flash, wherein the previous identity identifier is the identity identifier of the current single-row controller identified after the last power-on;
[0028] If the current identity identifier is inconsistent with the previous identity identifier, the previous identity identifier is replaced by the current identity identifier and saved in the off-chip flash.
[0029] The beneficial effect of adopting the above further solution is that by obtaining and comparing the current identity with the last identity stored in the off-chip Flash, it can be ensured that after the single-row controller is restarted or reset, the single-row controller can be restored to the last recognized identity based on the off-chip Flash. By updating and saving the current identity in the Flash, the fault tolerance of the single-row controller is improved.
[0030] Further, after replacing the previous identity identifier with the current identity identifier and saving it to the off-chip flash, the method further includes:
[0031] If the next simulated serial port data reception fails, the simulated serial port data reception is stopped, and the current identity identifier stored in the off-chip flash is used again as the identity identifier of the current single-row controller;
[0032] Based on the current identity, a message sent by the CAN bus is received.
[0033] The beneficial effect of adopting the above further solution is: it ensures that each single-row controller can be assigned a reasonable serial number of its own, and there will be no conflict in the CAN bus, thereby reducing the impact of the failure of the next simulated serial port data reception.
[0034] Further, after obtaining the current identity, the method further includes:
[0035] If the current self-serial number of the current single-row controller is the self-serial number corresponding to the last single-row controller, the automatic identification ends;
[0036] If the current self-serial number of the current single-row controller is not the self-serial number corresponding to the last single-row controller, the step of generating new simulated serial port data based on the current identity identifier is performed.
[0037] The beneficial effect of adopting the above further scheme is: by automatically identifying whether the identity of the current single-row controller is the last one, it can intelligently decide whether to end the identification process, and whether the identity of all single-row controllers has been automatically identified, reducing the need for manual intervention, and improving the automation and operating efficiency of the single-row controller identity identification. When a new single-row controller is added, it only needs to ensure that the new single-row controller can correctly identify the identity and generate simulated serial port data according to the process, so that the new single-row controller can be automatically included in the management scope without large-scale modification or reconfiguration.
[0038] In a second aspect, the present application provides an automatic identification device for a single-row controller, comprising:
[0039] A judging module, used to judge whether the current identity of the current single-row controller is the identity corresponding to the first single-row controller; if the current identity is not the identity corresponding to the first single-row controller, then transfer to the first receiving module;
[0040] The first receiving module is used to receive the simulated serial port data sent by the previous single-row controller based on the input pin reserved by the current single-row controller, the output pin reserved in the previous single-row controller is communicatively connected with the input pin of the current single-row controller, and the simulated serial port data is data including the identity of the previous single-row controller;
[0041] A first acquisition module, configured to acquire the current identity based on the simulated serial port data;
[0042] A generating module, used for generating new simulated serial port data based on the current identity identifier;
[0043] The sending module is used to send the new simulated serial port data to the next single-row controller based on the output pin reserved by the current single-row controller, and the input pin reserved in the next single-row controller is communicatively connected with the output pin of the current single-row controller.
[0044] In a third aspect, the present application provides an electronic device, including a processor and a memory, wherein the processor is coupled to the memory;
[0045] The processor is used to execute the computer program stored in the memory so that the electronic device performs the method as described in any one of the first aspects.
[0046] In a fourth aspect, the present application provides a computer-readable storage medium, comprising a computer program or instructions, which, when executed on a computer, causes the computer to execute the method as described in any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic diagram of a flow chart of a method for automatically identifying the identity of a single-row controller according to an embodiment of the present application;
[0048] Figure 2 This is a structural block diagram of n single-row controllers connected in series in an embodiment of the present application;
[0049] Figure 3 This is a structural block diagram of an automatic identification device for a single-row controller according to an embodiment of the present application;
[0050] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0051] The present application is further described in detail below in conjunction with the accompanying drawings.
[0052] The embodiment of the present application provides a method for automatically identifying the identity of a single-row controller, which can be executed by a device, which can be a server or a terminal device, wherein the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device can be a smart phone, a tablet computer, a desktop computer, etc., but is not limited thereto.
[0053] like Figure 1 As shown, a method for automatically identifying the identity of a single-row controller is performed by an electronic device. The main process of the method is described as follows (steps S101 to S105):
[0054] Step S101: Determine whether the current identity identifier of the current single-row controller is the identity identifier corresponding to the first single-row controller; if the current identity identifier is not the identity identifier corresponding to the first single-row controller, proceed to step S102.
[0055] Step S102: Based on the input pins reserved by the current single-row controller, analog serial port data sent by the previous single-row controller is received, the output pins reserved in the previous single-row controller are communicatively connected with the input pins of the current single-row controller, and the analog serial port data is data including the identity of the previous single-row controller.
[0056] like Figure 2 As shown, in this embodiment, multiple single-row controllers need to be connected to the same CAN bus for data exchange, and each single-row controller has two IO pins reserved separately, which are used as input pins and output pins respectively. Multiple single-row controllers are connected in series in a hand-in-hand manner, so that the output pin of the previous single-row controller is connected to the input pin of the next single-row controller. The starting single-row controller among the multiple single-row controllers connected in series hand-in-hand is the first single-row controller.
[0057] In this embodiment, the input pins and output pins of each single-row controller are pulled up by default, that is, when the input pins and output pins are not explicitly configured to other states, their level states are set to high level (High Level) by default. For each single-row controller, the corresponding identity identifier is a parameter that characterizes the setting order of the single-row controller. The identity identifier can be its own serial number. The current identity identifier is the current own serial number. The identity identifier corresponding to the first single-row controller can be represented as serial number 1.
[0058] Step S103: Based on the simulated serial port data, the current identity is obtained.
[0059] During the automatic identification period, the output pin of the previous single-row controller will periodically send simulated serial port data to the current single-row controller, and the simulated serial port data may include the corresponding self-serial number of the previous single-row controller. After obtaining the corresponding self-serial number of the previous single-row controller, the current single-row controller adds one to the previous serial number to obtain the current self-serial number, thereby completing the automatic identification of the serial number of the current single-row controller.
[0060] Step S104: Generate new simulated serial port data based on the current identity identifier.
[0061] Step S105: Based on the output pins reserved by the current single-row controller, the new simulated serial port data is sent to the next single-row controller, and the input pins reserved in the next single-row controller are communicatively connected with the output pins of the current single-row controller.
[0062] The new simulated serial port data can include the current serial number of the current single-row controller, which is convenient for the next single-row controller to automatically identify the serial number. The single-row controller specifies two IO pins as input pins and output pins respectively. Each single-row controller is connected in a hand-in-hand manner, connecting the output pin of the previous single-row controller with the input pin of the current single-row controller to transmit the simulated serial port data containing its own serial number, thereby realizing the automatic identification of the serial number of each single-row controller without increasing the hardware cost.
[0063] Each single-row controller has a designated input and output pin for automatic identification, without additional hardware cost, reducing the complexity and cost of the system. Each single-row controller uses a hand-in-hand method to connect the output pin of the previous controller to the input pin of the next controller, so as to achieve fast serial communication, improve the efficiency of automatic identification of a large number of single-row controllers, and make it more suitable for large-scale systems. Regardless of the computing power and storage space of the single-row controller, automatic identification can be achieved through the automatic identification method of the single-row controller identity, which is more adaptable and suitable for low-cost or small single-row controllers.
[0064] The hardware circuit corresponding to the automatic identification method of the single-row controller identity is extremely simple and has strong expandability. After the position of each single-row controller in the bus bundle is changed, no manual intervention is required. The serial number of each single-row controller can be automatically identified according to the sequence of serial connection, which has the characteristics of simple implementation and low cost. For example, when it is necessary to replace a single-row controller or swap the installation positions of some single-row controllers by hot plugging, the automatic identification method of the single-row controller identity can still ensure that each single-row controller can quickly and effectively identify its own serial number.
[0065] In this embodiment, the simulated serial port data may include start bit information, data bit information, check bit information and stop bit information, the start bit information is used to identify the beginning of the data frame, the data bit information is the data information actually transmitted, the check bit information is used to check whether an error occurs during the data bit transmission process, and the stop bit information is used to identify the end of the data frame. The data format of the simulated serial port data may be composed of 1 bit of start bit information + 8 bits of data bit information + 1 bit of check bit information + 1 bit of stop bit information.
[0066] The sending cycle of the analog serial port data between single-row controllers can be 10ms, and the transmission speed can be 9600 baud rate. 9600 baud rate means that 9600 bits of data can be transmitted per second, so the transmission time of each bit is 1000000us / 9600=104us. The start bit information can be 1 bit of low level, and the stop bit information can be 1 bit of high level.
[0067] In this embodiment, the serial communication protocol may specify the use of odd parity as the check bit information. When sending each simulated serial port data, the sending single-line controller calculates the number of 1s in the data bit information (excluding the start bit information and the stop bit information) and adds an additional check bit information. If the number of 1s in the data bit information is an even number, the check bit information is set to 1 so that the total number of 1s including the check bit information becomes an odd number. If the number of 1s in the data bit information is already an odd number, the check bit information is set to 0 to keep the total number of 1s odd. After receiving the simulated serial port data, the receiving single-line controller will perform the same calculation and check whether the total number of 1s including the check bit information is an odd number. If not, it indicates that an error may have occurred in the transmission process of the simulated serial port data.
[0068] Step S101 specifically includes the following processing: if the reserved input pin detects a low level, start the timer and record the holding time of the low level; if the holding time of the low level exceeds the preset first time threshold, determine that the current identity is the identity corresponding to the first controller.
[0069] like Figure 2 As shown, in this embodiment, when the first single-row controller is connected to the wiring harness, the input pin is grounded, that is, the input pin is connected to a continuous low level. When the single-row controller detects that the input pin is continuously at a low level, it can identify that the current serial number of itself is the first.
[0070] Specifically, the preset first time threshold may be 100ms. If the level of the input pin is pulled down from a high level and the low level is maintained for more than 100ms, the input pin is considered to be grounded, that is, the current single-row controller is identified as the first single-row controller.
[0071] The simulated serial port data outputted by the output pin of the first single-row controller can be 0x01. The second single-row controller receives and identifies the simulated serial port data 0x01 of the first controller. The second single-row controller can obtain the serial number of the previous single-row controller connected to it as 1. The serial number 1 plus 1 is the serial number of the second single-row controller itself, that is, the second single-row controller can identify its own serial number 2. And generate new simulated serial port data 0x02, output the simulated serial port data 0x02 to the third single-row controller through the output pin, and so on, until the current serial number of all single-row controllers is identified.
[0072] It is easy to understand that 0x0i (i can be an integer not less than 1) represents an 8-bit (i.e. 1-byte) hexadecimal number, which is represented as 0000000i in binary. When 0x0i is sent through the simulated serial port, it will be encapsulated into a complete frame for transmission according to the serial port communication protocol.
[0073] By grounding the input pin of the first single-row controller and keeping the input pin at a continuous low level, the current serial number can be identified as the first one, and then the output pin can continuously output analog serial port data containing its own serial number, thereby realizing automatic identification of the serial number of the single-row controller through a simple level signal, simplifying the operation process.
[0074] When the level of the input pin is pulled down from a high level and maintained for 104us, it means that the start bit information is received, and then the timer is turned on to record the status and duration of each bit. After that, the level change of the input pin will be detected according to the duration time interval of each bit (104us) according to the current baud rate. When a level signal lasts for 100us, it is judged as a valid bit, and the bit information is recorded and then re-timed. When a high level signal is detected and maintained for 104us, it means that the stop bit information is received, and the current analog serial port data reception is completed.
[0075] In this embodiment, after step S102, it also includes: verifying the simulated serial port data to obtain a verification result; judging whether the verification result of the simulated serial port data is valid data, if the verification result of the simulated serial port data is valid data, executing step S103; if the verification result of the simulated serial port data is invalid data, discarding the simulated serial port data.
[0076] After step S102 and before executing step S103, the simulated serial port data is verified to determine whether the simulated serial port data is valid data, which can significantly improve the reliability of the recognition of the simulated serial port data. If the simulated serial port data is not verified, the receiving single-line controller will process any received simulated serial port data, including those simulated serial port data damaged by transmission errors. By judging the validity of the simulated serial port data, the receiving single-line controller can discard the data with the verification result being invalid, thereby avoiding unnecessary processing of the erroneous simulated serial port data, and improving the serial number recognition efficiency and stability of each single-line controller. When the verification result of the simulated serial port data verification is invalid data, the data frame can be directly discarded, and an error handling routine (such as resending request, recording error log, etc.) can be triggered.
[0077] In this embodiment, determining whether the verification result of the simulated serial port data is valid data specifically includes the following processing: if the stop bit information is received, the simulated serial port data transmission is completed, and the data bit information is verified; if the verification result of the data bit information is consistent with the check bit information, then the verification result of the simulated serial port data is determined to be valid data.
[0078] When the input pin detects a high level and maintains it for 104us, it indicates that the stop bit information has been received, that is, the current simulated serial port data reception is completed. After the reception is completed, the data bit information can be checked according to the check bit information. If the check result is consistent with the check bit information, the check result of the simulated serial port data is valid data, and the simulated serial port data information of this time can be applied and the current self-serial number of the current single-line controller is automatically identified. If the check is inconsistent, the check result of the simulated serial port data check is invalid data, and the simulated serial port data can be discarded and re-collected. When the collection time exceeds the second time threshold, the current self-serial number of the current single-line controller fails to be automatically identified. In this embodiment, the second time threshold can be 5 seconds.
[0079] In this embodiment, after step S103, it also includes: obtaining the previous identity identifier saved in the off-chip flash, the previous identity identifier is the identity identifier of the current single-row controller identified after the last power-on; if the current identity identifier is inconsistent with the previous identity identifier, the current identity identifier replaces the previous identity identifier and saves it to the off-chip flash.
[0080] The default device serial number of each single-row controller can be 0 when it leaves the factory, and the specified address of the off-chip flash is used to store the default serial number. After the current single-row controller detects the current serial number of itself, it can read the previous serial number of itself or the default serial number saved after the last power-on from the off-chip flash. When the current serial number of itself is inconsistent with the previous serial number of itself, the current serial number of itself is updated to the off-chip flash. It is easy to understand that the previous serial number of itself is the result of the automatic identification of the serial number of the current single-row controller.
[0081] By obtaining and comparing the current self-serial number with the last self-serial number saved in the off-chip Flash, it can be ensured that after the single-row controller is restarted or reset, the single-row controller can be restored to the last recognized self-serial number based on the off-chip Flash. By updating and saving the current serial number in the Flash, the fault tolerance of the single-row controller is improved.
[0082] In this embodiment, after the current self-serial number is saved to the off-chip flash, the following processing is also included: if the next simulated serial port data reception fails, the reception of the simulated serial port data is stopped, and the current identity identifier saved in the off-chip flash is re-used as the identity identifier of the current single-line controller; based on the current identity identifier, the message sent by the CAN bus is received.
[0083] When each single-row controller communicates with the CAN bus, the message ID responded by the single-row controller is related to its own identification number. For example, the single-row controller with serial number 1 only responds to the message with CANID 0001 in the CAN bus, and the single-row controller with serial number 2 only responds to the message with 0002 on the CAN bus.
[0084] When the next analog serial port data reception between the current single-row controller and the previous single-row controller fails, the current single-row controller's own serial number fails to be automatically identified. In order to ensure that each single-row controller can be assigned a reasonable serial number and there is no conflict in the CAN bus, the current controller needs to obtain a reasonable serial number as its own serial number. The current controller can continue to use its own serial number automatically identified last time, and the last automatically identified self-serial number is saved in the off-chip flash. The reasons for the failure to receive the next analog serial port data may include that the current single-row controller continues to fail to receive valid analog serial port data and the connection between the current single-row controller and the previous single-row controller is powered off.
[0085] In this embodiment, after step S103, it also includes: if the current self-serial number of the current single-row controller is the self-serial number corresponding to the last single-row controller, the automatic identification ends; if the current self-serial number of the current single-row controller is not the self-serial number corresponding to the last single-row controller, the step of generating new simulated serial port data based on the current identity identifier is executed.
[0086] Each single-row controller is connected hand in hand, connecting the output pin of the previous single-row controller to the input pin of the current single-row controller. When the current single-row controller is the last single-row controller, the output pin does not need to be connected to other single-row controllers.
[0087] By automatically identifying whether the current single-row controller's own serial number is the last one, it can intelligently decide whether to end the identification process and whether all the single-row controllers' own serial numbers have been automatically identified, reducing the need for manual intervention and improving the automation and operating efficiency of single-row controller serial number identification. When a new single-row controller is added, it only needs to ensure that the new single-row controller can correctly identify its own serial number and generate simulated serial port data according to the process, and the new single-row controller can be automatically included in the management scope without large-scale modification or reconfiguration.
[0088] Based on the same technical concept, the present application also provides an automatic identification device for a single-row controller, such as Figure 3 As shown, the automatic identification device 200 for the identity of a single-row controller mainly includes:
[0089] The judging module 201 is used to judge whether the current identity of the current single-row controller is the identity corresponding to the first single-row controller; if the current identity is not the identity corresponding to the first single-row controller, the process proceeds to the first receiving module 202;
[0090] The first receiving module 202 is used to receive the simulated serial port data sent by the previous single-row controller based on the input pin reserved by the current single-row controller, the output pin reserved in the previous single-row controller is communicatively connected with the input pin of the current single-row controller, and the simulated serial port data is data including the identity of the previous single-row controller;
[0091] A first acquisition module 203, configured to acquire the current identity based on the simulated serial port data;
[0092] A generating module 204, configured to generate new simulated serial port data based on the current identity identifier;
[0093] The sending module 205 is used to send the new simulated serial port data to the next single-row controller based on the output pin reserved by the current single-row controller, and the input pin reserved in the next single-row controller is communicatively connected with the output pin of the current single-row controller.
[0094] Optionally, the judging module 201 includes:
[0095] A recording submodule is started, which is used to start a timer and record the holding time of the low level when the reserved input pin detects a low level;
[0096] The comparison threshold submodule is used to determine that the current identity is the identity corresponding to the first controller when the holding time of the low level exceeds a preset first time threshold.
[0097] Optionally, after the first receiving module 202, the method further includes:
[0098] A verification module, used for verifying the simulated serial port data to obtain a verification result;
[0099] An execution module, used for judging whether the verification result of the simulated serial port data is valid data, and if the verification result of the simulated serial port data is valid data, executing the step of obtaining the current identity;
[0100] The discarding module is used to discard the simulated serial port data when the verification result of the simulated serial port data verification is invalid data.
[0101] Optionally, the simulated serial port data includes start bit information, data bit information, check bit information and stop bit information, and the execution module includes:
[0102] A check submodule, used for checking the data bit information when receiving the stop bit information;
[0103] The validity determination submodule is used to determine that the verification result of the simulated serial port data is valid data when the verification result of the data bit information is consistent with the verification bit information.
[0104] Optionally, after the first acquisition module 203, the method further includes:
[0105] A second acquisition module is used to acquire a previous identity identifier stored in an off-chip flash, where the previous identity identifier is the identity identifier of the current single-row controller identified after the last power-on;
[0106] The replacement saving module is used to replace the previous identity identifier with the current identity identifier when the current identity identifier is inconsistent with the previous identity identifier, and save it to the off-chip flash.
[0107] Optionally, after replacing the storage module, the method further includes:
[0108] A module is used to stop receiving the simulated serial port data when the next simulated serial port data reception fails, and to use the current identity identifier stored in the off-chip flash as the identity identifier of the current single-row controller;
[0109] The second receiving module is used to receive the message sent by the CAN bus based on the current identity.
[0110] Optionally, after the first obtaining module 203, the method further includes:
[0111] An identification end module, used for automatically ending identification when the current self-serial number of the current single-row controller is the self-serial number corresponding to the last single-row controller;
[0112] The continuing execution module is used to execute the step of generating new simulated serial port data based on the current identity identification when the current self-serial number of the current single-row controller is not the self-serial number corresponding to the last single-row controller.
[0113] In one example, the module in any of the above devices can be one or more integrated circuits configured to implement the above methods, such as: one or more application specific integrated circuits (ASICs), or, one or more digital signal processors (DSPs), or, one or more field programmable gate arrays (FPGAs), or a combination of at least two of these integrated circuit forms.
[0114] For another example, when the modules in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0115] Various objects such as various messages / information / equipment / network elements / systems / devices / actions / operations / processes / concepts that may appear in this application are named. It can be understood that these specific names do not constitute a limitation on the relevant objects. The names assigned may change with factors such as scenarios, contexts or usage habits. The understanding of the technical meaning of the technical terms in this application should be mainly determined from the functions and technical effects embodied / executed in the technical scheme.
[0116] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0117] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0118] Based on the same technical concept, the present application also provides an electronic device, such as Figure 4 As shown, the electronic device 300 includes a processor 301 and a memory 302 , and may further include an information input / information output (I / O) interface 303 , one or more of a communication component 304 , and a communication bus 305 .
[0119] The processor 301 is used to control the overall operation of the electronic device 300 to complete all or part of the steps in the above-mentioned method for automatically identifying the identity of a single-row controller; the memory 302 is used to store various types of data to support the operation of the electronic device 300, and these data may include, for example, instructions for any application or method used to operate on the electronic device 300, and data related to the application. The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), programmable read-only memory (Programmable Read-Only Memory, PROM), read-only memory (Read-Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0120] The I / O interface 303 provides an interface between the processor 301 and other interface modules, and the above-mentioned other interface modules can be keyboards, mice, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 304 is used to test the wired or wireless communication between the electronic device 300 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 304 can include: Wi-Fi components, Bluetooth components, NFC components.
[0121] The communication bus 305 may include a path to transmit information between the above components. The communication bus 305 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 305 may be divided into an address bus, a data bus, a control bus, etc.
[0122] The electronic device 300 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components, and is used to execute the automatic identification method of the single-row controller identity given in the above embodiment.
[0123] The electronic device 300 may include but is not limited to mobile terminals such as digital broadcast receivers, PDAs (personal digital assistants), PMPs (portable multimedia players), etc., and fixed terminals such as digital TVs, desktop computers, etc., and may also be servers, etc.
[0124] Based on the same technical concept, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for automatically identifying the identity of a single-line controller are implemented.
[0125] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0126] The terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, method, article, or apparatus.
[0127] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0128] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0129] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for automatically identifying the identity of a single-row controller, characterized in that: include: Determine whether the current identity of the current single-row controller is the identity corresponding to the first single-row controller; If the current identity identifier is not the identity identifier corresponding to the first single-row controller, then based on the input pin reserved by the current single-row controller, the analog serial port data sent by the previous single-row controller is received, the output pin reserved in the previous single-row controller is communicatively connected with the input pin of the current single-row controller, and the analog serial port data is data including the identity identifier of the previous single-row controller; Based on the simulated serial port data, obtaining the current identity; Based on the current identity, generate new simulated serial port data; Based on the output pins reserved by the current single-row controller, the new simulated serial port data is sent to the next single-row controller, and the input pins reserved in the next single-row controller are communicatively connected with the output pins of the current single-row controller.
2. The method for automatically identifying the identity of a single-row controller according to claim 1, characterized in that: The step of determining whether the current identity of the current single-row controller is the identity corresponding to the first single-row controller includes: If the reserved input pin detects a low level, a timer is started to record the holding time of the low level; If the holding time of the low level exceeds a preset first time threshold, it is determined that the current identity identifier is the identity identifier corresponding to the first controller.
3. The method for automatically identifying the identity of a single-row controller according to claim 1, characterized in that: After receiving the simulated serial port data sent by the previous single-line controller, the method further includes: Verifying the simulated serial port data to obtain a verification result; Determine whether the verification result of the simulated serial port data is valid data, and if the verification result of the simulated serial port data is valid data, execute the step of obtaining the current identity; If the verification result of the simulated serial port data verification is invalid data, the simulated serial port data is discarded.
4. The method for automatically identifying the identity of a single-row controller according to claim 3, characterized in that: The simulated serial port data includes start bit information, data bit information, check bit information and stop bit information, and the determining whether the check result of the simulated serial port data is valid data includes: If the stop bit information is received, checking the data bit information; If the verification result of the data bit information is consistent with the verification bit information, it is determined that the verification result of the simulated serial port data is valid data.
5. The method for automatically identifying the identity of a single-row controller according to claim 3, characterized in that: After obtaining the current identity, the method further includes: Obtaining a previous identity identifier stored in an off-chip flash, wherein the previous identity identifier is the identity identifier of the current single-row controller identified after the last power-on; If the current identity identifier is inconsistent with the previous identity identifier, the previous identity identifier is replaced by the current identity identifier and saved in the off-chip flash.
6. The method for automatically identifying the identity of a single-row controller according to claim 5, characterized in that: After replacing the previous identity identifier with the current identity identifier and saving it to the off-chip flash, the method further includes: If the next simulated serial port data reception fails, the simulated serial port data reception is stopped, and the current identity identifier stored in the off-chip flash is used again as the identity identifier of the current single-row controller; Based on the current identity, a message sent by the CAN bus is received.
7. The method for automatically identifying the identity of a single-row controller according to claim 1, characterized in that: After obtaining the current identity, the method further includes: If the current self-serial number of the current single-row controller is the self-serial number corresponding to the last single-row controller, the automatic identification ends; If the current self-serial number of the current single-row controller is not the self-serial number corresponding to the last single-row controller, the step of generating new simulated serial port data based on the current identity identifier is performed.
8. An automatic identification device for a single-row controller, characterized in that: include: A judgment module, used to judge whether the current identity of the current single-row controller is the identity corresponding to the first single-row controller; If the current identity identifier is not the identity identifier corresponding to the first single-row controller, the process proceeds to the first receiving module; The first receiving module is used to receive the simulated serial port data sent by the previous single-row controller based on the input pin reserved by the current single-row controller, the output pin reserved in the previous single-row controller is communicatively connected with the input pin of the current single-row controller, and the simulated serial port data is data including the identity of the previous single-row controller; A first acquisition module, configured to acquire the current identity based on the simulated serial port data; A generating module, used for generating new simulated serial port data based on the current identity identifier; The sending module is used to send the new simulated serial port data to the next single-row controller based on the output pin reserved by the current single-row controller, and the input pin reserved in the next single-row controller is communicatively connected with the output pin of the current single-row controller.
9. An electronic device, characterized in that: comprising a processor and a memory, wherein the processor is coupled to the memory; The processor is configured to execute a computer program stored in the memory, so that the electronic device executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The method comprises a computer program or an instruction, which, when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 7.
