Fault reporting method, device, equipment and medium
By writing fault codes in the on-chip system and sending them to the microcontroller using the error pins and buses, the problem of poor transmission of fault information is solved, and efficient transmission and timely positioning of fault information is achieved.
Patent Information
- Application Number
- CN202411957965.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-08
AI Technical Summary
When a system on chip fails, it is difficult for the prior art to effectively send fault information, resulting in difficulty in positioning the fault.
The fault code is leveled by writing the fault code to the target register in the on-chip system and sending the error signal and fault code to the microcontroller using the error pin and bus, and level sampling is performed using the preset baud rate and sampling rate to obtain the fault code.
It improves the success rate of fault information sending and ensures timely location and processing of faults.
Smart Images

Figure CN119782025A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of fault handling, and in particular to a fault reporting method, device, equipment and medium. Background Art
[0002] At present, SOC (System on Chip) usually has an error pin, which is used to send an error signal to notify the MCU (Microcontroller Unit) when a serious fault occurs. SPI (Serial Peripheral Interface), I2C (Inter-Integrated Circuit), or Ethernet are usually required to assist in sending specific fault information. However, when a serious fault occurs, the kernel may have crashed and the specific fault information cannot be sent out. The error signal sent by the error pin contains too little information, resulting in an internal fault, and cannot provide more effective information to provide a reference for locating the problem.
[0003] Therefore, how to improve the success rate of fault information sending and ensure timely positioning when a fault occurs is a problem that needs to be solved at present. Summary of the invention
[0004] In view of this, the purpose of this application is to provide a fault reporting method, device, equipment and medium, which can improve the success rate of fault information transmission and ensure timely location of problems. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a fault reporting method, which is applied to a system on chip, comprising:
[0006] In response to a fault in the system on chip, writing a fault code into a target register;
[0007] outputting an error signal based on an error pin, and sending the error signal to a microcontroller via a bus connected to the error pin;
[0008] When the preset waiting time is reached, the fault code in the target register is sent to the microcontroller through the bus at a preset baud rate, so that the microcontroller samples the level on the bus at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on the preset baud rate.
[0009] Optionally, outputting an error signal based on an error pin includes:
[0010] The error pin is set to a low level state or a high level state to output an error signal through the error pin.
[0011] Optionally, sending the fault code in the target register to the microcontroller includes:
[0012] Controlling the level state of the error pin to output a square wave signal representing a fault code based on the error pin;
[0013] The square wave signal is sent to the microcontroller via the bus so that the microcontroller can parse out a fault code based on the square wave signal.
[0014] Optionally, sending the fault code in the target register to the microcontroller includes:
[0015] Adding a check digit to the fault code;
[0016] The fault code in the target register and the check bit are sent to the microcontroller via the bus, so that the microcontroller checks the fault code based on the check bit.
[0017] In a second aspect, the present application discloses a fault reporting method, which is applied to a microcontroller, comprising:
[0018] Receiving an error signal sent by a system on chip based on a bus, wherein the bus is a bus connected to an error pin of the system on chip, and the error pin is a pin that outputs the error signal;
[0019] When the preset waiting time is reached, the level on the bus is sampled at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on a preset baud rate, the preset baud rate is the baud rate used by the on-chip system to send a fault code, and the fault code is a fault code written to the target register when a fault occurs in the on-chip system.
[0020] Optionally, sampling the level on the bus at a preset sampling rate to obtain a fault code includes:
[0021] When the number of consecutive samples that obtain the same level state reaches a preset number, the value corresponding to the level state is determined as the bit value in the fault code, wherein the preset number is determined based on the multiple relationship between the preset baud rate and the preset sampling rate.
[0022] Optionally, the receiving an error signal sent by the on-chip system based on the bus includes:
[0023] When a low level signal or a high level signal sent by the system on chip is received based on the bus, it is determined that an error signal of the system on chip is received.
[0024] In a third aspect, an embodiment of the present application discloses a fault reporting device, which is applied to a system on a chip, including:
[0025] a fault code writing module, for writing a fault code into a target register in response to a fault of the system on chip;
[0026] A fault information sending module is used to output an error signal based on an error pin, and send the error signal to a microcontroller via a bus connected to the error pin; when a preset waiting time is reached, the fault code in the target register is sent to the microcontroller via the bus and at a preset baud rate, so that the microcontroller samples the level on the bus at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on the preset baud rate.
[0027] In a fourth aspect, the present application discloses an electronic device, including a memory and a processor, wherein:
[0028] The memory is used to store the computer program;
[0029] The processor is used to execute the computer program to implement the aforementioned fault reporting method.
[0030] In a fifth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned fault reporting method when executed by a processor.
[0031] It can be seen from the above scheme that the present application provides a fault reporting method, which is applied to an on-chip system, including: in response to a fault in the on-chip system, writing a fault code into a target register; outputting an error signal based on an error pin, and sending the error signal to a microcontroller via a bus connected to the error pin; when a preset waiting time is reached, sending the fault code in the target register to the microcontroller via the bus and at a preset baud rate, so that the microcontroller samples the level on the bus at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on the preset baud rate.
[0032] It can be seen that the beneficial effects of the present application are: when a fault occurs in the on-chip system, the fault code is first written into the target register for temporary storage, and the error signal and the fault code in the target register are transmitted in sequence through the bus connected to the error pin. When sending the fault code, the fault code in the target register is sent to the microcontroller at a preset baud rate, so that the microcontroller can sample the level on the bus at a sampling rate determined based on the preset baud rate to obtain the fault code. The sending of the error signal and the fault code is realized through a bus with a preset waiting time in between. The sending of the error signal and the fault code can be completed through one bus, avoiding the problem of sending failure caused by sending the fault code through other auxiliary methods. In this way, the success rate of fault information sending can be improved to ensure timely positioning of the problem.
[0033] Correspondingly, a fault reporting device, equipment and readable storage medium provided by the present application also have the above-mentioned technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0035] Figure 1 A flow chart of a fault reporting method provided in an embodiment of the present application;
[0036] Figure 2 A flowchart of another fault reporting method provided in an embodiment of the present application;
[0037] Figure 3 A schematic diagram of a fault reporting provided in an embodiment of the present application;
[0038] Figure 4 A schematic diagram of the structure of a fault reporting device provided in an embodiment of the present application;
[0039] Figure 5 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0041] At present, SOC usually has an error pin, which is used to send an error signal to notify the MCU when a serious fault occurs. Usually, SPI, I2C, or Ethernet are also needed to assist in sending specific fault information. However, usually when a serious fault occurs, the kernel may have crashed, and the cause of the fault cannot be sent out. The error signal sent by the error pin contains too little information, resulting in an internal fault, and it is unable to provide more effective information to provide a reference for locating the problem. When the SOC fails, the MCU can only obtain the fact that the SOC has failed. It is also necessary to wait for the SOC to send specific fault information through other buses, but when a serious fault occurs, this information often cannot be successfully sent. To this end, the present application provides a fault reporting solution that can improve the success rate of fault information sending when a fault occurs and ensure timely location of the problem.
[0042] See also Figure 1 As shown, the embodiment of the present application discloses a fault reporting method, which is applied to a system on chip, including:
[0043] Step S11: In response to a fault in the system on chip, a fault code is written into a target register.
[0044] Among them, the system on chip is a system-level chip, which is a solution that highly integrates the components required by the system on a single chip. It can integrate microprocessors, analog IP (Intellectual Property) cores, digital IP cores, and memories (including RAM (Random Access Memory), ROM (Read-Only Memory), Flash, etc.) on a single chip to form a complete system. It uses very large-scale integrated circuit technology to integrate processors, analog circuits, digital circuits, memories, and software, realizing system integration, hardware and software collaborative design, and optimization. There are many application scenarios, such as the on-board SOC in vehicle scenarios.
[0045] The fault code is a code that characterizes the fault type. The embodiment of the present application can determine the number of bytes required for the fault code based on the number of fault types, and determine the fault codes corresponding to different fault types. For example, when one byte can characterize the fault code, one of the fault codes can be 0XAA. If there are many fault types and they cannot be characterized by one byte, two or more bytes can be used to characterize the fault code to ensure the uniqueness of the fault code. The embodiment of the present application can pre-establish a mapping relationship between the fault code and the fault type in order to transmit fault information, and the fault code corresponds to the fault type one by one.
[0046] The target register is a specific register assigned for transmitting the fault code. In the embodiment of the present application, the size of the target register is determined based on the number of bytes required for the fault code. For example, if the fault code is one byte, the size of the target register can be one byte. If the fault code is multiple bytes, the size of the target register can be multiple bytes, ensuring that the size of the target register is greater than or equal to the number of bytes of the fault code. In the embodiment of the present application, the fault code can be written into the target register in hardware design, triggering step S12, or the software can detect the event of the fault code being written into the register, and then executing step S12.
[0047] Step S12: outputting an error signal based on the error pin, and sending the error signal to the microcontroller via a bus connected to the error pin.
[0048] In an optional implementation, the error pin may be set to a low level state to output a low level signal through the error pin as an error signal. That is, the error signal may be a low level signal. In another optional implementation, the error pin may be set to a high level state to output a high level signal through the error pin as an error signal. That is, the error signal may be a high level signal. In some other implementations, a preset PWM (i.e., Pulse Width Modulation) signal may also be output based on the error pin as an error signal.
[0049] That is, the embodiment of the present application can output a specific signal based on the error pin to indicate the occurrence of a fault, and send the specific signal to the microcontroller through a bus connected to the error pin so that the microcontroller can be informed of the occurrence of a fault. The bus can be a single-wire bus, and data transmission between multiple devices can be achieved using one wire.
[0050] Step S13: When the preset waiting time is reached, the fault code in the target register is sent to the microcontroller through the bus and at a preset baud rate, so that the microcontroller samples the level on the bus at a preset sampling rate to obtain the fault code, wherein the preset sampling rate is a sampling rate determined based on the preset baud rate.
[0051] Among them, the preset waiting time can be a time length set according to actual needs, such as 100ms, to facilitate the distinction between error signals and fault codes.
[0052] In an optional implementation, the level state of the error pin can be controlled to output a square wave signal representing a fault code based on the error pin; the square wave signal is sent to the microcontroller through the bus so that the microcontroller can parse the fault code based on the square wave signal. A high level in the square wave can represent 1, and a low level can represent 0.
[0053] Wherein, the preset sampling rate is greater than or equal to 2 times the preset baud rate. For example, 5 times, the microcontroller performs level sampling on the bus at the preset sampling rate to obtain a fault code. When the number of the same level state obtained by continuous sampling reaches the preset number, the value corresponding to the level state is determined as the bit value in the fault code, wherein the preset number is determined based on the multiple relationship between the preset baud rate and the preset sampling rate. For example, when the number of the same level state obtained by continuous sampling reaches the preset number, the value corresponding to the level state is determined as a bit of data in the fault code. The value corresponding to the high level state is 1, and the value corresponding to the low level state is 0. The preset number is the number determined based on the multiple relationship between the preset sampling rate and the preset baud rate. For example, the preset sampling rate is equal to 5 times the preset baud rate, and 5 high levels are continuously collected, then a bit value of the fault code is obtained, which is 1. In this way, the fault code can be determined during the sampling process. In another optional implementation, the level sampling can be performed first, and the fault code can be parsed after obtaining the sampling signal corresponding to the complete fault code. After the fault code is obtained, the fault type corresponding to the fault code is determined based on the pre-established mapping relationship between the fault code and the fault type, and the problem is then located.
[0054] In an optional implementation, the embodiment of the present application can also add a check bit to the fault code; the fault code in the target register and the check bit are sent to the microcontroller via the bus, so that the microcontroller verifies the fault code based on the check bit. In this way, the integrity and accuracy of the fault code are checked by the check bit, and when a fault code error is received, recovery based on the check bit can improve the reliability of fault information transmission.
[0055] It can be seen that in the embodiment of the present application, when a fault occurs in the on-chip system, the fault code is first written into the target register for temporary storage, and the error signal and the fault code in the target register are transmitted in sequence through the bus connected to the error pin. When sending the fault code, the fault code in the target register is sent to the microcontroller at a preset baud rate, so that the microcontroller can sample the level on the bus at a sampling rate determined based on the preset baud rate to obtain the fault code. The sending of the error signal and the fault code is realized through one bus with a preset waiting time in between. The sending of the error signal and the fault code can be completed through one bus, avoiding the problem of sending failure caused by sending the fault code through other auxiliary methods. In this way, the success rate of sending fault information can be improved to ensure timely positioning of the problem.
[0056] See also Figure 2 As shown, the embodiment of the present application discloses a fault reporting method, which is applied to a microcontroller, including:
[0057] Step S21: receiving an error signal sent by the system on chip based on a bus, wherein the bus is a bus connected to an error pin of the system on chip, and the error pin is a pin that outputs the error signal.
[0058] The error signal is a signal of a specific mode, indicating that a fault has occurred, for example, it can be a low level signal, a high level signal, or a preset PWM signal. The bus can be a single-line bus.
[0059] In an optional implementation, when a low-level signal or a high-level signal sent by a system on chip is received based on the bus, it is determined that an error signal of the system on chip is received.
[0060] Step S22: When the preset waiting time is reached, the level on the bus is sampled at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on a preset baud rate, the preset baud rate is the baud rate used by the on-chip system to send a fault code, and the fault code is a fault code written into the target register when a fault occurs in the on-chip system.
[0061] In this embodiment, the level sampling on the bus can be performed at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on a preset baud rate, and the preset baud rate is the baud rate used by the on-chip system to send the fault code.
[0062] Wherein, the preset waiting time can be a time length set in combination with actual needs, such as 100ms, which is convenient for distinguishing error signals from fault codes. In the embodiment of the present application, when the preset waiting time is reached, the level sampling on the bus is performed at a preset sampling rate to obtain a fault code. Wherein, the preset sampling rate is greater than or equal to 2 times the preset baud rate. For example, the preset sampling rate is 5 times the preset baud rate, and the microcontroller performs level sampling on the bus at the preset sampling rate to obtain a fault code. The fault code can be a square wave signal representing the fault code based on the error pin output. Wherein, the high level in the square wave can represent 1, and the low level can represent 0. For example, the fault code is 0XAA, and 10101010 is obtained, which is the fault code.
[0063] In an optional embodiment, when the number of the same level state obtained by continuous sampling reaches a preset number, the value corresponding to the level state is determined as the bit value in the fault code, wherein the preset number is determined based on the multiple relationship between the preset baud rate and the preset sampling rate. That is, when the number of the same level state obtained by continuous sampling reaches a preset number, the value corresponding to the level state is determined as a bit of data in the fault code. The preset number is a number determined based on the multiple relationship between the preset sampling rate and the preset baud rate. For example, the preset sampling rate is equal to 5 times the preset baud rate, and 5 high levels are collected continuously, then a bit value of the fault code is obtained, which is 1. In this way, the fault code can be determined during the sampling process.
[0064] In another optional implementation, level sampling may be performed first to obtain a sampling signal corresponding to the complete fault code and then the fault code may be analyzed.
[0065] Furthermore, in an optional implementation, the fault code can be checked based on the check bit, for example, the check bit is sent after the fault code, and the receipt of the check bit indicates that the fault code is complete. In addition, the fault code can be checked for correctness based on the check bit, and when the fault code is found to be wrong, the fault code is corrected based on the check bit.
[0066] It can be seen that the embodiment of the present application is based on the bus receiving the error signal sent by the on-chip system, and when the preset waiting time is reached, the fault code in the target register sent by the bus is received. The bus connected to the error pin transmits the error signal and the fault code in the target register in sequence, and the microcontroller samples the level on the bus according to the sampling rate determined based on the preset baud rate of sending the fault code, obtains the fault code, and realizes the transmission of the error signal and the fault code through a bus, with a preset waiting time in between, and the transmission of the error signal and the fault code can be completed through a bus, avoiding the problem of transmission failure caused by sending the fault code through other auxiliary methods. In this way, the success rate of fault information transmission can be improved and the problem of timely positioning can be guaranteed.
[0067] Furthermore, an embodiment of the present application discloses a fault reporting system, including a system on chip and a microcontroller, wherein the system on chip is used to: write a fault code into a target register in response to a fault in the system on chip; output an error signal based on an error pin, and send the error signal to the microcontroller via a bus connected to the error pin; and when a preset waiting time is reached, send the fault code in the target register to the microcontroller via the bus.
[0068] A microcontroller is used to receive an error signal sent by a system on chip based on a bus, wherein the bus is a bus connected to an error pin of the system on chip, and the error pin is a pin that outputs the error signal; when a preset waiting time is reached, a fault code in a target register sent by the bus is received; wherein the fault code is a fault code written into the target register when a fault occurs in the system on chip.
[0069] For example, see Figure 3 As shown, Figure 3 A fault reporting schematic diagram provided for an embodiment of the present application. When a fault occurs in the SOC, the error code is written into a specific register, the SOC sets the error pin low, and after the MCU detects the error pin, it waits for an agreed time, such as 100ms, and then the SOC sends the error code at a fixed baud rate. The MCU then samples the level on the bus at a 5x sampling rate and confirms that the error code value is 0xAA. The schematic diagram demonstrates the case where a single byte is used as a fault code, and the fault code can also be represented by multiple bytes.
[0070] It can be seen that the embodiment of the present application proposes a chip design scheme to optimize the reporting logic of the error pin. When a fault occurs, the program quickly writes the fault code into a register. After the error pin event is triggered, the fault code can be sent to the external MCU through the error pin in a single-wire bus. The MCU does not need to obtain the specific fault code through an additional bus, which can greatly improve the efficiency and success rate of error code transmission. When a verification failure occurs in the SOC and it cannot be sent through Ethernet or other buses. This design can greatly increase the probability of successful fault code acquisition. The sending of the error pin is the sending of the error signal through the error pin.
[0071] In this way, the error pin and fault code transmission are combined into one bus, which improves the efficiency of MCU in obtaining faults. One bus can complete the transmission of error pin and error code, and improves the success rate of error code transmission. When a serious fault occurs in the SOC, when sending the error pin, there is no need to send the fault information through another bus, which avoids the problem that another bus cannot send successfully. When a fault occurs, it only needs to write a register to realize the transmission of error pin and error code, which greatly improves the success rate of error code transmission.
[0072] For further information, see Figure 4 As shown, the embodiment of the present application discloses a fault reporting device, which is applied to a system on a chip, including:
[0073] A fault code writing module 11 is used to write a fault code into a target register in response to a fault of the system on chip;
[0074] The fault information sending module 12 is used to output an error signal based on an error pin, and send the error signal to the microcontroller through a bus connected to the error pin; when a preset waiting time is reached, the fault code in the target register is sent to the microcontroller through the bus and at a preset baud rate, so that the microcontroller samples the level on the bus at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on the preset baud rate.
[0075] In an optional implementation, the fault information sending module may be used to set the error pin to a low level state or a high level state, so as to output an error signal through the error pin.
[0076] In an optional embodiment, the fault information sending module can be used to control the level state of the error pin to output a square wave signal representing the fault code based on the error pin; and send the square wave signal to the microcontroller through the bus so that the microcontroller can parse the fault code based on the square wave signal.
[0077] In an optional implementation, the fault information sending module can be used to add a check bit to the fault code; send the fault code in the target register and the check bit to the microcontroller via the bus, so that the microcontroller checks the fault code based on the check bit.
[0078] It can be seen that in the embodiment of the present application, when a fault occurs in the on-chip system, the fault code is first written into the target register for temporary storage, and the error signal and the fault code in the target register are transmitted in sequence through the bus connected to the error pin. When sending the fault code, the fault code in the target register is sent to the microcontroller at a preset baud rate, so that the microcontroller can sample the level on the bus at a sampling rate determined based on the preset baud rate to obtain the fault code. The sending of the error signal and the fault code is realized through one bus with a preset waiting time in between. The sending of the error signal and the fault code can be completed through one bus, avoiding the problem of sending failure caused by sending the fault code through other auxiliary methods. In this way, the success rate of sending fault information can be improved to ensure timely positioning of the problem.
[0079] Furthermore, the embodiment of the present application discloses a fault reporting device, which is applied to a microcontroller, comprising:
[0080] An error signal receiving module, used for receiving an error signal sent by a system on chip based on a bus, wherein the bus is a bus connected to an error pin of the system on chip, and the error pin is a pin that outputs the error signal;
[0081] A fault code receiving module is used to sample the level on the bus at a preset sampling rate to obtain a fault code when a preset waiting time is reached, wherein the preset sampling rate is a sampling rate determined based on a preset baud rate, the preset baud rate is the baud rate used by the on-chip system to send the fault code, and the fault code is the fault code written into the target register when a fault occurs in the on-chip system.
[0082] It can be seen that the embodiment of the present application is based on the bus receiving the error signal sent by the on-chip system, and when the preset waiting time is reached, the fault code in the target register sent by the bus is received. The bus connected to the error pin transmits the error signal and the fault code in the target register in sequence, and the microcontroller samples the level on the bus according to the sampling rate determined based on the preset baud rate of sending the fault code, obtains the fault code, and realizes the transmission of the error signal and the fault code through a bus, with a preset waiting time in between, and the transmission of the error signal and the fault code can be completed through a bus, avoiding the problem of transmission failure caused by sending the fault code through other auxiliary methods. In this way, the success rate of fault information transmission can be improved and the problem of timely positioning can be guaranteed.
[0083] Furthermore, an embodiment of the present application discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the fault reporting method disclosed in the aforementioned embodiment.
[0084] For the specific process of the above fault reporting method, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.
[0085] See also Figure 5 As shown, an embodiment of the present application discloses an electronic device 20, including a processor 21 and a memory 22; wherein the memory 22 is used to store a computer program; the processor 21 is used to execute the computer program, the fault reporting method disclosed in the above embodiment.
[0086] For the specific process of the above fault reporting method, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.
[0087] Furthermore, the memory 22 as a carrier for storing resources may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method may be temporary storage or permanent storage.
[0088] In addition, the electronic device 20 also includes a power supply 23, a communication interface 24, an input / output interface 25 and a communication bus 26; wherein the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input / output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0089] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the fault reporting method disclosed in the aforementioned embodiment.
[0090] For the specific process of the above fault reporting method, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.
[0091] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0092] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0093] The fault reporting method, device, equipment and medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A fault reporting method, characterized in that: Applications in system-on-chip, including: In response to a fault in the system on chip, writing a fault code into a target register; outputting an error signal based on an error pin, and sending the error signal to a microcontroller via a bus connected to the error pin; When the preset waiting time is reached, the fault code in the target register is sent to the microcontroller through the bus at a preset baud rate, so that the microcontroller samples the level on the bus at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on the preset baud rate.
2. The fault reporting method according to claim 1, characterized in that: The outputting an error signal based on an error pin comprises: The error pin is set to a low level state or a high level state to output an error signal through the error pin.
3. The fault reporting method according to claim 1, characterized in that: Sending the fault code in the target register to the microcontroller includes: Controlling the level state of the error pin to output a square wave signal representing a fault code based on the error pin; The square wave signal is sent to the microcontroller via the bus so that the microcontroller can parse out a fault code based on the square wave signal.
4. The fault reporting method according to any one of claims 1 to 3, characterized in that: Sending the fault code in the target register to the microcontroller comprises: Adding a check digit to the fault code; The fault code in the target register and the check bit are sent to the microcontroller via the bus, so that the microcontroller checks the fault code based on the check bit.
5. A fault reporting method, characterized in that: Applications in microcontrollers, including: Receiving an error signal sent by a system on chip based on a bus, wherein the bus is a bus connected to an error pin of the system on chip, and the error pin is a pin that outputs the error signal; When the preset waiting time is reached, the level on the bus is sampled at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on a preset baud rate, the preset baud rate is the baud rate used by the on-chip system to send a fault code, and the fault code is a fault code written to the target register when a fault occurs in the on-chip system.
6. The fault reporting method according to claim 5, characterized in that: The step of sampling the level on the bus at a preset sampling rate to obtain a fault code includes: When the number of consecutive samples that obtain the same level state reaches a preset number, the value corresponding to the level state is determined as the bit value in the fault code, wherein the preset number is determined based on the multiple relationship between the preset baud rate and the preset sampling rate.
7. The fault reporting method according to claim 5, characterized in that: The method of receiving an error signal sent by the on-chip system based on the bus includes: When a low level signal or a high level signal sent by the system on chip is received based on the bus, it is determined that an error signal of the system on chip is received.
8. A fault reporting device, characterized in that: Applications in system-on-chip, including: a fault code writing module, for writing a fault code into a target register in response to a fault of the system on chip; A fault information sending module is used to output an error signal based on an error pin, and send the error signal to a microcontroller via a bus connected to the error pin; when a preset waiting time is reached, the fault code in the target register is sent to the microcontroller via the bus and at a preset baud rate, so that the microcontroller samples the level on the bus at a preset sampling rate to obtain a fault code, wherein the preset sampling rate is a sampling rate determined based on the preset baud rate.
9. An electronic device, characterized in that: comprising a memory and a processor, wherein: The memory is used to store the computer program; The processor is used to execute the computer program to implement the fault reporting method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store a computer program, wherein when the computer program is executed by a processor, the fault reporting method according to any one of claims 1 to 7 is implemented.