Method for switching working modes of equipment through forward and reverse insertion based on Type-C interface

By using the pin connection of USB Type-C plug and socket in embedded devices, switching the working mode according to the forward and reverse plugging method of the plug, the problems of design complexity and high manufacturing cost caused by different interfaces in the prior art are solved. Two working modes of the same interface are realized, which improves the design simplification and production efficiency of the equipment.

CN119271225APending Publication Date: 2025-01-07BEIJING SHUMI NETWORK TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411373158.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

Existing embedded devices use different data interfaces in different working modes, resulting in high design complexity, high manufacturing cost, and difficulty in achieving the same interface docking two working modes.

Method used

By loading the USB Type-C plug on the host device and loading the USB Type-C socket on the slave device, the A6 and A7 pins are used to connect to the input/output data interface of the microcontroller unit, the B6 and B7 pins are connected to the program Connect the recording interface, switch the working mode according to the forward and reverse plugging mode of the plug, and run the slave burning program or the slave instruction interactive program to operate the microcontroller unit.

Benefits of technology

It realizes two working modes based on the same USB Type-C interface, reducing design complexity and manufacturing costs, and improving the yield of single products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271225A_ABST
    Figure CN119271225A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a method for switching working modes of equipment by forward and reverse plugging based on a Type-C interface. The method comprises the following steps: loading / installing a USB Type-C plug, a slave burning program and a slave instruction interaction program on host equipment; loading a USB Type-C socket on slave equipment, connecting a pin A6 and a pin A7 of the socket with an input / output data interface of the micro-control unit, and connecting a pin B6 and a pin B7 with a program burning interface of the micro-control unit; when the plug is inserted into the socket in a reverse insertion manner, performing master control program burning on the micro-control unit by running a slave burning program; when the plug is inserted into the socket in a positive insertion mode, instruction interaction with the micro-control unit is carried out by running a slave instruction interaction program. According to the invention, the design complexity of slave equipment can be reduced, the single product yield is improved, and the production and manufacturing cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a method for switching device working modes based on forward and reverse insertion of a Type-C interface. Background Art

[0002] There are many product forms of embedded devices, and various types of card readers are one of them. The main control program of this type of device can parse and execute the card reader instructions issued by the host device, and can also read and write data on the locally inserted smart card; there are many ways to upgrade the main control program of this type of device, among which the more common one is to be implemented by the host device through the program burning mechanism. Therefore, there are at least two types of working modes for this type of device: slave burning mode and slave data communication mode. Through research, we found that most of these devices use different data interfaces for processing in different working modes. As we all know, the more interfaces, the more complex the design, and the higher the production and manufacturing cost; if the two working modes can be connected based on the same interface, it can not only reduce the complexity of the design and improve the yield of the single product, but also effectively reduce the production and manufacturing cost. And this is the technical problem that the present invention needs to solve. Summary of the invention

[0003] The purpose of the present invention is to provide a method for switching the working mode of a device based on the forward and reverse insertion of a Type-C interface in view of the defects of the prior art. The present invention loads a USB Type-C plug on a host device, and installs a slave burning program and a slave instruction interaction program; loads a USB Type-C socket on a slave device, connects A6 and A7 pins of the socket to an input / output data interface of a microcontroller unit (MCU) of the slave device, and connects B6 and B7 pins to a program burning interface of the MCU; when the USB Type-C plug is inserted into the USB Type-C socket in a reverse insertion mode, the slave device is powered by plug pins (A4 / B4, A9 / B9), and the current working mode is regarded as a slave burning mode, and a master control program burning operation is performed on the MCU by running the slave burning program; when the USB Type-C plug is inserted into the USB Type-C socket in a forward insertion mode, the slave device is powered by plug pins (A4 / B4, A9 / B9), and the current working mode is regarded as a slave data communication mode, and a device instruction interaction operation is performed on the MCU by running the slave instruction interaction program. The present invention can connect two working modes based on the same USB Type-C interface; the present invention can reduce design complexity, improve single product yield and reduce production and manufacturing costs.

[0004] To achieve the above object, an embodiment of the present invention provides a method for switching a device working mode based on a Type-C interface, the method comprising:

[0005] Load a USB Type-C plug on the host device; and install a slave burning program and a slave command interaction program on the host device;

[0006] Load a USB Type-C socket on the slave device; connect the A6 and A7 pins of the USB Type-C socket to the input / output data interface of the micro control unit of the slave device; and connect the B6 and B7 pins of the USB Type-C socket to the program burning interface of the micro control unit;

[0007] When the USB Type-C plug is inserted into the USB Type-C socket in a reverse insertion manner, the slave device is powered; and the microcontroller unit of the slave device is burned with a master control program by running the slave burning program;

[0008] When the USB Type-C plug is inserted into the USB Type-C socket in a normal insertion manner, the slave device is powered; and the device command interaction operation is performed on the micro control unit of the slave device by running the slave command interaction program.

[0009] Preferably, when the USB Type-C plug is inserted into the USB Type-C socket in a reverse insertion manner, the B12, B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, and A12 pins on the plug are respectively connected to the corresponding A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the socket; the A4 / B4 and A9 / B9 pins on the plug are used for power supply, and the A6 and A7 pins are used for data transmission; and the B6 and B7 pins on the socket are used for data transmission.

[0010] Preferably, when the USB Type-C plug is inserted into the USB Type-C socket in a positive insertion manner, the A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the plug are respectively connected with the corresponding A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the socket; the A4 / B4 and A9 / B9 pins on the plug are used for power supply, and the A6 and A7 pins are used for data transmission; the A6 and A7 pins on the socket are used for data transmission.

[0011] Preferably, the slave burning program includes a first drive unit and a first UI unit; when the slave burning program starts running, the first drive unit and the first UI unit are started; after the first drive unit is started, it is used to establish a connection with the program burning interface of the micro control unit of the slave device through the A6 and A7 pins of the USB Type-C plug when the USB Type-C plug is inserted into the USB Type-C socket in a reverse manner; after the first UI unit is started, it is used to receive a first master control program code input by a user; and the first master control program code is loaded onto the micro control unit of the slave device by calling the first drive unit.

[0012] Preferably, the slave instruction interaction program includes a second drive unit and a second UI unit; when the slave instruction interaction program starts and runs, the second UI unit and the second drive unit are started; after the second drive unit is started, it is used to establish a connection with the input / output data interface of the microcontroller unit of the slave device through the A6 and A7 pins of the USB Type-C plug when the USB Type-C plug is inserted into the USB Type-C socket in a normal insertion manner; after the second UI unit is started, it is used to receive a first device instruction input by a user; and send the first device instruction to the microcontroller unit of the slave device by calling the second drive unit, and receive the first instruction feedback data sent back by the microcontroller unit through the second drive unit.

[0013] Preferably, after successfully loading a version of the master control program code, the microcontroller unit of the slave device uses it as the current master control program and runs it; and based on the current master control program, performs instruction parsing and instruction execution operations on the device instructions issued by the host device to obtain corresponding instruction feedback data and send it back to the host device.

[0014] The embodiment of the present invention provides a method for switching device working modes based on forward and reverse plugging of a Type-C interface. The embodiment of the present invention loads a USB Type-C plug on a host device, and installs a slave burning program and a slave instruction interaction program; and loads a USB Type-C socket on a slave device, and connects the A6 and A7 pins of the socket to the input / output data interface of a microcontroller unit of the slave device, and connects the B6 and B7 pins to the program burning interface of the microcontroller unit; and when the USB Type-C plug is inserted into the USB Type-C socket in a reverse plugging manner, the slave device is powered through the plug pins (A4 / B4, A9 / B9), and the current working mode is regarded as a slave burning mode, and the microcontroller unit is burned by running the slave burning program; and when the USB Type-C plug is inserted into the USB Type-C socket in a forward plugging manner, the slave device is powered through the plug pins (A4 / B4, A9 / B9), and the current working mode is regarded as a slave data communication mode, and the microcontroller unit is operated to perform device instruction interaction operations by running the slave instruction interaction program. The implementation of the present invention can connect two working modes based on the same USB Type-C interface; the implementation of the present invention not only reduces the design complexity and the generation and manufacturing cost, but also improves the single product yield. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A schematic diagram of a method for switching device working modes based on forward and reverse insertion of a Type-C interface provided by an embodiment of the present invention;

[0016] Figure 2 A schematic diagram of the master-slave connection relationship in the slave burning mode of an embodiment of the present invention;

[0017] Figure 3 Schematic diagram of the master-slave connection relationship in the slave data communication mode according to an embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0019] The embodiment of the present invention provides a method for switching the working mode of a device based on the forward and reverse insertion of a Type-C interface, such as Figure 1 A method for switching the working mode of a device based on the forward and reverse insertion of a Type-C interface provided by an embodiment of the present invention is shown in a schematic diagram, which mainly includes the following steps:

[0020] Step 1: load a USB Type-C plug on the host device; and install a slave burning program and a slave command interaction program on the host device.

[0021] Here, the host device of the embodiment of the present invention is a module, device, terminal, equipment, desktop computer, laptop computer, tablet computer, mobile phone, mobile terminal, server, system or platform that can install a USB Type-C plug, a slave burning program and a slave command interaction program.

[0022] Step 2, load a USB Type-C socket on the slave device; connect the A6 and A7 pins of the USB Type-C socket to the input / output data interface of the microcontroller unit of the slave device; and connect the B6 and B7 pins of the USB Type-C socket to the program burning interface of the microcontroller unit.

[0023] Here, the slave device in the embodiment of the present invention is an embedded device with a built-in micro control unit and a USB Type-C plug. The pin connection relationship between the USB Type-C socket and the micro control unit in the embodiment of the present invention is as follows: Figure 2 Schematic diagram of the master-slave connection relationship in the slave burning mode of the embodiment of the present invention or Figure 3 This is a schematic diagram of the master-slave connection relationship in the slave data communication mode of an embodiment of the present invention.

[0024] Step 3, when the USB Type-C plug is inserted into the USB Type-C socket in a reverse insertion manner, power is supplied to the slave device; and the master control program is burned into the microcontroller unit of the slave device by running the slave burning program.

[0025] Here Figure 2 As shown, when the USB Type-C plug of the embodiment of the present invention is inserted into the USB Type-C socket in a reverse insertion manner, the B12, B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, and A12 pins on the plug are respectively connected with the corresponding A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the socket; the A4 / B4 and A9 / B9 pins on the plug are used for power supply, the A6 and A7 pins are used for data transmission; and the B6 and B7 pins on the socket are used for data transmission.

[0026] It should be noted that the slave burning program of the embodiment of the present invention includes a first drive unit and a first UI unit. When the slave burning program is started and executed, the first drive unit and the first UI unit are started; after the first drive unit is started, when the USB Type-C plug is inserted into the USB Type-C socket in reverse, a connection is established with the program burning interface of the micro control unit of the slave device through the A6 and A7 pins of the USB Type-C plug; after the first UI unit is started, it is used to receive the first master control program code input by the user; and the first master control program code is loaded onto the micro control unit of the slave device by calling the first drive unit.

[0027] Step 4, when the USB Type-C plug is inserted into the USB Type-C socket in a normal insertion manner, power is supplied to the slave device; and a device command interaction operation is performed on the microcontroller unit of the slave device by running the slave command interaction program.

[0028] Here Figure 3 As shown, when the USB Type-C plug of the embodiment of the present invention is inserted into the USB Type-C socket in a positive insertion manner, the A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the plug are respectively connected with the corresponding A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the socket; the A4 / B4 and A9 / B9 pins on the plug are used for power supply, and the A6 and A7 pins are used for data transmission; the A6 and A7 pins on the socket are used for data transmission.

[0029] It should be noted that the slave instruction interaction program of the embodiment of the present invention includes a second drive unit and a second UI unit. When the slave instruction interaction program is started and executed, the second UI unit and the second drive unit are started; after the second drive unit is started, when the USB Type-C plug is inserted into the USB Type-C socket in a normal insertion manner, the second drive unit is used to establish a connection with the input / output data interface of the micro control unit of the slave device through the A6 and A7 pins of the USB Type-C plug; after the second UI unit is started, it is used to receive the first device instruction input by the user; and the first device instruction is sent to the micro control unit of the slave device by calling the second drive unit, and the first instruction feedback data sent back by the micro control unit is received through the second drive unit.

[0030] It should also be noted that after successfully loading a version of the master control program code, the micro-control unit of the slave device in the embodiment of the present invention uses it as the current master control program and runs it; and based on the current master control program, it performs instruction parsing and instruction execution operations on the device instructions issued by the host device to obtain corresponding instruction feedback data and send it back to the host device.

[0031] In summary, the embodiment of the present invention provides a method for switching the working mode of a device based on the forward and reverse plugging of a Type-C interface. The embodiment of the present invention loads a USB Type-C plug on a host device, and installs a slave burning program and a slave instruction interaction program; and loads a USB Type-C socket on a slave device, and connects the A6 and A7 pins of the socket to the input / output data interface of a microcontroller unit of the slave device, and connects the B6 and B7 pins to the program burning interface of the microcontroller unit; and when the USB Type-C plug is inserted into the USB Type-C socket in a reverse plugging manner, the slave device is powered by the plug pins (A4 / B4, A9 / B9), and the current working mode is regarded as a slave burning mode, and the microcontroller unit is burned by running the slave burning program; and when the USB Type-C plug is inserted into the USB Type-C socket in a forward plugging manner, the slave device is powered by the plug pins (A4 / B4, A9 / B9), and the current working mode is regarded as a slave data communication mode, and the microcontroller unit is operated to perform a device instruction interaction operation by running the slave instruction interaction program. The implementation of the present invention can connect two working modes based on the same USB Type-C interface; the implementation of the present invention not only reduces the design complexity and the production cost, but also improves the single product yield.

[0032] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0033] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0034] The above specific implementation methods further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for switching device working modes based on forward and reverse insertion of a Type-C interface, characterized in that: The method comprises: Load a USB Type-C plug on the host device; and install a slave burning program and a slave command interaction program on the host device; Load a USB Type-C socket on the slave device; connect the A6 and A7 pins of the USB Type-C socket to the input / output data interface of the micro control unit of the slave device; and connect the B6 and B7 pins of the USB Type-C socket to the program burning interface of the micro control unit; When the USB Type-C plug is inserted into the USB Type-C socket in a reverse insertion manner, the slave device is powered; and the microcontroller unit of the slave device is burned with a master control program by running the slave burning program; When the USB Type-C plug is inserted into the USB Type-C socket in a normal insertion manner, the slave device is powered; and the device command interaction operation is performed on the micro control unit of the slave device by running the slave command interaction program.

2. The method for switching device working modes based on forward and reverse insertion of Type-C interface according to claim 1, characterized in that: When the USB Type-C plug is inserted into the USB Type-C socket in a reverse insertion manner, the B12, B11, B10, B9, B8, B7, B6, B5, B4, B3, B2, B1, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, and A12 pins on the plug are respectively connected with the corresponding A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the socket; the A4 / B4 and A9 / B9 pins on the plug are used for power supply, the A6 and A7 pins are used for data transmission; and the B6 and B7 pins on the socket are used for data transmission.

3. The method for switching device working modes based on forward and reverse insertion of Type-C interface according to claim 1, characterized in that: When the USB Type-C plug is inserted into the USB Type-C socket in a positive insertion manner, the A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the plug are respectively connected with the corresponding A12, A11, A10, A9, A8, A7, A6, A5, A4, A3, A2, A1, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, B11, and B12 pins on the socket; the A4 / B4 and A9 / B9 pins on the plug are used for power supply, and the A6 and A7 pins are used for data transmission; the A6 and A7 pins on the socket are used for data transmission.

4. The method for switching device working modes based on forward and reverse insertion of Type-C interface according to claim 1, characterized in that: The slave burning program includes a first drive unit and a first UI unit; when the slave burning program is started and executed, the first drive unit and the first UI unit are started; after the first drive unit is started, when the USB Type-C plug is inserted into the USB Type-C socket in a reverse insertion manner, a connection is established with the program burning interface of the micro control unit of the slave device through the A6 and A7 pins of the USB Type-C plug; after the first UI unit is started, it is used to receive a first master control program code input by a user; And the first master control program code is loaded onto the micro control unit of the slave device by calling the first driving unit.

5. The method for switching device working modes based on forward and reverse insertion of Type-C interface according to claim 1, characterized in that: The slave instruction interaction program includes a second driving unit and a second UI unit; when the slave instruction interaction program is started and executed, the second UI unit and the second driving unit are started; after the second driving unit is started, when the USB Type-C plug is inserted into the USB Type-C socket in a normal insertion manner, a connection is established with the input / output data interface of the microcontroller unit of the slave device through the A6 and A7 pins of the USB Type-C plug; after the second UI unit is started, it is used to receive a first device instruction input by a user; The first device instruction is sent to the micro control unit of the slave device by calling the second driving unit, and the first instruction feedback data sent back by the micro control unit is received by the second driving unit.

6. The method for switching device working modes based on forward and reverse insertion of Type-C interface according to claim 1, characterized in that: After successfully loading a version of the master control program code, the micro control unit of the slave device uses it as the current master control program and runs it; and based on the current master control program, it performs instruction parsing and instruction execution operations on the device instructions issued by the host device to obtain corresponding instruction feedback data and send it back to the host device.