Bus device address anomaly detection method and device, electronic device and medium
Through script scanning and storage strategy judgment, the I2C bus device address is automatically detected, which solves the problems of cumbersome operation and difficulty in locating abnormal addresses in the existing technology, improves the testing efficiency and efficiency, and achieves efficient anomaly detection.
Patent Information
- Application Number
- CN202310181748.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-21
- Publication Date
- 2024-08-23
AI Technical Summary
When the address of the slave device mounted on the I2C bus is improperly configured, the bus is locked or the device cannot be accessed normally. The existing test method is cumbersome and inefficient. Especially in the case of multiple devices, it is difficult to locate abnormal addresses and requires repeated verification. Reduced testing efficiency.
Scan the bus by setting a script to determine whether the hardware device is a channel expansion chip. Determine the storage strategy based on the judgment results. Store the device address in the result document and compare it with the bus design specification document to automatically detect abnormal addresses and reduce manual work. operation to improve testing efficiency.
It achieves efficient comparison of result documents and bus design specification documents, reduces repeated verification content, improves test efficiency, shortens the test cycle, and reduces the difficulty of locating abnormal addresses.
Smart Images

Figure CN118535394A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method, device, electronic equipment and medium for detecting anomalies of bus device addresses. Background Art
[0002] I 2 The Inter-Integrated Circuit (IC) bus is a two-wire serial bus developed by Philips that is used to connect microcontrollers and their peripherals, enabling a host device (such as a processor, microcontroller (MCU) or application-specific integrated circuit (ASIC)) to communicate with other peripheral devices on the same two-wire bus.
[0003] Currently, I 2 The number of slave devices mounted on the C bus continues to increase as the functional requirements continue to rise. 2 If the C address is not configured properly, the bus may be locked or the device may not be accessed normally. 2 The address management of slave devices on the I C bus has become an important part of hardware design. 2 The test of whether there is an abnormality in the C address is performed by hardware engineers using a bus test tool to scan the device address and manually compare the scanned device addresses to determine whether there is any situation that does not meet expectations.
[0004] However, in I 2 When there are many slave devices on the C bus, the scanning workload is large and the operation is cumbersome. In addition, it is difficult to locate the problem when an abnormal address occurs. Repeated verification is required to locate the abnormal address problem, which increases the test content and reduces the test efficiency. Summary of the invention
[0005] The present invention provides a bus device address anomaly detection method, device, equipment and storage medium, which can reduce the test content that needs to be completed by manual operation through an automated testing method, improve test efficiency and shorten the test cycle.
[0006] According to one aspect of the present invention, a method for detecting anomaly of a bus device address is provided, comprising:
[0007] Scan the bus by setting a script to obtain the device address of the hardware device mounted on the bus;
[0008] Determining whether the hardware device is a channel expansion chip according to the device address, determining a storage strategy for the device address according to the determination result, and storing the device address in a result document according to the storage strategy;
[0009] The result document is compared with the device address corresponding to the same bus in the bus design specification document, and the abnormality detection result of the bus device address is determined according to the comparison result.
[0010] Optionally, determining the storage strategy of the device address according to the judgment result includes:
[0011] In the case where the hardware device is a channel extension chip, determining the storage strategy is to read the device address corresponding to each channel under the channel extension chip, and use the channel identifier and the bus identifier as the storage identifier of the device address under the corresponding channel in the result document;
[0012] In the case that the hardware device is not a channel extension chip, the storage strategy is determined to use the bus identifier of the bus to which the hardware device belongs as the storage identifier of the device address in the result document.
[0013] The advantage of this design is that different storage methods are set for the hardware devices mounted under the channel expansion chip and the hardware devices mounted under the bus, so that after the device addresses are stored in the result document according to their respective storage strategies, the device addresses can be efficiently compared.
[0014] Optionally, storing the device address in a result document according to the storage policy includes:
[0015] In the case where the hardware device is a channel extension chip, the device address corresponding to each channel under the channel extension chip is obtained, the storage identifier is determined according to the channel identifier and bus identifier of each channel, and the device address corresponding to each channel is associated with the storage identifier and stored in the result document.
[0016] The advantage of this design is that by associating the bus identifier, channel identifier and device address, the device address of the hardware device mounted under the channel expansion chip is stored in the result document, which can ensure efficient comparison of the device address in the result document and the bus design specification, thereby improving test efficiency.
[0017] Optionally, comparing the result document with a device address corresponding to the same bus in a bus design specification document includes:
[0018] In the case where the hardware device is not a channel expansion chip, obtaining the corresponding device addresses in the result document and the bus design specification document respectively according to the bus identifier, and comparing the obtained device addresses to determine the comparison result;
[0019] In the case where the hardware device is a channel expansion chip, a storage identifier is generated based on the bus identifier and the channel identifier, and the corresponding device addresses in the result document and the bus design specification document are respectively obtained according to the storage identifier, and the obtained device addresses are compared to determine the comparison result.
[0020] The advantage of this design is that for hardware devices mounted on the bus, the bus design specification document is queried through the corresponding bus identifier to obtain the device address to be compared, and then the device address comparison is performed; for channel expansion chips, the bus design specification document is queried through the storage identifier composed of the corresponding bus identifier and channel identifier to obtain the device address to be compared, and then the device address comparison is performed, which improves the efficiency of querying the device address from the bus design specification document, thereby ensuring efficient comparison of the result document with the bus design specification document.
[0021] Optionally, determining the abnormality detection result of the bus device address according to the comparison result includes:
[0022] When the comparison result shows that the addresses are consistent, determining that the hardware device is normally connected to the bus;
[0023] When the comparison result is that the addresses are inconsistent, an abnormal hardware device with inconsistent addresses is obtained, and address abnormality prompt information is generated according to the abnormal hardware device.
[0024] The advantage of this design is that it can locate hardware devices with abnormal addresses through prompt information, avoid the problem of doubling the test content due to repeated verification of manual operation of the test tool, and improve test efficiency.
[0025] Optionally, scanning the bus by setting a script to obtain the device address of the hardware device mounted on the bus includes:
[0026] The buses are scanned one by one according to the number of buses specified in the bus design specification document to obtain the device addresses of the hardware devices mounted on each bus.
[0027] The advantage of this design is that by scanning the hardware devices bus by bus, possible scanning omissions can be manually tested to ensure test integrity.
[0028] Optionally, judging whether the hardware device is a channel expansion chip according to the device address includes:
[0029] The advantage of this design is that by judging whether the device address contains specific characters that identify the channel expansion chip, it is judged whether the device address is the channel expansion chip address, thereby improving the judgment speed of the channel expansion chip.
[0030] According to another aspect of the present invention, there is provided a bus device address abnormality detection device, comprising:
[0031] A bus scanning module is used to scan the bus by setting a script to obtain the device address of the hardware device mounted on the bus;
[0032] An address storage module, used for judging whether the hardware device is a channel expansion chip according to the device address, determining a storage strategy for the device address according to the judgment result, and storing the device address in a result document according to the storage strategy;
[0033] The address comparison module is used to compare the result document with the device address corresponding to the same bus in the bus design specification document, and determine the abnormality detection result of the bus device address according to the comparison result.
[0034] Optionally, the address storage module is specifically used for:
[0035] In the case where the hardware device is a channel extension chip, determining the storage strategy to be reading device addresses corresponding to each channel under the channel extension chip, using the channel identifier and the bus identifier as storage identifiers of the device addresses under the corresponding channels in the result document, and saving the association relationship through the result document;
[0036] In the case that the hardware device is not a channel extension chip, the storage strategy is determined to use the bus identifier of the bus to which the hardware device belongs as the storage identifier of the device address in the result document.
[0037] Optionally, the address storage module is further used for:
[0038] In the case where the hardware device is a channel extension chip, the device address corresponding to each channel under the channel extension chip is obtained, the storage identifier is determined according to the channel identifier and bus identifier of each channel, and the device address corresponding to each channel is associated with the storage identifier and stored in the result document.
[0039] Optionally, the address storage module is further used to:
[0040] It is determined whether the hardware device is a channel expansion chip according to the characters included in the device address.
[0041] Optionally, the address comparison module is specifically used for:
[0042] In the case where the hardware device is not a channel expansion chip, obtaining the corresponding device addresses in the result document and the bus design specification document respectively according to the bus identifier, and comparing the obtained device addresses to determine the comparison result;
[0043] In the case where the hardware device is a channel expansion chip, a storage identifier is generated based on the bus identifier and the channel identifier, and the corresponding device addresses in the result document and the bus design specification document are respectively obtained according to the storage identifier, and the obtained device addresses are compared to determine the comparison result.
[0044] Optionally, the address comparison module is specifically used for:
[0045] When the comparison result shows that the addresses are consistent, determining that the hardware device is normally connected to the bus;
[0046] When the comparison result is that the addresses are inconsistent, an abnormal hardware device with inconsistent addresses is obtained, and address abnormality prompt information is generated according to the abnormal hardware device.
[0047] Optionally, the bus scanning module is specifically used for:
[0048] The buses are scanned one by one according to the number of buses specified in the bus design specification document to obtain the device addresses of the hardware devices mounted on each bus.
[0049] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0050] at least one processor; and
[0051] a memory communicatively connected to the at least one processor; wherein,
[0052] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the bus device address anomaly detection method described in any embodiment of the present invention.
[0053] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the bus device address abnormality detection method described in any embodiment of the present invention when executed.
[0054] The technical solution of the embodiment of the present invention obtains the device address by setting a script to scan the bus, determines whether the hardware device is a channel expansion chip according to the device address, determines the storage strategy of the device address according to the judgment result, stores the device address in a result document according to the storage strategy, compares the result document with the device address under the same bus in the bus design specification document, obtains the abnormal detection result of the bus device address, realizes efficient comparison between the result document and the bus design specification document, solves the problem of low test efficiency caused by cumbersome operation and difficulty in locating abnormal address problems during manual operation testing, and reduces repeated verification content, improves test efficiency, and shortens the test cycle compared with the manual operation test in the prior art.
[0055] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0057] Figure 1 A flowchart of a bus device address anomaly detection method provided by an embodiment of the present invention;
[0058] Figure 2 A flowchart of another method for detecting anomaly of a bus device address provided by an embodiment of the present invention;
[0059] Figure 3 A flowchart of another method for detecting anomaly of a bus device address provided by an embodiment of the present invention;
[0060] Figure 4 A flowchart of a bus scanning method in a bus device address anomaly detection method provided by an embodiment of the present invention;
[0061] Figure 5 A schematic diagram of the structure of a device for obtaining graphics processor information provided by an embodiment of the present invention;
[0062] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0063] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0064] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0065] Figure 1 A flowchart of a bus device address abnormality detection method provided by an embodiment of the present invention. This embodiment can be applied to test I 2 The method can be performed by a bus device address anomaly detection device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device. For example, the electronic device can be a server or a server cluster.
[0066] like Figure 1 As shown, the method includes:
[0067] Step 110: Scan the bus by setting a script to obtain the device address of the hardware device mounted on the bus.
[0068] The script is an executable file written in a certain format using a specific descriptive language. In the embodiment of the present invention, the setting script is an executable file for realizing the bus scanning function.
[0069] A bus is a common communication trunk that transmits information between devices on the same circuit board. For example, a bus may include an I 2C bus, SPI (Serial Peripheral Interface) bus and PCI (Peripheral Component Interconnect) bus, etc.
[0070] The hardware devices mounted on the bus are slave devices, which communicate with the master device through the bus. Among them, the hardware devices that can be mounted on the master line can include temperature sensors, humidity sensors, fans, etc. The master device is used to schedule the bus and decide to communicate with a specific slave device at a specific time. At the same time, only one slave device can communicate with the master device, and the other slave devices are in a dormant state. Each I 2 C slave devices have an I 2 C slave device address, which is an inherent property of the slave device itself. This address is unique on the circuit board. During communication, the master device needs to know the address of the slave device, and then use the address to identify the slave device during communication. If the slave device is successfully connected to the bus, the master device can obtain the device address of the slave device by scanning the slave devices on the main line.
[0071] In some embodiments, a circuit board has multiple buses, and the number of buses is recorded through bus devices and specification documents. The buses are scanned one by one according to the number of buses specified in the bus design specification document to obtain the device addresses of the hardware devices mounted under each bus. By scanning the buses one by one according to the number of buses specified in the bus design specification document to obtain the device addresses of the hardware devices mounted under each bus, the situation of missed scanning that may occur during manual operation can be avoided, and the integrity and comprehensiveness of the test can be ensured.
[0072] S120. Determine whether the hardware device is a channel expansion chip according to the device address, determine a storage strategy for the device address according to the determination result, and store the device address in a result document according to the storage strategy.
[0073] Among them, the channel expansion chip can be used to increase I 2 C bus channels to implement chips that can mount more devices. For example, the channel expansion chip can be I 2 C Switch chip. With the help of I 2 C Switch chip can be used in limited I 2 C resources to expand enough interfaces to solve the problem of using I 2 C bus capacity issue.
[0074] The storage policy may be a policy for storing device addresses of hardware devices mounted on the channel extension chip and hardware devices mounted on the bus in the result document.
[0075] The result document may be a document storing device addresses of hardware devices mounted under the channel extension chip and hardware devices mounted under the bus according to the storage policy.
[0076] Normally, I 2 The channel expansion chip address under the I C bus is different from the ordinary hardware device address. For example, the ordinary hardware device address starts with 0x, 2 C Switch chip address starts with Ex, etc. Therefore, it is possible to determine whether the hardware device is a channel expansion chip based on the characters contained in the device address. By determining whether the device address contains specific characters that identify the channel expansion chip, it is determined whether the device address is the channel expansion chip address, which improves the speed of channel expansion chip identification.
[0077] Different device address storage strategies are pre-specified for the hardware devices mounted under the channel expansion chip and the hardware devices mounted under the bus, so that the hardware devices mounted under the channel expansion chip and the hardware devices mounted under the bus are stored in the result document according to the device address storage strategy, thereby facilitating the comparison of the device addresses in the result document and the bus design specification document. For example, the bus identifier is associated with the device address and stored in the result document. Alternatively, if a channel expansion chip is mounted under the bus, the device address needs to be read separately, and the bus identifier is associated with the storage identifier and device address determined by the channel identifier of the channel expansion chip and stored in the result document.
[0078] S130, comparing the result document with the device address corresponding to the same bus in the bus design specification document, and determining the abnormality detection result of the bus device address according to the comparison result.
[0079] The bus design specification document may be a design document that meets the bus design specification, and the bus design information on the circuit board is recorded through the bus design specification document. For example, the bus design specification document may include the number of buses, the device addresses of the hardware devices mounted on each bus, etc.
[0080] Optionally, the same bus in the result document and the bus design specification document can be determined based on the association relationship of the bus identifier. Since the device address is stored in association with the bus identifier, all device addresses under the bus can be obtained from the result document based on the bus identifier. If a channel expansion chip is mounted under the bus, the device address needs to be read separately, and the device address of the hardware device mounted under each channel of the channel expansion chip in the result document is read based on the association relationship between the bus identifier, the channel identifier of the channel expansion chip and the device address.
[0081] Exemplarily, when the hardware device is not a channel expansion chip, the corresponding device addresses in the result document and the bus design specification document are obtained according to the bus identifier, and the comparison result is determined by comparing the obtained device addresses. When the hardware device is a channel expansion chip, a storage identifier is generated based on the bus identifier and the channel identifier, and the corresponding device addresses in the result document and the bus design specification document are obtained according to the storage identifier, and the comparison result is determined by comparing the obtained device addresses.
[0082] For hardware devices mounted on the bus, the bus design specification document is queried through the corresponding bus identifier to obtain the device address to be compared, and then the device address comparison is performed. For channel expansion chips, the bus design specification document is queried through the corresponding bus identifier and channel identifier to obtain the device address to be compared, and then the device address comparison is performed. This improves the efficiency of querying device addresses from the bus design specification document, thereby ensuring efficient comparison of the result document with the bus design specification document.
[0083] When the comparison result is that the addresses are consistent, it is determined that the hardware device is normally connected to the bus; when the comparison result is that the addresses are inconsistent, an abnormal hardware device with inconsistent addresses is obtained, and address abnormality prompt information is generated according to the abnormal hardware device.
[0084] Since the addresses are consistent, it can be determined that the hardware device is successfully connected to the bus and there is no address anomaly. However, if the addresses are inconsistent, it means that there is an address anomaly problem. The hardware device with the address anomaly is located through prompt information, which avoids the problem of doubling the test content due to repeated verification of manual operation of the test tool, thereby improving the test efficiency.
[0085] The embodiment of the present invention obtains the device address by setting a script to scan the bus, determines whether the hardware device is a channel expansion chip according to the device address, determines the storage strategy of the device address according to the judgment result, stores the device address in a result document according to the storage strategy, compares the result document with the device address under the same bus in the bus design specification document, obtains the abnormal detection result of the bus device address, realizes efficient comparison between the result document and the bus design specification document, solves the problem of low test efficiency caused by cumbersome operation and difficulty in locating abnormal address problems during manual operation testing, and reduces repeated verification content, improves test efficiency, and shortens the test cycle compared with the manual operation test in the prior art.
[0086] Figure 2 This is a flowchart of another method for detecting abnormality of a bus device address provided by an embodiment of the present invention. Based on the above embodiment, this embodiment further limits the storage strategy of the device address determined according to the judgment result and the storage strategy of the device address stored in the result document. Figure 2As shown, the method includes:
[0087] S210 , scanning the bus by setting a script to obtain the device address of the hardware device mounted on the bus.
[0088] S220. Determine whether the hardware device is a channel expansion chip according to the device address. If so, execute S230; otherwise, execute S250.
[0089] S230, determining that the storage strategy is to read the device address corresponding to each channel under the channel extension chip, using the channel identifier and the bus identifier as storage identifiers of the device address under the corresponding channel in the result document, and executing S240.
[0090] Among them, the storage strategy includes: for each hardware device mounted under the bus, associating the storage bus identifier and the device address to the result document; for each channel expansion chip mounted under the bus, determining the storage identifier according to the channel identifier and bus identifier of each channel of the channel expansion chip; associating the device address of the hardware device mounted under each channel of the channel expansion chip with the storage identifier of the corresponding channel to the result document.
[0091] Exemplarily, when the hardware device is a channel extension chip, the storage strategy is determined as using the channel identifier and bus identifier of each channel under the channel extension chip as the storage identifier of the device address under the corresponding channel in the result document, and associating the storage identifier with the device address under the corresponding channel and storing it in the result document.
[0092] S240. When the hardware device is a channel extension chip, obtain the device address corresponding to each channel under the channel extension chip, determine the storage identifier according to the channel identifier and bus identifier of each channel, associate the device address corresponding to each channel with the storage identifier and store it in the result document, and execute S270.
[0093] Exemplarily, for a hardware device mounted under a channel extension chip, the corresponding storage strategy is to use the channel identifier and bus identifier of each channel under the channel extension chip as the storage identifier of the device address under the corresponding channel in the result document.
[0094] For example, the bus number is represented by i (where i=0, 1, 2, 3, ..., n, where n is the number of buses in the bus design specification document), and the channel number is the channel number of the channel extension chip, and the channel number of the channel extension chip is represented by j (where j=0, 1, 2, 3, ..., m, where m is the number of channels of the channel extension chip). For the hardware device mounted under bus bus(i), if it is determined that the hardware device is a channel extension chip according to the device address, the device address of the hardware device mounted under each channel of the channel extension chip is scanned, and the address identifier is determined as bus(ij) according to the channel number and the bus number, and the device address is associated with bus(ij) and stored in the result document.
[0095] S250, determining that the storage strategy is to use the bus identifier of the bus to which the hardware device belongs as the storage identifier of the device address in the result document, and executing S260.
[0096] Exemplarily, when the hardware device is not a channel expansion chip, the storage strategy is determined to use the bus identifier as the storage identifier, associate the bus identifier with the device address of the hardware device, and save the association relationship through the result document.
[0097] S260: When the hardware device is not a channel expansion chip, obtain a device address of the hardware device, associate the device address with a bus identifier of a corresponding bus, and store the associated address in a result document.
[0098] Exemplarily, when the hardware device mounted under the bus is not a channel expansion chip, the corresponding storage strategy is to use the bus identifier as the storage identifier of the device address in the result document.
[0099] For example, the bus number is represented by i (where i=0, 1, 2, 3, ..., n, where n is the number of buses in the bus design specification document), and the channel number is represented by j (where j=0, 1, 2, 3, ..., m, where m is the number of channels of the channel extension chip). The hardware devices mounted under bus (i) are scanned to obtain the device address. If the hardware device is determined not to be a channel extension chip according to the device address, the device address is associated with bus (i) and stored in the result document.
[0100] S270, comparing the result document with the device address corresponding to the same bus in the bus design specification document, and determining the abnormality detection result of the bus device address according to the comparison result.
[0101] It should be noted that the bus design specification document is pre-organized into a csv (Comma-Separated Values) format document to facilitate device address comparison. CSV files store tabular data (numbers and text) in plain text. Plain text means that the file is a sequence of characters and does not contain data that must be interpreted as binary numbers. CSV files consist of any number of records, separated by some kind of line break; each record consists of fields, and the separator between fields is other characters or strings, the most common of which is a comma or tab. Usually, all records have exactly the same sequence of fields. They are usually plain text files.
[0102] Normally, the device address in the bus design specification document can be stored in the form of the device address associated with bus(i), and the device address of the hardware device under the channel mounted on the channel expansion chip is stored in association with bus(ij), but i=1,2,3,...,n, where n is the number of buses in the bus design specification document. That is, bus(1) in the bus design specification document corresponds to bus(0) in the result document, and bus(2) in the bus design specification document corresponds to bus(2) in the result document. Therefore, when comparing the device addresses in the result document and the bus design specification document, for bus(i), bus(i+1) is obtained from the design specification document for comparison. Specifically, the first character corresponding to bus(i) in the result document is captured, and the second character corresponding to bus(i+1) in the bus design specification document is captured, and the first character and the second character are compared for consistency. If a channel expansion chip is encountered during the comparison, the device addresses of the hardware devices mounted under each channel of the channel expansion chip under bus(i) in the result document are compared one by one with the device addresses of the hardware devices mounted under each channel of the channel expansion chip under bus(i+1) in the bus design specification document to obtain a comparison result.
[0103] For example, the device address of the temperature sensor corresponding to bus(13) of the third channel of the channel expansion chip mounted under bus(1) in the result document needs to be compared with the device address of the temperature sensor corresponding to bus(23) of the third channel of the channel expansion chip mounted under bus(2) in the bus design specification document to obtain a comparison result.
[0104] The embodiment of the present invention associates the device address of the hardware device mounted under the bus with the bus identifier and stores it in the result document, and associates the device address of the hardware device mounted under the channel extension chip with the storage identifier determined based on the bus identifier and the channel identifier and stores it in the result document, so as to set different address storage modes for the hardware device mounted under the channel extension chip and the hardware device mounted under the bus, so that after the device addresses are stored in the result document according to the respective storage strategies, the result document can be efficiently compared with the device addresses in the bus design specification, thereby improving the test efficiency.
[0105] Figure 3 A flowchart of another method for detecting anomaly of a bus device address provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, the method includes:
[0106] S310, scanning the buses one by one according to the number of buses specified in the bus design specification document, and obtaining the device addresses of the hardware devices mounted on each bus.
[0107] For example, the device information of the hardware devices mounted on the bus is scanned by setting the script using i2c-tools. 2 C open source tool that can obtain mounted devices and device addresses, and can also read and write I2C device registers.
[0108] By setting a script to scan all buses determined by the bus design specification document, the device addresses of the hardware devices mounted on each bus are obtained. Specifically, the scanning can start from the first bus, and after obtaining the device addresses of all hardware devices mounted on the first bus, the second bus is continued to be scanned until the last first bus is scanned. It should be noted that the number of buses is determined by the bus design specification document.
[0109] S320. Determine whether the hardware device is a channel expansion chip according to the characters included in the device address. If so, execute S330; otherwise, execute S360.
[0110] S330: Determine that the storage strategy is to read the device address corresponding to each channel under the channel extension chip, and use the channel identifier and the bus identifier as storage identifiers of the device address under the corresponding channel in the result document.
[0111] S340. When the hardware device is a channel extension chip, obtain the device address corresponding to each channel under the channel extension chip, determine the storage identifier according to the channel identifier and bus identifier of each channel, and associate the device address corresponding to each channel with the storage identifier and store it in the result document.
[0112] S350. When the hardware device is a channel expansion chip, a storage identifier is generated based on the bus identifier and the channel identifier, and corresponding device addresses in the result document and the bus design specification document are respectively obtained according to the storage identifier. The obtained device addresses are compared to determine the comparison result, and S390 or S3100 is executed according to the comparison result.
[0113] S360: Determine that the storage strategy is to use the bus identifier of the bus to which the hardware device belongs as the storage identifier of the device address in the result document.
[0114] S370: When the hardware device is not a channel expansion chip, associate the bus identifier of the bus corresponding to the hardware device with the device address and store them in the result document.
[0115] S380: When the hardware device is not a channel expansion chip, obtain the corresponding device addresses in the result document and the bus design specification document according to the bus identifier, and compare the obtained device addresses to determine the comparison result.
[0116] S390: When the comparison result shows that the addresses are consistent, determine that the hardware device is normally connected to the bus.
[0117] S3100: When the comparison result is that the addresses are inconsistent, obtain an abnormal hardware device with inconsistent addresses, and generate address abnormality prompt information according to the abnormal hardware device.
[0118] Figure 4 A flowchart of a bus scanning method in a bus device address abnormality detection method provided by an embodiment of the present invention. Figure 4 As shown, all buses are scanned in the following manner to obtain the device addresses of the hardware devices mounted on each bus.
[0119] S410 , determining the total number of buses X according to the bus design specification document.
[0120] S420: When i is less than X, scan the device addresses under bus (i) to obtain the returned device addresses.
[0121] S430, judging whether a channel expansion chip is mounted on the bus according to the returned device address, if so, executing S440, otherwise executing S450.
[0122] S440. Read the device address of the hardware device mounted on the channel expansion chip.
[0123] S450. For the hardware device mounted under the channel extension chip, the device address under the channel extension chip is saved under bus(ij) in the result document.
[0124] S460. For the hardware device mounted on the bus, save the device address returned by scanning bus bus(i) to bus(i) in the result document.
[0125] It should be noted that i represents the bus number, where i=0, 1, 2, 3, ..., X, j represents the channel number of the channel extension chip mounted under the i-th bus, where j=0, 1, 2, 3, ..., m, and m is the number of channels of the channel extension chip.
[0126] S470, increase the value of i by 1, and execute S420.
[0127] In some specific examples of the present invention, the total number of buses X is determined according to the bus design specification document. Scanning starts from the first bus bus (0). Scan the device address under the first bus bus (0), and save the return address to bus (0) in the result document. In this process, if there is a channel expansion chip address in the scan result, the device address of the hardware device mounted under the channel expansion chip is read separately. For the hardware device mounted on the first channel, the returned device address is saved to bus (01) in the result file, and for the hardware device mounted on the second channel, the returned device address is saved to bus (02) in the result file, and so on, the device address of the hardware device mounted on the channel expansion chip is saved to the result file. Then, i is updated to i+1, and it is determined whether the updated i is greater than X. If so, it ends, otherwise the device address under the second bus bus (1) is scanned, and the return address is saved to bus (1) in the result document. In this process, if there is a channel expansion chip address in the scan result, the device address of the hardware device mounted under the channel expansion chip is read separately. For the hardware device mounted on the first channel, save the returned device address to bus(11) in the result file. For the hardware device mounted on the second channel, save the returned device address to bus(12) in the result file. And so on. Save the device address of the hardware device mounted on the channel expansion chip to the result file. Repeat the above process until the updated i is greater than X.
[0128] The embodiment of the present invention automatically reads the device address and compares it with the device address in the bus design specification document, and separately reads and saves the device address of the channel added by the channel expansion chip, thereby reducing the test content that needs to be completed manually, shortening the test cycle, and improving the test efficiency.
[0129] Figure 5 A schematic diagram of a device for obtaining graphics processor information provided by an embodiment of the present invention. Figure 5 As shown, the device includes: a bus scanning module 510, an address storage module 520 and an address comparison module 530. Among them,
[0130] The bus scanning module 510 is used to scan the bus by setting a script to obtain the device address of the hardware device mounted on the bus;
[0131] The address storage module 520 is used to determine whether the hardware device is a channel expansion chip according to the device address, determine a storage strategy for the device address according to the determination result, and store the device address in a result document according to the storage strategy;
[0132] The address comparison module 530 is used to compare the result document with the device address corresponding to the same bus in the bus design specification document, and determine the abnormality detection result of the bus device address according to the comparison result.
[0133] The embodiment of the present invention provides a bus device address anomaly detection device, which realizes efficient comparison between result documents and bus design specification documents, solves the problem of low test efficiency caused by cumbersome operation and difficulty in locating abnormal address problems during manual operation testing, and compared with the manual operation test of the prior art, it reduces repeated verification content, improves test efficiency, and shortens the test cycle.
[0134] Optionally, the address storage module 520 is specifically used for:
[0135] In the case where the hardware device is a channel extension chip, determining the storage strategy to be reading device addresses corresponding to each channel under the channel extension chip, using the channel identifier and the bus identifier as storage identifiers of the device addresses under the corresponding channels in the result document, and saving the association relationship through the result document;
[0136] In the case that the hardware device is not a channel extension chip, the storage strategy is determined to use the bus identifier of the bus to which the hardware device belongs as the storage identifier of the device address in the result document.
[0137] Optionally, the address storage module 520 is further configured to:
[0138] In the case where the hardware device is a channel extension chip, the device address corresponding to each channel under the channel extension chip is obtained, the storage identifier is determined according to the channel identifier and bus identifier of each channel, and the device address corresponding to each channel is associated with the storage identifier and stored in the result document.
[0139] Optionally, the address comparison module 530 is specifically used for:
[0140] In the case where the hardware device is not a channel expansion chip, obtaining the corresponding device addresses in the result document and the bus design specification document respectively according to the bus identifier, and comparing the obtained device addresses to determine the comparison result;
[0141] In the case where the hardware device is a channel expansion chip, a storage identifier is generated based on the bus identifier and the channel identifier, and the corresponding device addresses in the result document and the bus design specification document are respectively obtained according to the storage identifier, and the obtained device addresses are compared to determine the comparison result.
[0142] Optionally, the address comparison module 530 is specifically used for:
[0143] When the comparison result shows that the addresses are consistent, determining that the hardware device is normally connected to the bus;
[0144] When the comparison result is that the addresses are inconsistent, an abnormal hardware device with inconsistent addresses is obtained, and address abnormality prompt information is generated according to the abnormal hardware device.
[0145] Optionally, the bus scanning module 510 is specifically used for:
[0146] The buses are scanned one by one according to the number of buses specified in the bus design specification document to obtain the device addresses of the hardware devices mounted on each bus.
[0147] Optionally, the address storage module 520 is further configured to:
[0148] It is determined whether the hardware device is a channel expansion chip according to the characters included in the device address.
[0149] The bus device address anomaly detection device provided in the embodiment of the present invention can execute the bus device address anomaly detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0150] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 6 A schematic diagram of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0151] like Figure 6As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0152] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0153] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as an abnormality detection method for a bus device address.
[0154] In some embodiments, the method of obtaining the graphics processor information may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the method of obtaining the graphics processor information described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the abnormality detection method of the bus device address in any other appropriate manner (e.g., by means of firmware).
[0155] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0156] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0157] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0158] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0159] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0160] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0161] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0162] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for detecting abnormality of bus device addresses, It is characterized in that include: Scan the bus by setting a script to obtain the device address of the hardware device mounted on the bus; Determining whether the hardware device is a channel expansion chip according to the device address, determining a storage strategy for the device address according to the determination result, and storing the device address in a result document according to the storage strategy; The result document is compared with the device address corresponding to the same bus in the bus design specification document, and the abnormality detection result of the bus device address is determined according to the comparison result.
2. The method according to claim 1, It is characterized in that The step of determining the storage strategy of the device address according to the judgment result includes: In the case where the hardware device is a channel extension chip, determining the storage strategy is to read the device address corresponding to each channel under the channel extension chip, and use the channel identifier and the bus identifier as the storage identifier of the device address under the corresponding channel in the result document; In the case that the hardware device is not a channel extension chip, the storage strategy is determined to use the bus identifier of the bus to which the hardware device belongs as the storage identifier of the device address in the result document.
3. The method according to claim 2, It is characterized in that The storing the device address into the result document according to the storage strategy includes: In the case where the hardware device is a channel extension chip, the device address corresponding to each channel under the channel extension chip is obtained, the storage identifier is determined according to the channel identifier and bus identifier of each channel, and the device address corresponding to each channel is associated with the storage identifier and stored in the result document.
4. The method according to claim 2, It is characterized in that The comparing the result document with the device address corresponding to the same bus in the bus design specification document includes: In the case where the hardware device is not a channel expansion chip, obtaining the corresponding device addresses in the result document and the bus design specification document respectively according to the bus identifier, and comparing the obtained device addresses to determine the comparison result; In the case where the hardware device is a channel expansion chip, a storage identifier is generated based on the bus identifier and the channel identifier, and the corresponding device addresses in the result document and the bus design specification document are respectively obtained according to the storage identifier, and the obtained device addresses are compared to determine the comparison result.
5. The method according to claim 1, It is characterized in that The determining of the abnormality detection result of the bus device address according to the comparison result includes: When the comparison result shows that the addresses are consistent, determining that the hardware device is normally connected to the bus; When the comparison result is that the addresses are inconsistent, an abnormal hardware device with inconsistent addresses is obtained, and address abnormality prompt information is generated according to the abnormal hardware device.
6. The method according to claim 1, It is characterized in that The step of scanning the bus by setting a script to obtain the device address of the hardware device mounted on the bus includes: The buses are scanned one by one according to the number of buses specified in the bus design specification document to obtain the device addresses of the hardware devices mounted on each bus.
7. The method according to claim 1, It is characterized in that The determining, according to the device address, whether the hardware device is a channel expansion chip comprises: It is determined whether the hardware device is a channel expansion chip according to the characters included in the device address.
8. A bus device address anomaly detection device, It is characterized in that include: A bus scanning module is used to scan the bus by setting a script to obtain the device address of the hardware device mounted on the bus; An address storage module, used for judging whether the hardware device is a channel expansion chip according to the device address, determining a storage strategy for the device address according to the judgment result, and storing the device address in a result document according to the storage strategy; The address comparison module is used to compare the result document with the device address corresponding to the same bus in the bus design specification document, and determine the abnormality detection result of the bus device address according to the comparison result.
9. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the bus device address abnormality detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the bus device address abnormality detection method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
I2C (inter-integrated circuit) equipment control method and system
CN104899177A
Method for automatically detecting system I2C address abnormity based on sequence traversal
CN112306867A
Bus module and bus system
JP2012113481A
