Method and apparatus for performing self-diagnostics in a microcontroller

The described method and apparatus for self-diagnostics in microcontrollers address resource and time constraints by autonomously switching peripheral devices using context switching circuitry, enhancing reliability and efficiency in microcontroller diagnostics.

WO2025222023A2PCT designated stage Publication Date: 2025-10-23MICROCHIP TECHNOLOGY INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/US2025/025198
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-04-17
Filing Date
2025-04-17
Publication Date
2025-10-23

AI Technical Summary

Technical Problem

Existing self-diagnostics in microcontrollers are resource-intensive, consuming CPU and memory resources, and are time-sensitive, requiring real-time performance, which complicates their implementation in Functional Safety applications.

Method used

A method and apparatus utilizing hardware components and control logic for self-diagnostics in microcontrollers, employing a context switching circuitry to autonomously switch peripheral devices between diagnostic settings without CPU intervention, using a multiplexer, registers, and a timer to manage trigger signals.

Benefits of technology

Reduces resource consumption, improves time performance, and enhances real-time reliability of self-diagnostics in microcontrollers, allowing for more frequent testing without direct memory access (DMA) and additional registers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000017_0000
    Figure 00000017_0000
  • Figure 00000018_0000
    Figure 00000018_0000
  • Figure 00000019_0000
    Figure 00000019_0000
Patent Text Reader

Abstract

An apparatus for performing self-diagnostics in a microcontroller is provided. The apparatus may include one or more registers to store one or more diagnostic settings, a context switching circuitry to select a diagnostic setting from the one or more diagnostic settings based on a trigger signal, and a peripheral device autonomously switched to the selected diagnostic setting by the context switching circuitry.
Need to check novelty before this filing date? Find Prior Art

Description

METHOD AND APPARATUS FOR PERFORMING SELF-DIAGNOSTICS IN A MICROCONTROLLERCROSS-REFERENCE TO RELATED APPLICATION

[0001] The present application claims priority from U.S. Non-Provisional Patent Application No.: 19 / 181,748 filed on April 17, 2025, and U.S. Provisional Patent Application No. 63 / 635,743 filed on April 18, 2024, which is incorporated herein by reference in its entirety.TECHNICAL FIELD

[0002] The present disclosure relates generally to microcontrollers, and more specifically to a method and apparatus for performing self-diagnostics in a microcontroller.SUMMARY

[0003] According to an aspect of one or more examples, there is provided a method for performing self-diagnostics in a microcontroller. The method may include storing one or more diagnostic settings in one or more registers, selecting a diagnostic setting from the one or more diagnostic settings and autonomously switching a peripheral device of the microcontroller to the selected diagnostic setting using a context switching circuitry.

[0004] The one or more diagnostic settings may define one or more parameters for a respective diagnostic test. The peripheral device may be at least one of an analog-to-digital converter (ADC), an analog comparator (AC), a digital-to-analog converter (DAC), an operational amplifier, a programmable ramp generator and a zero cross detector, though other types of peripheral devices may be used. The peripheral device may receive the one or more diagnostic settings stored in the one or more registers through a multiplexer. The method may include sending a trigger signal using a timer to the context switching circuitry to initiate the autonomous switching of the peripheral device to the selected diagnostic setting. The method may include generating atrigger signal using an interconnect system for the context switching circuitry. The interconnect system may generate the trigger signal based on a predetermined event associated to the peripheral device. The predetermined event may include at least one of reaching a threshold value and encountering an error condition.

[0005] According to an aspect of one or more examples, there is provided an apparatus for performing self-diagnostics in a microcontroller. The apparatus may include one or more registers to store one or more diagnostic settings, a context switching circuitry to select a diagnostic setting from the one or more diagnostic settings based on a trigger signal and a peripheral device autonomously switched to the selected diagnostic setting by the context switching circuitry.

[0006] The one or more diagnostic settings may define one or more parameters for a respective diagnostic test. The peripheral device may be at least one of an analog-to-digital converter (ADC), an analog comparator (AC), a digital-to-analog converter (DAC), an operational amplifier, a programmable ramp generator and a zero cross detector, though other types of peripheral devices may be used. The apparatus may include a multiplexer to provide the one or more diagnostic settings stored in the one or more registers to the peripheral device based on a selection signal from the context switching circuitry. The apparatus may include a timer to send the trigger signal to the context switching circuitry. The apparatus may include an interconnect system to generate the trigger signal based on a predetermined event associated to the peripheral device. The predetermined event may include at least one of reaching a threshold value and encountering an error condition.

[0007] According to an aspect of one or more examples, there is provided a lockstep ADC system, which may include a first analog-to-digital (ADC) converter to receive a first analog signal from a first sensor and a second analog signal from a second sensor, a second ADC toreceive the first analog signal and the second analog signal, and a context switching circuitry to select a diagnostic setting from a plurality of diagnostic settings for the first and second ADCs to use in a self-diagnostic test. The lockstep ADC system may include a multiplexer to receive the plurality of diagnostic settings, and output the selected diagnostic setting to the first and second ADCs based on a selection signal generated by the context switching circuitry. The context switching circuitry may generate the selection signal in response to a trigger signal. The trigger signal may be provided by a timer.

[0008] According to an aspect of one or more examples, there is provided a selfdiagnostic system, which may include an analog-to-digital converter (ADC) to receive an analog signal and output a digital signal, one or more registers to store one or more diagnostic settings, a multiplexer to receive a plurality of analog input signals and output the analog signal to the ADC, and a timer to provide a start diagnostic signal to the ADC. The ADC may select a diagnostic setting from the one or more diagnostic settings and perform a self-diagnostic test in response to the start diagnostic signal. The ADC may set a failure flag in response to detecting a failure in the self-diagnostic test. The self-diagnostic system may include a processor to transmit a start conversion signal to cause the ADC to convert the analog signal into the output signal. The timer may provide the start diagnostic signal independently of the processor.BRIEF DESCRIPTION OF DRAWINGS

[0009] FIG. 1 shows a block diagram illustrating an apparatus to perform self-diagnostics in a microcontroller according to one or more examples.

[0010] FIG. 2 shows a block diagram illustrating a lockstep ADC system with a context switching circuitry according to one or more examples.

[0011] FIG. 3 shows a block diagram illustrating a system with an analog-to-digital converter (ADC) for self-diagnostics according to one or more examples.

[0012] FIG. 4 shows a block diagram illustrating a system with a plurality of peripheral devices according to one or more examples.

[0013] FIG. 5 shows a block diagram illustrating a method to perform self-diagnostics in a microcontroller according to one or more examples.DETAILED DESCRIPTION OF VARIOUS EXAMPLES

[0014] Reference will now be made in detail to the following various examples, which are illustrated in the accompanying drawings, wherein like reference numerals refer to like elements throughout. The following examples may be embodied in various forms without being limited to the examples set forth herein.

[0015] In systems used in Functional Safety (FuSa) applications, self-testing is often used to verify system reliability. However, self-tests may be resource-intensive, consuming CPU and / or memory resources from the microcontroller. For example, in testing an analog-to-digital converter (ADC) and a digital-to-analog converter (DAC), the CPU may need to record the current register configuration of both peripherals to restore them after performing the self-test, configure both peripherals for the self-test, run the test, reconfigure the DAC to test additional values if needed, compare the values to the expected values in software, and restore the peripheral configurations after testing is completed by reading the recorded configurations and writing the applicable registers. Moreover, the self-testing is time sensitive and often has to be performed in real-time. Therefore, there is a need for a method and apparatus for performing self-diagnostics that may reduce the use of limited processor and memory resources, improve time performance and real-time reliability, and increase the frequency of such self-diagnostics.

[0016] FIG. 1 shows a block diagram illustrating an apparatus 100 to perform selfdiagnostics in a microcontroller according to one or more examples. The apparatus 100 may leverage a combination of hardware components and control logic, to perform the self-diagnostics in the microcontroller. The apparatus 100 may include a peripheral device 102, a multiplexer 104, one or more registers 106, a context switching circuitry 108 and a timer 110.

[0017] The peripheral device 102 may be at least one of an anal og-to-digi tai converter (ADC), an analog comparator (AC), a digital-to-analog converter (DAC), an operational amplifier, a programmable ramp generator, a zero cross detector and the like. In one or more examples, a single peripheral device may be used in the apparatus 100. However, one of ordinary skill in the art will understand that any number of peripheral devices may be used within the apparatus 100. The peripheral device 102 may act as an interface between the microcontroller and one or more external systems. The peripheral device 102 may process at least one of one or more analog signals and one or more digital signals received from one or more sensors, one or more actuators, or one or more external devices. During the self-diagnostics, the peripheral device 102 may interact with the context switching circuitry 108 of the apparatus 100.

[0018] The multiplexer 104 may be a digital circuit that acts as a programmable selector. The multiplexer 104 may include one or more input lines and one or more output lines, though in the example of FIG. 1, the multiplexer 104 includes one output line. The one or more input lines may carry a specific diagnostic setting for the peripheral device 102. The multiplexer 104 may be operatively coupled with the context switching circuitry 108 and the one or more registers 106. The output line of the multiplexer 104 may be operatively coupled with the peripheral device 102. The multiplexer 104 may route a selected diagnostic setting from a specific input line connected to the corresponding register of the one or more registers 106 to the peripheral device 102 throughthe output line. The multiplexer 104 is operatively coupled with the context switching circuitry 108 and may transmit one or more selection signals to the multiplexer 104 to enable logical selection of the specific diagnostic setting for the peripheral device 102 from the one or more diagnostic settings, facilitating the self-diagnostics.

[0019] The one or more registers 106 may store one or more diagnostic settings. In one or more examples, the one or more diagnostic settings stored in the one or more registers 106 may be hard coded, configurable, or some combination of the two. The one or more diagnostic settings may define one or more parameters for a respective diagnostic test. The one or more parameters may include one or more threshold values, one or more reference values, one or more calibration parameters, one or more test parameters, one or more error handling settings and the like. The one or more calibration parameters may include one or more offset adjustments, one or more gain settings, one or more calibration coefficients and the like. The one or more test parameters may include a test duration, one or more sampling rates, a signal resolution and the like.

[0020] The context switching circuitry 108 may orchestrate the self-diagnostics of the peripheral device 102, by facilitating autonomous switching between the one or more diagnostic settings stored in the one or more registers 106 without CPU intervention. In one or more examples, the CPU may trigger the context switching circuitry 108 to autonomously switch between the one or more diagnostic settings stored in the one or more registers 106. The context switching circuitry 108 may continuously monitor a trigger signal that initiates the self-diagnostics. The context switching circuitry 108 may receive the trigger signal from the timer 110 for the self-diagnostics. In one or more examples, the timer 110 may be programmed with specific intervals to periodically test the peripheral device 102 by sending the trigger signal to the context switching circuitry 108.

[0021] The context switching circuitry 108 may be operatively coupled with an interconnect system (not shown) to generate the trigger signal with or without the CPU intervention. The interconnect system may be an alternative to the timer 110. In one or more examples, the interconnect system may allow one or more peripheral devices to act as generators or users on an event channel. The generator peripheral, such as a timer, a universal synchronous asynchronous receiver transmitter, an analog-to-digital converter and the like, may assert the trigger signal upon a specific event (e.g., timeout, completion of transmission, completion of conversion, and the like). The user peripheral may receive the trigger signal and initiate the context switching circuitry 108. The interconnect system may generate the trigger signal based on a predetermined event associated with the peripheral device 102. The predetermined event may include at least one of reaching a threshold value and encountering an error condition. When using the interconnect system, the context switching circuitry 108 may interpret the predetermined event transmitted through the interconnect system as the trigger signal for the self-diagnostics.

[0022] The context switching circuitry 108 may select a diagnostic setting from the one or more diagnostic settings based on the trigger signal. The peripheral device 102 may be autonomously switched to the selected diagnostic setting by the context switching circuitry 108. By using the context switching circuitry 108 to autonomously switch between the one or more diagnostic settings, the microcontroller may not need a direct memory access (DMA) and one or more additional registers. The context switching circuitry 108 may provide a combination of flexibility and autonomy within the microcontroller for the self-diagnostics. In one or more examples, the microcontroller may be an 8-bit microcontroller. However, one of ordinary skill in the art will understand that any resolution microcontroller may be used.

[0023] FIG. 2 shows a block diagram illustrating a lockstep ADC system 200 with a context switching circuitry 216 according to one or more examples. The lockstep ADC system 200 may include a first sensor 202, a second sensor 204, a first analog-to-digital converter (ADC) 206, a second ADC 208, a multiplexer (MUX 210), one or more first registers 212, one or more second registers 214, the context switching circuitry 216, a CPU 218, a timer 220, a first comparator 222 and a second comparator 224.

[0024] The first sensor 202 and the second sensor 204 may provide analog signals to the first ADC 206 and the second ADC 208. The first ADC 206 and the second ADC 208 may perform conversion processes concurrently on the same analog signals from the first sensor 202 and the second sensor 204 into digital format. The first ADC 206 and the second ADC 208 may operate in parallel, processing the same analog signals. The first ADC 206 may output the digital format of the analog signals from the first sensor 202 and the second sensor 204 to the first comparator 222, which may compare the digital signal corresponding to the first sensor 202 and the digital signal corresponding to the second sensor 204. The second ADC 208 may output the digital format of the analog signals from the first sensor 202 and the second sensor 204 to the second comparator 224, which may compare the digital signal corresponding to the first sensor 202 and the digital signal corresponding to the second sensor 204. The first and second comparators 222 and 224 may output a diagnostic failure signal in response to the comparison. For example, if the digital signals corresponding to the first and second sensors 202 and 204 do not match, or differ by more than a predetermined threshold, the comparators 222 and 224 may output diagnostic failure signals. According to various examples, the result of the comparison conducted by the first comparator 222 may be compared to the result of the comparison conducted by the second comparator 224 to determine whether the first and second ADCs 206 and 208, and the first and second comparators222 and 224, are functioning properly. According to various examples, the first and second ADCs 206 and 208 may convert only one of the input analog signals from the first sensor 202 and the second sensor 204 to the digital format. The first and second comparators 222 and 224 may compare the digital signal to a reference value to determine whether the first or second sensor 202 or 204, or the first or second ADC 206 and 208, are functioning properly.

[0025] The multiplexer 210 may send a shared diagnostic setting from the one or more first registers 212 and the one or more second registers 214 to the first ADC 206 and the second ADC 208 simultaneously. Using the shared diagnostic setting during the self-diagnostics in the lockstep ADC system 200, may ensure that the first ADC 206 and the second ADC 208 are subjected to the same conditions, facilitating reliable comparison of results. The one or more first registers 212 may store one or more first diagnostic settings associated with the first ADC 206. The one or more second registers 214 may store one or more second diagnostic settings associated with the second ADC 208.

[0026] The context switching circuitry 216 may select a diagnostic setting from at least one of the one or more first registers 212 and the one or more second registers 214 based on a trigger signal generated by the CPU 218 for the self-diagnostics. The context switching circuitry 216 may enable the multiplexer 210 to share the selected diagnostic setting between the first ADC 206 and the second ADC 208. The context switching circuitry 216 may autonomously switch the first ADC 206 and the second ADC 208 to the selected diagnostic setting without intervention of the CPU 218. The timer 220 may send the trigger signal generated by the CPU 218 to the context switching circuitry 216 to periodically test the first ADC 206 and the second ADC 208. In the lockstep ADC system 200, the one or more first registers 212 and the one or more second registers214 may be shared between the first ADC 206 and the second ADC 208. The lockstep ADC system200 may not need a direct memory access (DMA) and one or more additional registers.

[0027] FIG. 3 shows a block diagram illustrating a system 300 with an analog-to-digital converter (ADC) 304 for self-diagnostics according to one or more examples. The system 300 may be designed for low configurability and high autonomy. The system may include a multiplexer 302, the ADC 304, one or more registers 306, one or more diagnostic settings 308, a result register 310, a CPU 312 and a timer 314. The multiplexer 302 may manage a plurality of analog input signals from a plurality of pins. The multiplexer 302 may route one of the plurality of analog input signals to the ADC 304. The ADC 304 coverts the analog input signals into digital representations based on a start conversion signal from the CPU 312. The digital representations may be stored in the result register 310. The ADC 304 may perform the self-diagnostics when a start diagnostic signal is received from the timer 314. During the self-diagnostics, one of the one or more diagnostic settings 308 stored in the one or more registers 306 may be selected based on the start diagnostic signal to the ADC 304 from the timer 314. In one or more examples, the one or more diagnostic settings 308 may be hardware defined diagnostic settings. The ADC 304 may set a diagnostic status flag for a failure.

[0028] According to one or more examples, the ADC 304 may receive analog input signals from a touch sensor, and convert the received analog input signals into digital signals. The ADC 304 may be used for self-diagnostic testing when the ADC 304 is not being used for touch sensor data. The ADC 304 may use one or more diagnostic settings 308 when in a self-diagnostic mode, and may revert to a different set of settings when being used for touch sensor data.

[0029] FIG. 4 shows a block diagram illustrating a system 400 with a plurality of peripheral devices according to one or more examples. The system 400 may include the pluralityof peripheral devices, a plurality of diagnostic settings and a plurality of enable signals. The plurality of peripheral devices may include an analog comparator (AC) 402, a digital-to-analog converter (DAC) 404 and an analog-to-digital converter (ADC) 406. In one or more examples, the ADC 406 and the DAC 404 may be set up to test one another using a diagnostic setting 2 from the plurality of diagnostic settings when an enable signal from the plurality of enable signals for the diagnostic setting 2 is received. The plurality of diagnostic settings may be hard coded, configurable, or some combination of the two. The plurality of enable signals may be operatively coupled to one or more interconnect systems.

[0030] FIG. 5 shows a flowchart 500 illustrating a method to perform self-diagnostics in a microcontroller according to one or more examples. It may be noted that in order to explain the method operations of the flowchart 500, references will be made to the elements explained in FIG. 1.

[0031] The flowchart 500 starts at operation 502. At operation 504, the method may include storing the one or more diagnostic settings in the one or more registers 106 of the microcontroller. At operation 506, the method may include selecting a diagnostic setting from the one or more diagnostic settings based on a trigger signal. At operation 508, the method may include autonomously switching the peripheral device 102 of the microcontroller to the selected diagnostic setting using the context switching circuitry 108.

[0032] The flowchart 500 terminates at operation 510. It may be noted that the flowchart500 is explained to have above stated process operations; however, those skilled in the art would appreciate that the flowchart 500 may have more / less number of process operations which may enable all the above stated examples of the present disclosure.

[0033] Various examples have been disclosed herein, in connection with the above description and the drawings. It will be understood that it would be unduly repetitious to literally describe and illustrate every combination and subcombination of these examples. Accordingly, all examples can be combined in any way and / or combination, and the present specification, including the drawings, shall be construed to constitute a complete written description of all combinations and subcombinations of these examples herein, and of the manner and process of making and using them, and shall support claims to any such combination or subcombination.

[0034] It will be appreciated by persons skilled in the art that the examples described herein are not limited to what has been particularly shown and described herein above. In addition, unless mention was made above to the contrary, it should be noted that all of the accompanying drawings are not to scale. A variety of modifications and variations are possible in light of the above teachings.

Claims

CLAIMSWhat is claimed is:

1. A method for performing self-diagnostics in a microcontroller, comprising: storing one or more diagnostic settings in one or more registers; selecting a diagnostic setting from the one or more diagnostic settings; and autonomously switching a peripheral device of the microcontroller to the selected diagnostic setting using a context switching circuitry.

2. The method of claim 1, wherein the one or more diagnostic settings is to define one or more parameters for a respective diagnostic test.

3. The method of claim 1, wherein the peripheral device is at least one of an analog- to-digital converter (ADC), an analog comparator (AC), a digital-to-analog converter (DAC), an operational amplifier, a programmable ramp generator and a zero cross detector.

4. The method of claim 1, wherein the peripheral device is to receive the one or more diagnostic settings stored in the one or more registers through a multiplexer.

5. The method of claim 1, further comprising sending a trigger signal using a timer to the context switching circuitry to initiate the autonomous switching of the peripheral device to the selected diagnostic setting.

6. The method of claim 5, wherein the trigger signal is generated using an interconnect system for the context switching circuitry.

7. The method of claim 6, wherein the interconnect system is to generate the trigger signal based on a predetermined event associated with the peripheral device, wherein thepredetermined event comprises at least one of reaching a threshold value and encountering an error condition.

8. An apparatus for performing self-diagnostics in a microcontroller, comprising: one or more registers to store one or more diagnostic settings; a context switching circuitry to select a diagnostic setting from the one or more diagnostic settings based on a trigger signal; and a peripheral device autonomously switched to the selected diagnostic setting by the context switching circuitry.

9. The apparatus of claim 8, wherein the one or more diagnostic settings is to define one or more parameters for a respective diagnostic test.

10. The apparatus of claim 8, wherein the peripheral device is at least one of an analog- to-digital converter (ADC), an analog comparator (AC), a digital-to-analog converter (DAC), an operational amplifier, a programmable ramp generator and a zero cross detector.

11. The apparatus of claim 8, comprising a multiplexer to provide the one or more diagnostic settings stored in the one or more registers to the peripheral device based on a selection signal from the context switching circuitry.

12. The apparatus of claim 8, further comprising a timer to send the trigger signal to the context switching circuitry.

13. The apparatus of claim 8, further comprising an interconnect system to generate the trigger signal based on a predetermined event associated to the peripheral device, wherein the predetermined event comprises at least one of reaching a threshold value and encountering an error condition.

14. A lockstep ADC system comprising:a first analog-to-digital (ADC) converter to receive a first analog signal from a first sensor and a second analog signal from a second sensor; a second ADC to receive the first analog signal and the second analog signal; and a context switching circuitry to select a diagnostic setting from a plurality of diagnostic settings for the first and second ADCs to use in a self-diagnostic test.

15. The lockstep ADC system of claim 14, comprising: a multiplexer to receive the plurality of diagnostic settings, and output the selected diagnostic setting to the first and second ADCs based on a selection signal generated by the context switching circuitry.

16. The lockstep ADC system of claim 15, wherein the context switching circuitry is to generate the selection signal in response to a trigger signal.

17. The lockstep ADC system of claim 16, wherein the trigger signal is provided by a timer.

18. A self-diagnostic system comprising: an analog-to-digital converter (ADC) to receive an analog signal and output a digital signal; one or more registers to store one or more diagnostic settings; a multiplexer to receive a plurality of analog input signals and output the analog signal to the ADC; and a timer to provide a start diagnostic signal to the ADC; wherein the ADC is to select a diagnostic setting from the one or more diagnostic settings and perform a self-diagnostic test in response to the start diagnostic signal.

19. The self-diagnostic system of claim 18, wherein the ADC is to set a failure flag in response to detecting a failure in the self-diagnostic test.

20. The self-diagnostic system of claim 18, comprising: a processor to transmit a start conversion signal to cause the ADC to convert the analog signal into the output signal; wherein the timer is to provide the start diagnostic signal independently of the processor.