Universal serial bus type-c interface protection method, universal serial bus type-c interface, control arbitrator, chip and chip module

By combining hardware and software counters, the operating mode switching function is disabled when no external device is plugged into the Universal Serial Bus Type-C interface, thus solving the interface corrosion problem and ensuring that the interface can still work normally when hardware or software fails.

CN122263189APending Publication Date: 2026-06-23XIAMEN UNISOC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
XIAMEN UNISOC TECH CO LTD
Filing Date
2026-03-25
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

When no external device is connected, the Universal Serial Bus Type-C interface is in a state of constant working mode switching, which leads to interface corrosion. When the existing hardware circuit fails, it is difficult to control its working mode, affecting normal operation.

Method used

By combining hardware and software counters, the sum of the hardware and software counter results is obtained. When it is determined that no external device is plugged into the interface, the working mode switching function is turned off to avoid interface corrosion.

Benefits of technology

It slows down the corrosion rate of the Universal Serial Bus Type-C interface, ensuring that the interface can still function properly in the event of hardware or software failure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122263189A_ABST
    Figure CN122263189A_ABST
Patent Text Reader

Abstract

The application relates to the electronic information technical field and provides a universal serial bus Type-C interface protection method, a universal serial bus Type-C interface, a control arbitrator, a chip and a chip module. The method comprises the following steps: obtaining a hardware counting result; the hardware counting result is obtained by a hardware counter according to an external device insertion detection signal of a hardware switch; the external device insertion detection signal represents whether an external device is inserted into the universal serial bus Type-C interface; obtaining a software counting result; the software counting result is obtained by a software counter according to a software function calling signal; and in the case that the sum of the hardware counting result and the software counting result indicates that the universal serial bus Type-C interface is not inserted with the external device, the universal serial bus Type-C interface is controlled to be in a power-off state. By adopting the method, it can be ensured that in the universal serial bus Type-C interface protection scene, the universal serial bus Type-C interface can still work normally when one of the hardware aspect or the software aspect is invalid or has a problem.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic information technology, and in particular to a method, apparatus, universal serial bus Type-C interface protection method, control arbitrator, chip, chip module, computer-readable storage medium and computer program product. Background Technology

[0002] During operation, the Configuration Channel (cc) pin of the Universal Serial Bus (USB) Type-C interface needs to continuously cycle through level transitions to detect whether the external device is a host or a device, thus determining its own operating mode. This is known as the toggle function of the USB Type-C interface. In most cases, when no external device is connected, the USB Type-C interface is in a level-switching state most of the time, meaning the toggle function is enabled most of the time. This makes the USB Type-C interface highly susceptible to corrosion.

[0003] Currently, hardware circuitry can be added to the Universal Serial Bus (USB) Type-C interface. Based on hardware signals from this circuitry, it can determine if an external device is plugged into the USB Type-C interface, thereby controlling the activation and deactivation of the USB Type-C interface's operating mode switching function and slowing down its degradation. However, when the hardware circuitry malfunctions, it becomes difficult to control the activation and deactivation of the USB Type-C interface's operating mode switching function, causing the USB Type-C interface to malfunction. Summary of the Invention

[0004] Based on this, it is necessary to provide a Universal Serial Bus Type-C interface protection method, device, Universal Serial Bus Type-C interface, control arbitrator, chip, chip module, computer-readable storage medium, and computer program product to address the above-mentioned technical problems.

[0005] In a first aspect, this application provides a method for protecting a Universal Serial Bus Type-C interface, applied to a control arbitrator in a Universal Serial Bus Type-C interface. The Universal Serial Bus Type-C interface further includes a hardware counter, a software counter, and a hardware switch. The control arbitrator is connected to the hardware counter and the software counter respectively, and the hardware counter is connected to the hardware switch. The method includes:

[0006] Obtain the hardware counting result; the hardware counting result is obtained by the hardware counter based on the external device insertion detection signal of the hardware switch; the external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface.

[0007] Obtain the software counting result; the software counting result is obtained by the software counter based on the software function call signal; the software function call signal is the signal generated when the software calls the Universal Serial Bus Type-C interface.

[0008] If, based on the sum of the hardware count and the software count, it is determined that no external device is inserted into the Universal Serial Bus Type-C interface, the Universal Serial Bus Type-C interface is controlled to be in a power-off state, and the working mode switching function of the Universal Serial Bus Type-C interface is disabled.

[0009] In one embodiment, when it is determined, based on the sum of the hardware count result and the software count result, that no external device is inserted into the Universal Serial Bus Type-C interface, controlling the Universal Serial Bus Type-C interface to be in a power-down state and disabling the operating mode switching function of the Universal Serial Bus Type-C interface includes:

[0010] If the sum of the hardware count and the software count is less than or equal to a first set value, it is determined that no external device is inserted into the Universal Serial Bus Type-C interface, and the Universal Serial Bus Type-C interface is controlled to be in a power-down state, thus disabling the working mode switching function of the Universal Serial Bus Type-C interface.

[0011] In one embodiment, the method further includes:

[0012] If the sum of the hardware count and the software count is greater than a first set value, it is determined that an external device is inserted into the Universal Serial Bus Type-C interface, the Universal Serial Bus Type-C interface is powered on, and the working mode switching function of the Universal Serial Bus Type-C interface is enabled.

[0013] Secondly, this application also provides a Universal Serial Bus Type-C interface protection device, applied to a control arbitrator in a Universal Serial Bus Type-C interface. The Universal Serial Bus Type-C interface further includes a hardware counter, a software counter, and a hardware switch. The control arbitrator is used to connect to the hardware counter and the software counter respectively. The hardware counter is used to connect to the hardware switch. The device includes:

[0014] A hardware counting result acquisition module is used to acquire hardware counting results; the hardware counting results are obtained by the hardware counter based on the external device insertion detection signal of the hardware switch; the external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface;

[0015] A software counting result acquisition module is used to acquire software counting results; the software counting results are obtained by the software counter based on a software function call signal; the software function call signal is a signal generated when the software calls the Universal Serial Bus Type-C interface.

[0016] The power-down state and switching function control module is used to control the Universal Serial Bus Type-C interface to be in a power-down state and disable the working mode switching function of the Universal Serial Bus Type-C interface when it is determined that no external device is inserted into the Universal Serial Bus Type-C interface based on the sum of the hardware counting results and the software counting results.

[0017] Thirdly, this application also provides a Universal Serial Bus Type-C interface, the Universal Serial Bus Type-C interface comprising:

[0018] Hardware switch;

[0019] A hardware counter is connected to the hardware switch. The hardware counter is used to obtain a hardware counting result based on the external device insertion detection signal of the hardware switch. The external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface.

[0020] A software counter is used to obtain a software counting result based on a software function call signal; the software function call signal is a signal generated when the Universal Serial Bus Type-C interface is called by software.

[0021] A control arbitrator is configured to connect to both the hardware counter and the software counter, and to perform the steps described in the above embodiments.

[0022] In one embodiment, the hardware counter is used to determine a second preset value when the external device insertion detection signal of the hardware switch indicates that an external device has been inserted into the Universal Serial Bus Type-C interface, and to send the hardware counter result to the control arbitrator; and

[0023] If the external device insertion detection signal of the hardware switch indicates that no external device is inserted into the Universal Serial Bus Type-C interface, the hardware count result is determined to be the third set value, and the hardware count result is sent to the control arbitrator.

[0024] The second setting value is greater than the third setting value.

[0025] In one embodiment, the software counter is used to determine a second preset value when a software function call signal indicates that the Universal Serial Bus Type-C interface has been enabled by calling software, and to send the software count result to the control arbitrator; and

[0026] When the software function call signal indicates that the Universal Serial Bus Type-C interface is closed by calling the software, the software count result is determined to be the third set value, and the software count result is sent to the control arbitrator;

[0027] The second setting value is greater than the third setting value.

[0028] In one embodiment, the hardware counter is a counter attached to the control arbitrator itself; and / or, the software counter is a counter attached to the control arbitrator itself.

[0029] Fourthly, this application also provides a control arbitrator, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in the above embodiments.

[0030] Fifthly, this application also provides a chip including the control arbitrator as described in the above embodiments.

[0031] Sixthly, this application also provides a chip module, including a communication module, a power module, a storage module, and a chip as described in the above embodiments, wherein:

[0032] The power module is used to provide power to the chip module;

[0033] The storage module is used to store data and instructions;

[0034] The communication module is used for internal communication within the chip module, or for communication between the chip module and external devices.

[0035] Seventhly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, the computer program being executed by a processor using the methods described above.

[0036] Eighthly, this application also provides a computer program product. The computer program product includes a computer program that is executed by a processor using the methods described above.

[0037] This application, based on the sum of hardware and software counting results, determines that no external device is inserted into the Universal Serial Bus Type-C interface. It then controls the Universal Serial Bus Type-C interface to be in a power-off state and disables the operating mode switching function of the Universal Serial Bus Type-C interface. This can slow down the corrosion rate of the Universal Serial Bus Type-C interface and protect it. Furthermore, it ensures that even if either the hardware or software fails or malfunctions in the Universal Serial Bus Type-C interface protection scenario, the Universal Serial Bus Type-C interface can still function normally. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0039] Figure 1 This is an application environment diagram of a universal serial bus Type-C interface protection method in one embodiment;

[0040] Figure 2 This is a flowchart illustrating a method for protecting a Universal Serial Bus Type-C interface in one embodiment.

[0041] Figure 3 This is a structural block diagram of a Universal Serial Bus Type-C interface protection device in one embodiment;

[0042] Figure 4 This is an internal structure diagram of a chip module in one embodiment;

[0043] Figure 5 This is a schematic diagram of the internal structure of a Universal Serial Bus Type-C interface with dual role switching function in one embodiment.

[0044] Figure 6 This is a schematic diagram of the structure of a Universal Serial Bus Type-C interface in one embodiment;

[0045] Figure 7 This is a flowchart illustrating the process of controlling the switching of configuration channel pin functions of a Universal Serial Bus Type-C interface through both hardware and software methods in one embodiment. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0047] It should be noted that the terms "comprising" and "having," and any variations thereof, as used in this application, are intended to cover non-exclusive inclusion. The term "multiple" as used in this application refers to two or more. The term "and / or" as used in this application refers to one of the solutions, or any combination of multiple solutions.

[0048] The universal serial bus Type-C interface protection method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, the Universal Serial Bus Type-C interface can include a control arbiter, a hardware counter, a software counter, and a hardware switch. The control arbiter is used to connect to the hardware counter and the software counter, respectively, and the hardware counter is used to connect to the hardware switch.

[0049] Among them, the control arbitrator can obtain the hardware counter result obtained by the hardware counter based on the external device insertion detection signal of the hardware switch; it can obtain the software counter result obtained by the software counter based on the software function call signal; and it can control the Universal Serial Bus Type-C interface to be in a power-off state and disable the working mode switching function of the Universal Serial Bus Type-C interface when it is determined that no external device is inserted into the Universal Serial Bus Type-C interface based on the sum of the hardware counter result and the software counter result.

[0050] In one exemplary embodiment, such as Figure 2 As shown, a method for protecting a universal serial bus Type-C interface is provided, which can be applied to... Figure 1 Taking the control arbitrator in the example, the process includes the following steps S201 to S203. Wherein:

[0051] Step S201: Obtain the hardware counting result; the hardware counting result is obtained by the hardware counter based on the external device insertion detection signal of the hardware switch; the external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface.

[0052] The Universal Serial Bus Type-C interface refers to the Type-C type Universal Serial Bus (USB) interface.

[0053] Hardware switches can be general-purpose input / output (GPIO) pins or pins of external interrupt controllers (EICs). Hardware switches can also be called hardware OTG (On-The-Go) switches.

[0054] The external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface. When an external device is inserted, a level transition is triggered. Upon detecting a low level being pulled high, an interrupt is generated, and the current level returns to high. This confirms the presence of an external device inserted into the Universal Serial Bus Type-C interface. Conversely, when no external device is inserted, such as when the external device is unplugged from the Universal Serial Bus Type-C interface, a level transition is triggered. Upon detecting a high level being pulled low, the current level returns to low. This confirms the absence of an external device inserted into the Universal Serial Bus Type-C interface.

[0055] The hardware counter can determine whether an external device is inserted into the Universal Serial Bus Type-C interface based on the external device insertion detection signal of the hardware switch; it can also assign different set values ​​to the hardware counter result based on whether an external device is inserted into the Universal Serial Bus Type-C interface, so that the control arbitrator can determine whether an external device is inserted into the Universal Serial Bus Type-C interface from a hardware perspective based on the set value corresponding to the hardware counter.

[0056] Step S202: Obtain the software counting result; the software counting result is obtained by the software counter based on the software function call signal; the software function call signal is the signal generated when the software calls the Universal Serial Bus Type-C interface.

[0057] It can respond to user operations to enable or disable the Universal Serial Bus (USB) Type-C interface via software calls. For example, when an external device is plugged into the USB Type-C interface, and the user performs an operation to enable the USB Type-C interface, the system can respond to this operation and enable the USB Type-C interface via software calls. Conversely, when no external device is plugged into the USB Type-C interface, and the user performs an operation to disable the USB Type-C interface, the system can respond to this operation and disable the USB Type-C interface via software calls.

[0058] The software counter can determine whether the Universal Serial Bus Type-C interface is enabled or disabled based on software function call signals. Different set values ​​can be assigned to the software counter result based on whether the Universal Serial Bus Type-C interface is enabled or disabled, allowing the control arbitrator to determine, from a software perspective, whether an external device is inserted into the Universal Serial Bus Type-C interface based on the corresponding set value of the software counter.

[0059] Step S203: If, based on the sum of the hardware counting results and the software counting results, it is determined that no external device is inserted into the Universal Serial Bus Type-C interface, the Universal Serial Bus Type-C interface is controlled to be in a power-off state, and the working mode switching function of the Universal Serial Bus Type-C interface is disabled.

[0060] If the operating mode switching function of the Universal Serial Bus Type-C interface is disabled, the configuration channel pins of the Universal Serial Bus Type-C interface will not cycle through level switching.

[0061] The control arbitrator can comprehensively determine whether an external device is inserted into the Universal Serial Bus Type-C interface based on the sum of hardware and software counting results, from both hardware and software perspectives.

[0062] If it is confirmed from a hardware perspective that no external device is plugged into the Universal Serial Bus Type-C interface, or from a software perspective that no external device is plugged into the Universal Serial Bus Type-C interface, then it can be determined that no external device is plugged into the Universal Serial Bus Type-C interface. In this case, the Universal Serial Bus Type-C interface can be powered down, and the working mode switching function of the Universal Serial Bus Type-C interface can be disabled.

[0063] In the aforementioned Universal Serial Bus Type-C interface protection method, when it is determined that no external device is plugged into the Universal Serial Bus Type-C interface based on the sum of hardware and software counting results, the Universal Serial Bus Type-C interface is controlled to be in a power-off state, and the working mode switching function of the Universal Serial Bus Type-C interface is disabled. This can slow down the corrosion rate of the Universal Serial Bus Type-C interface and protect it. It can also ensure that in the Universal Serial Bus Type-C interface protection scenario, if either the hardware or software fails or malfunctions, the Universal Serial Bus Type-C interface can still work normally.

[0064] In one embodiment, if it is determined that no external device is inserted into the Universal Serial Bus Type-C interface based on the sum of the hardware count result and the software count result, the Universal Serial Bus Type-C interface is controlled to be in a power-down state. The specific steps are as follows: if the sum of the hardware count result and the software count result is less than or equal to a first set value, it is determined that no external device is inserted into the Universal Serial Bus Type-C interface, the Universal Serial Bus Type-C interface is controlled to be in a power-down state, and the working mode switching function of the Universal Serial Bus Type-C interface is turned off.

[0065] The first setting value can be set according to the actual situation. For example, the first setting value can be set to 0.

[0066] If the sum of the hardware count and the software count is less than or equal to the first set value, it indicates that no external device is inserted into the Universal Serial Bus Type-C interface, which can be determined comprehensively from both hardware and software perspectives. At this time, the Universal Serial Bus Type-C interface can be controlled to be in a power-down state, and the working mode switching function of the Universal Serial Bus Type-C interface can be disabled.

[0067] In this embodiment, based on the relationship between the sum of the hardware counting results and the software counting results and the first set value, it can be quickly determined that no external device is inserted into the Universal Serial Bus Type-C interface. This allows the Universal Serial Bus Type-C interface to be controlled to be in a power-off state, and the working mode switching function of the Universal Serial Bus Type-C interface to be disabled, thereby slowing down the corrosion rate of the Universal Serial Bus Type-C interface and protecting the Universal Serial Bus Type-C interface.

[0068] In one embodiment, the method provided by this application further includes: when the sum of the hardware counting result and the software counting result is greater than a first set value, determining that an external device is inserted into the Universal Serial Bus Type-C interface, controlling the Universal Serial Bus Type-C interface to be in a power-on state, and enabling the working mode switching function of the Universal Serial Bus Type-C interface.

[0069] The first setting value can be set according to the actual situation. For example, the first setting value can be set to 0.

[0070] If the Universal Serial Bus Type-C interface has its operating mode switching function enabled, the configuration channel pin of the Universal Serial Bus Type-C interface will continuously cycle through level switching.

[0071] If the sum of the hardware count and the software count is greater than the first set value, it indicates that the insertion of an external device into the Universal Serial Bus Type-C interface can be determined comprehensively from both hardware and software perspectives. At this time, the Universal Serial Bus Type-C interface can be controlled to be in the power-on state, and the working mode switching function of the Universal Serial Bus Type-C interface can be enabled.

[0072] In this embodiment, the relationship between the sum of the hardware counting results and the software counting results and the first set value can be used to quickly determine the insertion of an external device into the Universal Serial Bus Type-C interface, thereby controlling the Universal Serial Bus Type-C interface to be in a power-on state, enabling the Universal Serial Bus Type-C interface's working mode switching function, and ensuring the normal operation of the Universal Serial Bus Type-C interface.

[0073] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0074] Based on the same inventive concept, this application also provides a Universal Serial Bus (USB) Type-C interface protection device for implementing the aforementioned USB Type-C interface protection method. A control arbitrator is applied to the USB Type-C interface, which also includes a hardware counter, a software counter, and a hardware switch. The control arbitrator is connected to the hardware counter and the software counter respectively, and the hardware counter is connected to the hardware switch. Furthermore, this device can be applied to or integrated into a chip or chip module, for example. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the USB Type-C interface protection device provided below can be found in the limitations of the USB Type-C interface protection method described above, and will not be repeated here.

[0075] In one exemplary embodiment, such as Figure 3 As shown, a universal serial bus Type-C interface protection device is provided, wherein:

[0076] Hardware counting result acquisition module 301 is used to acquire hardware counting results; the hardware counting results are obtained by the hardware counter based on the external device insertion detection signal of the hardware switch; the external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface.

[0077] The software counting result acquisition module 302 is used to acquire the software counting result; the software counting result is obtained by the software counter according to the software function call signal; the software function call signal is the signal generated when the software calls the Universal Serial Bus Type-C interface.

[0078] The power-down state and switching function control module 303 is used to control the Universal Serial Bus Type-C interface to be in a power-down state and disable the working mode switching function of the Universal Serial Bus Type-C interface when it is determined that no external device is inserted into the Universal Serial Bus Type-C interface based on the sum of the hardware counting result and the software counting result.

[0079] In one embodiment, the power-down state control module 303 is configured to: determine that no external device is inserted into the Universal Serial Bus Type-C interface when the sum of the hardware counting result and the software counting result is less than or equal to a first set value, control the Universal Serial Bus Type-C interface to be in a power-down state, and disable the working mode switching function of the Universal Serial Bus Type-C interface.

[0080] In one embodiment, the device further includes a power-on state control module 303, configured to: determine that an external device is inserted into the Universal Serial Bus Type-C interface when the sum of the hardware counting result and the software counting result is greater than a first set value, control the Universal Serial Bus Type-C interface to be in a power-on state, and enable the working mode switching function of the Universal Serial Bus Type-C interface.

[0081] Regarding the modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for various devices and products applied to or integrated into a chip, all of their modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs that run on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits; for various devices and products applied to or integrated into a chip module, all of their modules / units can be implemented using hardware methods such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.

[0082] In one embodiment, a Universal Serial Bus Type-C interface is provided, comprising: a hardware switch; a hardware counter connected to the hardware switch, the hardware counter being used to obtain a hardware counting result based on an external device insertion detection signal from the hardware switch; the external device insertion detection signal indicating whether an external device is inserted into the Universal Serial Bus Type-C interface; a software counter being used to obtain a software counting result based on a software function call signal; the software function call signal being a signal generated when the Universal Serial Bus Type-C interface is called by software; and a control arbitrator being connected to both the hardware counter and the software counter, the control arbitrator being used to execute the steps of the method as described in the above embodiment.

[0083] Hardware switches can be general-purpose input / output (GPIO) pins or pins of external interrupt controllers (EIC).

[0084] The external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface. When an external device is inserted, a level transition is triggered. Upon detecting a low level being pulled high, an interrupt is generated, and the current level returns to high. This confirms the presence of an external device inserted into the Universal Serial Bus Type-C interface. Conversely, when no external device is inserted, such as when the external device is unplugged from the Universal Serial Bus Type-C interface, a level transition is triggered. Upon detecting a high level being pulled low, the current level returns to low. This confirms the absence of an external device inserted into the Universal Serial Bus Type-C interface.

[0085] The hardware counter can determine whether an external device is inserted into the Universal Serial Bus Type-C interface based on the external device insertion detection signal of the hardware switch; it can also assign different set values ​​to the hardware counter result based on whether an external device is inserted into the Universal Serial Bus Type-C interface, so that the control arbitrator can determine whether an external device is inserted into the Universal Serial Bus Type-C interface from a hardware perspective based on the set value corresponding to the hardware counter.

[0086] It can respond to user operations to enable or disable the Universal Serial Bus (USB) Type-C interface via software calls. For example, when an external device is plugged into the USB Type-C interface, and the user performs an operation to enable the USB Type-C interface, the system can respond to this operation and enable the USB Type-C interface via software calls. Conversely, when no external device is plugged into the USB Type-C interface, and the user performs an operation to disable the USB Type-C interface, the system can respond to this operation and disable the USB Type-C interface via software calls.

[0087] The software counter can determine whether the Universal Serial Bus Type-C interface is enabled or disabled based on software function call signals. Different set values ​​can be assigned to the software counter result based on whether the Universal Serial Bus Type-C interface is enabled or disabled, allowing the control arbitrator to determine, from a software perspective, whether an external device is inserted into the Universal Serial Bus Type-C interface based on the corresponding set value of the software counter.

[0088] If the operating mode switching function of the Universal Serial Bus Type-C interface is disabled, the configuration channel pins of the Universal Serial Bus Type-C interface will not cycle through level switching.

[0089] The control arbitrator can comprehensively determine whether an external device is inserted into the Universal Serial Bus Type-C interface based on the sum of hardware and software counting results, from both hardware and software perspectives.

[0090] If it is confirmed from a hardware perspective that no external device is plugged into the Universal Serial Bus Type-C interface, or from a software perspective that no external device is plugged into the Universal Serial Bus Type-C interface, then it can be determined that no external device is plugged into the Universal Serial Bus Type-C interface. In this case, the Universal Serial Bus Type-C interface can be powered down, and the working mode switching function of the Universal Serial Bus Type-C interface can be disabled.

[0091] The aforementioned Universal Serial Bus (USB) ensures that in scenarios where the USB Type-C interface is protected, the USB Type-C interface will still function normally even if either the hardware or software fails or malfunctions.

[0092] In one embodiment, the hardware counter is used to determine a second set value and send the hardware count result to the control arbitrator when the external device insertion detection signal of the hardware switch indicates that an external device is inserted into the Universal Serial Bus Type-C interface; and to determine a third set value and send the hardware count result to the control arbitrator when the external device insertion detection signal of the hardware switch indicates that no external device is inserted into the Universal Serial Bus Type-C interface; the second set value is greater than the third set value.

[0093] You can set a second and a third setting value according to the actual situation, where the second setting value is greater than the third setting value. For example, you can set the second setting value to +1 and the third setting value to -1.

[0094] In this embodiment, the hardware counter determines the hardware counting result based on the content represented by the external device insertion detection signal of the hardware switch and sends the hardware counting result to the control arbitrator, so that the control arbitrator can quickly determine whether an external device is inserted into the Universal Serial Bus Type-C interface based on the relationship between the sum of the hardware counting result and the software counting result and the first set value.

[0095] In one embodiment, the software counter is used to determine a second preset value when the software function call signal indicates that the Universal Serial Bus Type-C interface is enabled by calling the software, and to send the software count result to the control arbitrator; and to determine a third preset value when the software function call signal indicates that the Universal Serial Bus Type-C interface is disabled by calling the software, and to send the software count result to the control arbitrator; wherein the second preset value is greater than the third preset value.

[0096] You can set a second and a third setting value according to the actual situation, where the second setting value is greater than the third setting value. For example, you can set the second setting value to +1 and the third setting value to -1.

[0097] In this embodiment, the software counter determines the software counting result based on the content represented by the software function call signal and sends the software counting result to the control arbitrator, so that the control arbitrator can quickly determine whether an external device is inserted into the Universal Serial Bus Type-C interface based on the relationship between the sum of the hardware counting result and the software counting result and the first set value.

[0098] In one embodiment, the hardware counter is a counter attached to the control arbitrator itself; and / or, the software counter is a counter attached to the control arbitrator itself.

[0099] In one embodiment, a control arbitrator is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the method described in the above embodiment.

[0100] In one embodiment, a chip is provided that includes a control arbitrator as described in the above embodiments.

[0101] It is understood that the chip involved in the embodiments of this application may be a field-programmable gate array (FPGA), may be an application-specific integrated circuit (ASIC), may be a system on chip (SoC), may be a central processor unit (CPU), may be a network processor (NP), may be a digital signal processor (DSP), may be a microcontroller unit (MCU), may be a programmable logic device (PLD), or other integrated chips, etc.

[0102] In one embodiment, such as Figure 4 As shown, a chip module is provided, including a communication module, a power module, a storage module, and a chip as described in the above embodiments, wherein:

[0103] The power module is used to provide power to the chip module;

[0104] Storage modules are used to store data and instructions;

[0105] The communication module is used for internal communication within the chip module, or for communication between the chip module and external devices.

[0106] The implementation method of this chip module can be found in the relevant content of the above chip embodiment, and will not be repeated here.

[0107] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0108] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0109] To better understand the above method, the following describes in detail an application embodiment of the universal serial bus Type-C interface protection method of this application.

[0110] During operation, the Universal Serial Bus (USB) Type-C interface needs to continuously pull up or down its configuration channel pins, a process known as level switching, to detect whether the external device is a host or a device, thus determining its operating mode. In other words, the USB Type-C interface has a mode-switching function. In most cases, when no external device is connected, the USB Type-C interface is in a level-switching state most of the time, meaning the mode-switching function is enabled most of the time. Because the configuration channel pins are pulled up during toggle operations, over time, this can easily lead to corrosion of the USB Type-C interface, causing malfunctions in the USB Type-C interface and even the entire device. Type-C is a standard interface for USB, offering superior performance and ease of use compared to Type-A and Type-B.

[0111] The Universal Serial Bus (USB) Type-C interface boasts excellent performance and is widely used in various electronic devices. It can function as either a device or a host. The USB Type-C interface features a dual-role power supply (DRP) capability, allowing it to switch freely between different operating modes to adapt to various external connection scenarios. The internal structure of a USB Type-C interface with this functionality is as follows: Figure 5 As shown. The core control module can be a connection and marked cable detection, cold-socket detection, and VCONN control module. The role negotiation module is called Presents Sink or Source. The current monitoring module can be a USB Type-C current detection module. The multiplexer control signal is called Mux CNTL. The power delivery signal (USB PD protocol control signal) is called Power Delivery. The VBUS power supply terminal is called VBUS Source. The VBUS receiving terminal is called VBUSSink. The USB bus voltage (default 5V) is denoted as V. BUS The full name of VCONN voltage (usually 5V) is VCONN Voltage, denoted as V.CONN Rp is the pull-up resistor. Rd is the pull-down resistor. Ground is the terminal for grounding.

[0112] For the Universal Serial Bus Type-C interface used for high-speed transmission, there are four pins for connecting to the peer device, namely: V BUS : Generally provided by the host, used to drive the slave device to work properly; CC1, CC2: Configuration pins, used to detect whether the external device is connected, and to confirm whether the external device is connected as a host or a device; GND: Ground wire.

[0113] The basic operating principle of the Universal Serial Bus Type-C interface is as follows: The Universal Serial Bus Type-C interface can function as either a host or a device. When functioning as a host, the Universal Serial Bus Type-C interface controller needs to connect its configuration channel pin to a resistor Rp and pull it up. When functioning as a device, the Universal Serial Bus Type-C interface controller needs to connect its configuration channel pin to a resistor Rd and pull it down to ground.

[0114] When the Universal Serial Bus Type-C interface operates as a host, the configuration channel pin on the peer device is pulled down by resistor Rd. This pull-up resistor on the host side is also pulled down, causing a voltage drop on the original configuration channel pin. The host controller detects this voltage change to confirm the connection of a corresponding device. Conversely, the peer device, whose configuration channel pin was originally pulled down by Rd, will have its voltage pulled up by the host after connecting. Therefore, the device controller can also detect this voltage change to confirm the connection of a corresponding host.

[0115] In the dual-role power supply mode, the Universal Serial Bus Type-C interface will continuously switch between host and device. That is, for a period of time, the configuration channel pin pulls up the resistor Rp, and for a period of time, the configuration channel pin pulls up and down the resistor Rd, so that the voltage on the configuration channel changes periodically between 0 and pull-up.

[0116] Because the configuration channel pins of the Universal Serial Bus (USB) Type-C interface, operating in a dual-power mode, undergo periodic changes, they are highly susceptible to corrosion under complex external environments. To slow down this corrosion, traditional USB Type-C interface protection schemes employ two main approaches: first, using various anti-corrosion circuits to achieve electrical isolation; and second, adding hardware circuitry to the USB Type-C interface to determine whether an external device is plugged in, and accordingly pulling the configuration channel pins high or low based on hardware signals.

[0117] Traditional protection schemes for Universal Serial Bus Type-C interfaces have the following problems:

[0118] The first approach, which involves designing related hardware logic circuits to achieve electrical isolation, has obvious drawbacks. Firstly, it requires introducing additional hardware circuitry, increasing the complexity of the Universal Serial Bus Type-C interface, which inevitably makes it less stable. Secondly, the additional hardware circuitry can also affect the signal quality during transmission through the Universal Serial Bus Type-C interface, leading to unpredictable problems.

[0119] The second approach, which uses external hardware signals to pull the configuration channel pins high and low, can only control the on / off state of the configuration channel pins through hardware means. When there are problems with the hardware circuit or the hardware circuit cannot be changed, it is difficult to play the role of pulling the configuration channel pins high and low, and it is difficult to control the opening and closing of the working mode switching function of the Universal Serial Bus Type-C interface, causing the Universal Serial Bus Type-C interface to malfunction.

[0120] To circumvent the aforementioned problems, this embodiment proposes a corrosion-resistant method for protecting the Universal Serial Bus (USB) Type-C interface. This method utilizes both software and hardware control, employing a control arbitrator to dynamically control whether the USB Type-C interface is toggled. The interface is enabled when needed and disabled when not in use, thus protecting the USB Type-C interface. Furthermore, it eliminates the need for complex external corrosion-resistant circuitry and avoids concerns about hardware malfunctions or unchangeable hardware affecting the normal operation of the USB Type-C interface, resulting in simpler hardware and more stable operation.

[0121] The Universal Serial Bus Type-C interface structure is as follows: Figure 6As shown, the hardware counter and software counter are counters attached to the control arbitrator itself. The Universal Serial Bus Type-C interface module is the other component in the Universal Serial Bus Type-C interface besides the control arbitrator and hardware switch. It can be seen that the Universal Serial Bus Type-C interface in this embodiment does not add any additional hardware circuitry and will not affect the original signal quality. The Universal Serial Bus Type-C interface protection method provided in this embodiment allows the control arbitrator to determine whether the hardware needs to enable the relevant functions of the configuration channel pins of the Universal Serial Bus Type-C interface by acquiring an external device insertion detection signal (which can be an external interrupt control signal). Of course, in addition to using the external device insertion detection signal, the control arbitrator can also be notified from the software side whether to enable the relevant functions of the configuration channel pins of the Universal Serial Bus Type-C interface, i.e., by acquiring a software function call signal to determine whether the software needs to enable the relevant functions of the configuration channel pins of the Universal Serial Bus Type-C interface. This ensures that the Universal Serial Bus Type-C interface can still function normally even if either the hardware or software fails or malfunctions.

[0122] Considering that the Universal Serial Bus Type-C interface can be controlled by software, and also by hardware, the control arbitrator can arbitrate software signals (software function call signals) and hardware signals (external device insertion detection signals) to determine whether the configuration channel pins of the Universal Serial Bus Type-C interface are switched on and off normally.

[0123] The Universal Serial Bus Type-C interface protection method provided in this embodiment allows both hardware and software methods (hardware insertion detection and software insertion detection) to control the switching of the configuration channel pin functions of the Universal Serial Bus Type-C interface, that is, to control the enabling and disabling of the toggle function of the Universal Serial Bus Type-C interface. The specific process is as follows: Figure 7 As shown.

[0124] The hardware switch can be a pin of the External Interrupt Controller (EIC). Hardware insertion detection can be implemented through the pin of the external device's external interrupt controller. When the pin of the external device's external interrupt controller is inserted into the Universal Serial Bus Type-C interface, the corresponding interrupt will be triggered, thereby incrementing the hardware counter by one. When the pin of the external device's external interrupt controller is removed, the corresponding hardware counter will decrement by one.

[0125] The software insertion detection method is similar to that using the pins of an external interrupt controller, and can also be controlled using software nodes. When the corresponding software function is called to enable the Universal Serial Bus Type-C interface, the software counter increments by one, and when the software function is called to disable the Universal Serial Bus Type-C interface, the software counter decrements by one.

[0126] Whether the state change is detected by software or hardware, it will ultimately be sent to the control arbiter. The control arbiter can sum the hardware count and the software count. When the sum is greater than 0, it means that software or hardware needs to ensure that the Universal Serial Bus Type-C interface function is enabled, so the control arbiter will enable the toggle function of the Universal Serial Bus Type-C interface. Conversely, if the control arbiter determines that the sum is less than or equal to 0, it means that software or hardware needs to disable the Universal Serial Bus Type-C interface function, so the arbiter will disable the toggle function of the Universal Serial Bus Type-C interface.

[0127] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0128] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0129] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0130] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for protecting a universal serial bus Type-C interface, characterized in that, A control arbiter is applied in a Universal Serial Bus Type-C interface, wherein the Universal Serial Bus Type-C interface further includes a hardware counter, a software counter, and a hardware switch. The control arbiter is configured to be connected to the hardware counter and the software counter respectively, and the hardware counter is configured to be connected to the hardware switch. The method includes: Obtain the hardware counting result; the hardware counting result is obtained by the hardware counter based on the external device insertion detection signal of the hardware switch; the external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface. Obtain the software counting result; the software counting result is obtained by the software counter based on the software function call signal; the software function call signal is the signal generated when the software calls the Universal Serial Bus Type-C interface. If, based on the sum of the hardware count and the software count, it is determined that no external device is inserted into the Universal Serial Bus Type-C interface, the Universal Serial Bus Type-C interface is controlled to be in a power-off state, and the working mode switching function of the Universal Serial Bus Type-C interface is disabled.

2. The method according to claim 1, characterized in that, The step of controlling the Universal Serial Bus Type-C interface to be in a power-down state and disabling the working mode switching function of the Universal Serial Bus Type-C interface when it is determined that no external device is inserted into the Universal Serial Bus Type-C interface based on the sum of the hardware counting result and the software counting result includes: If the sum of the hardware count and the software count is less than or equal to a first set value, it is determined that no external device is inserted into the Universal Serial Bus Type-C interface, and the Universal Serial Bus Type-C interface is controlled to be in a power-down state, thus disabling the working mode switching function of the Universal Serial Bus Type-C interface.

3. The method according to claim 2, characterized in that, The method further includes: If the sum of the hardware count and the software count is greater than a first set value, it is determined that an external device is inserted into the Universal Serial Bus Type-C interface, the Universal Serial Bus Type-C interface is powered on, and the working mode switching function of the Universal Serial Bus Type-C interface is enabled.

4. A universal serial bus Type-C interface, characterized in that, The Universal Serial Bus Type-C interface includes: Hardware switch; A hardware counter is connected to the hardware switch. The hardware counter is used to obtain a hardware counting result based on the external device insertion detection signal of the hardware switch. The external device insertion detection signal indicates whether an external device is inserted into the Universal Serial Bus Type-C interface. A software counter is used to obtain a software counting result based on a software function call signal; the software function call signal is a signal generated when the Universal Serial Bus Type-C interface is called by software. A control arbitrator is configured to be connected to the hardware counter and the software counter respectively, and the control arbitrator is configured to perform the steps of the method as described in any one of claims 1 to 3.

5. The Universal Serial Bus Type-C interface according to claim 4, characterized in that, The hardware counter is used to determine a second preset value when the external device insertion detection signal of the hardware switch indicates that an external device has been inserted into the Universal Serial Bus Type-C interface, and to send the hardware counter result to the control arbitrator; and If the external device insertion detection signal of the hardware switch indicates that no external device is inserted into the Universal Serial Bus Type-C interface, the hardware count result is determined to be the third set value, and the hardware count result is sent to the control arbitrator. The second setting value is greater than the third setting value.

6. The Universal Serial Bus Type-C interface according to claim 4, characterized in that, The software counter is used to determine the software count result as a second preset value when the software function call signal indicates that the Universal Serial Bus Type-C interface is opened by calling the software, and to send the software count result to the control arbitrator; as well as, When the software function call signal indicates that the Universal Serial Bus Type-C interface is closed by calling the software, the software count result is determined to be the third set value, and the software count result is sent to the control arbitrator; The second setting value is greater than the third setting value.

7. The Universal Serial Bus Type-C interface according to claim 4, characterized in that, The hardware counter is a counter that is attached to the control arbitrator itself; and / or, the software counter is a counter that is attached to the control arbitrator itself.

8. A control arbitrator, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.

9. A chip, characterized in that, Includes the control arbitrator as described in claim 8.

10. A chip module, characterized in that, It includes a communication module, a power module, a storage module, and the chip as described in claim 9, wherein: The power module is used to provide power to the chip module; The storage module is used to store data and instructions; The communication module is used for internal communication within the chip module, or for communication between the chip module and external devices.