UART (Universal Asynchronous Receiver / Transmitter) expansion application method and system based on MTK platform and storage medium

By obtaining level information and sending handshake instructions on the MTK platform for automatic identification, the problem of insufficient number of UART interfaces on the MTK platform is solved, and the expansion and automatic identification of UART interfaces are realized, and the fault tolerance rate is improved.

CN119537270AActive Publication Date: 2025-02-28SHENZHEN TIANLONG CENTURY TECH DEV

Patent Information

Application Number
CN202510093181.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-02-28
Estimated Expiration
2045-01-21

AI Technical Summary

Technical Problem

Some MTK platforms only set up one UART interface, and cannot access peripheral devices of multiple UART interfaces, resulting in the inability to effectively expand the number of UART interfaces.

Method used

By acquiring level information, a handshake command is sent for automatic identification, and a UART communication configuration is set according to the recognition results to increase the number of connections to the UART interface.

Benefits of technology

The number of UART peripherals connected to the MTK platform is increased, and the peripheral devices are automatically identified to avoid the problem of inability to communicate due to accessing the wrong channel, and to improve the fault tolerance rate of production work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537270A_ABST
    Figure CN119537270A_ABST
Patent Text Reader

Abstract

The invention provides a UART (Universal Asynchronous Receiver / Transmitter) expansion application method and system based on an MTK (Media Tek) platform and a storage medium, and the method comprises the steps: firstly, judging whether peripheral equipment is accessed or not according to first level information; when the access of the peripheral equipment exists, acquiring first serial number information of the accessed UART interface, and then sending a first handshake instruction according to the first serial number information; then, if a first handshake feedback instruction is received, determining first peripheral coding information according to the first handshake feedback instruction; and finally, according to the first serial number information and the first peripheral coding information, configuring UART communication configuration of the MTK platform, so as to establish communication connection with the peripheral. Through a mode of automatically identifying and configuring the UART interface, the number of the UART peripherals accessed to the MTK platform is increased, the problem that communication cannot be carried out due to the fact that the peripherals are accessed to wrong channels is avoided, and the error-tolerant rate of production work is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of serial port expansion, and more specifically, to a UART expansion application method, system and storage medium based on an MTK platform. Background Art

[0002] MTK platform refers to a chip platform developed by MediaTek, which is widely used in smart devices such as smartphones, tablets, smart watches, etc. UART, short for serial port, is a universal asynchronous receiver-transmitter, an interface standard for asynchronous serial communication. UART is widely used in data communication between microcontrollers, computers and other digital devices.

[0003] However, since some MTK platforms only have one UART interface, they cannot access peripheral devices with multiple UART interfaces. Therefore, there is an urgent need for a UART expansion application technology that can expand the UART interface of the MTK platform and automatically identify peripheral devices. Summary of the invention

[0004] In view of the above problems, the purpose of the present invention is to provide a UART expansion application method, system and storage medium based on the MTK platform, which increases the number of connections of communicative UART peripherals through expansion based on the MTK platform; in addition, after detecting the access of the peripheral, the peripheral will be automatically identified, and the corresponding communication protocol will be configured for the peripheral; by setting the UART communication configuration, the communication between the MTK platform and the UART peripheral is ensured; thereby increasing the number of UART peripherals connected to the MTK platform, and automatically identifying the peripherals, avoiding the problem of being unable to communicate due to the peripheral accessing the wrong channel, and improving the fault tolerance of production work.

[0005] A first aspect of the present invention provides a UART expansion application method based on the MTK platform, the method comprising: Acquiring first level information; Determining whether the first level information is switched to a preset level threshold; If yes, determining first number information according to the first level information; Sending a first handshake instruction according to the first number information; Determining whether a first handshake feedback instruction is received; If yes, determining the first peripheral device encoding information according to the first handshake feedback instruction; The UART communication configuration is set according to the first numbering information and the first peripheral encoding information.

[0006] In this solution, the determination of whether the first handshake feedback instruction is received is specifically: According to the preset handshake instruction library, the first handshake instruction is obtained and sent in sequence; Within a preset first time, determining whether feedback instruction information is received; If yes, the feedback instruction information is a first handshake feedback instruction; If not, update the first timeout number information; Determining whether to send a handshake instruction again according to the first timeout number information; If not, the first handshake feedback instruction is not received.

[0007] In this solution, judging whether to send the first handshake instruction again according to the first timeout number information is specifically: Determine whether the first timeout number information is lower than a preset number threshold; If yes, resend the first handshake instruction; If not, determining whether the first handshake instruction is the last handshake instruction in the handshake instruction library; If yes, stop sending handshake instructions; If not, the first handshake instruction is acquired and sent in sequence according to the preset handshake instruction library.

[0008] In this solution, the first peripheral encoding information is determined according to the first handshake feedback instruction, specifically: Obtaining communication protocol information according to the first handshake feedback instruction; Analyze the frame header information, frame tail information and check information of the communication protocol information to determine the peripheral communication device; According to the peripheral communication device, first peripheral coding information is obtained.

[0009] This plan also includes: The peripheral communication device includes at least a Beidou positioning module and an RFID module.

[0010] This plan also includes: The SPI interface is converted to UART interface through the conversion chip CH432T.

[0011] A second aspect of the present invention provides a UART expansion application system based on the MTK platform, including a UART expansion application method program based on the MTK platform, wherein the UART expansion application method program based on the MTK platform implements the following steps when executed by the processor: Acquiring first level information; Determining whether the first level information is switched to a preset level threshold; If yes, determining first number information according to the first level information; Sending a first handshake instruction according to the first number information; Determining whether a first handshake feedback instruction is received; If yes, determining the first peripheral device encoding information according to the first handshake feedback instruction; The UART communication configuration is set according to the first numbering information and the first peripheral encoding information.

[0012] In this solution, the determination of whether the first handshake feedback instruction is received is specifically: According to the preset handshake instruction library, the first handshake instruction is obtained and sent in sequence; Within a preset first time, determining whether feedback instruction information is received; If yes, the feedback instruction information is a first handshake feedback instruction; If not, update the first timeout number information; Determining whether to send a handshake instruction again according to the first timeout number information; If not, the first handshake feedback instruction is not received.

[0013] In this solution, the first peripheral encoding information is determined according to the first handshake feedback instruction, specifically: Obtaining communication protocol information according to the first handshake feedback instruction; Analyze the frame header information, frame tail information and check information of the communication protocol information to determine the peripheral communication device; According to the peripheral communication device, first peripheral coding information is obtained.

[0014] The third aspect of the present invention provides a computer-readable storage medium, which includes a UART expansion application method program based on the MTK platform. When the UART expansion application method program based on the MTK platform is executed by a processor, the steps of the UART expansion application method based on the MTK platform as described in any one of the above items are implemented.

[0015] The present invention provides a UART expansion application method, system and storage medium based on an MTK platform. First, it is determined whether a peripheral device is connected according to first level information; when a peripheral device is connected, first number information of the connected UART interface is obtained, and a first handshake instruction is sent according to the first number information; then, if a first handshake feedback instruction is received, first peripheral coding information is determined according to the first handshake feedback instruction; finally, according to the first number information and the first peripheral coding information, the UART communication configuration of the MTK platform is configured to establish a communication connection with the peripheral device; by automatically identifying and configuring the UART interface, the number of UART peripheral devices connected to the MTK platform is increased, while the problem of being unable to communicate due to the peripheral device accessing an incorrect channel is avoided, thereby improving the fault tolerance rate of production work. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and should not be regarded as limiting the scope.

[0017] Figure 1 A flow chart of a UART expansion application method based on the MTK platform of the present invention is shown; Figure 2 A flowchart of receiving a first handshake feedback instruction provided by an embodiment of the present invention is shown; Figure 3 A flowchart of confirming first peripheral encoding information provided by an embodiment of the present invention is shown; Figure 4 A block diagram of a UART expansion application system based on the MTK platform of the present invention is shown. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0019] Unless otherwise defined, all terms (including technical and scientific terms) used in the embodiments of the present invention have the same meanings as commonly understood by those skilled in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be interpreted as having meanings consistent with their meanings in the context of the relevant technology, and should not be interpreted in an idealized or extremely formal sense, unless the embodiments of the present invention are explicitly defined in this way.

[0020] The words "first", "second" and similar words used in the embodiments of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. Words such as "one", "an" or "the" and similar words do not indicate a quantity limitation, but indicate the existence of at least one. Similarly, words such as "include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The steps before or after the method of the embodiment of the present invention are not necessarily carried out in order. On the contrary, various steps can be processed in reverse order or simultaneously. At the same time, other operations can also be added to these processes, or a step or several steps can be removed from these processes.

[0021] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.

[0022] Figure 1 The flowchart of a UART expansion application method based on the MTK platform of the present invention is shown.

[0023] like Figure 1 As shown, the first aspect of the present invention discloses a UART expansion application method based on the MTK platform, the method comprising: S102, obtaining first level information; S104, determining whether the first level information is a preset level threshold; S106, if yes, determining first number information according to the first level information; S108, sending a first handshake instruction according to the first numbering information; S110, determining whether a first handshake feedback instruction is received; S112: If yes, determining first peripheral device encoding information according to the first handshake feedback instruction; S114, setting UART communication configuration according to the first numbering information and the first peripheral encoding information.

[0024] It should be noted that the first level information is an interface level value used to detect the insertion of a peripheral device, and includes at least two level states, namely a high level and a low level; a switch circuit or the like is usually used, and when a peripheral device is connected, the output level of the switch circuit changes. The first numbering information is the number of the UART interface, which is used to configure the UART interface of the MTK platform. The first handshake instruction is an instruction for establishing a communication connection set according to a preset communication protocol of the peripheral device; the first handshake feedback instruction is a communication instruction that the peripheral device feeds back to the MTK platform according to the correct first handshake instruction. The first peripheral coding information is a code set according to the peripheral device, for example, the code of the Beidou positioning module is 0x01, and the code of the RFID module is 0x02.

[0025] In this embodiment, if the first level information is switched to a preset level threshold, it indicates that the set UART interface is newly connected to a peripheral device, then the number of the UART interface connected to the peripheral device is determined according to the first level information, and the first number information is obtained. A first handshake instruction is sent to the peripheral device through the UART interface pointed to by the first number information. If a communication instruction fed back by the peripheral device, i.e., a first feedback instruction, is received, it indicates that the UART interface pointed to by the first number information has established a connection with the peripheral device; and the encoding of the peripheral device is determined according to the first feedback instruction. Finally, the communication protocol is determined according to the encoding of the peripheral device, and then the communication configuration parameters of the corresponding UART interface are set according to the first number information.

[0026] Figure 2 A flow chart of receiving a first handshake feedback instruction provided by an embodiment of the present invention is shown.

[0027] According to an embodiment of the present invention, Figure 2 As shown, the determination of whether the first handshake feedback instruction is received is specifically as follows: S202, according to a preset handshake instruction library, sequentially obtain and send a first handshake instruction; S204, determining whether feedback instruction information is received within a preset first time; S206: If yes, the feedback instruction information is a first handshake feedback instruction; S208, if not, updating the first timeout number information; S210, judging whether to send a handshake instruction again according to the first timeout number information; S212: If not, the first handshake feedback instruction is not received.

[0028] It should be noted that, in the present embodiment, handshake instructions are sent in sequence according to the handshake instruction library, and whether the feedback instruction information is received within the preset first time is judged to determine whether the first handshake feedback instruction is received. First, according to the preset handshake instruction library, the first handshake instruction is obtained in sequence and then the handshake instruction is sent to the peripheral device; if the feedback instruction information returned by the peripheral device is received within the preset first time, it means that the handshake with the peripheral device is successful, that is, the communication is successfully established, and the feedback instruction information of the peripheral device is the first handshake feedback instruction; if the feedback instruction information is not received within the preset first time, it means that the handshake fails, and the first timeout number information of the current first handshake instruction is updated. Finally, it is judged whether the handshake instruction needs to be sent again according to the first timeout number information. If not, it means that the handshake of the peripheral device fails and the communication connection cannot be established, that is, it is determined that the first handshake feedback instruction has not been received.

[0029] According to an embodiment of the present invention, judging whether to send the first handshake instruction again according to the first timeout number information is specifically: Determine whether the first timeout number information is lower than a preset number threshold; If yes, resend the first handshake instruction; If not, determining whether the first handshake instruction is the last handshake instruction in the handshake instruction library; If yes, stop sending handshake instructions; If not, the first handshake instruction is acquired and sent in sequence according to the preset handshake instruction library.

[0030] It should be noted that, in the present embodiment, the handshake instructions in the handshake instruction library are switched according to the first timeout number information. When the first timeout number information is lower than the preset number threshold, the current first handshake instruction is resent. When the first timeout number information is not lower than the preset number threshold, the handshake instruction is switched from the handshake instruction library. When the handshake instruction switching is required, it is determined whether the current first handshake instruction is the last handshake instruction in the handshake instruction library; if so, it means that all handshake instructions and peripheral devices cannot shake hands successfully, then stop sending handshake instructions; if not, select the next handshake instruction in the handshake instruction library to set it as the first handshake instruction.

[0031] Figure 3 A flow chart for confirming first peripheral encoding information provided by an embodiment of the present invention is shown.

[0032] According to an embodiment of the present invention, Figure 3 As shown, the first peripheral encoding information is determined according to the first handshake feedback instruction, specifically: S302, obtaining communication protocol information according to the first handshake feedback instruction; S304, analyzing the frame header information, frame tail information and check information of the communication protocol information to determine the peripheral communication device; S306: Obtain first peripheral coding information according to the peripheral communication device.

[0033] It should be noted that, in this embodiment, the communication protocol in the handshake feedback instruction is analyzed to confirm the encoding of the peripheral communication device. First, according to the first handshake feedback instruction, the communication protocol information is obtained, which includes but is not limited to the frame header, frame tail, and verification method in the communication data frame. Then, according to the communication protocol information, the type of the peripheral device is determined by querying the communication protocol in the stored peripheral device list, thereby determining the encoding of the peripheral device.

[0034] According to an embodiment of the present invention, it also includes: The peripheral communication device includes at least a Beidou positioning module and an RFID module.

[0035] It should be noted that in this embodiment, the peripheral communication devices that the MTK platform needs to connect to at least include a Beidou positioning module and an RFID module. The Beidou positioning module refers to an electronic module that integrates the Beidou satellite navigation system positioning technology. It can receive signals sent by Beidou satellites and calculate the receiver's precise position, speed, time and other information through an internal processing algorithm, and then communicate with the MTK platform through a UART interface. The RFID module, or radio frequency identification module, is a wireless electronic tag system that can identify tags on items through electromagnetic fields and then communicate with the MTK platform through a UART interface.

[0036] According to an embodiment of the present invention, it also includes: The SPI interface is converted to UART interface through the conversion chip CH432T.

[0037] It should be noted that, as an implementation method, the UART interface expansion of the MTK platform is realized through a conversion chip. CH432T is a UART interface conversion chip, which can convert USB interface, SPI interface and other interfaces into independent UART interfaces, and is used to provide additional communication channels when serial port resources are limited.

[0038] It is worth mentioning that it also includes: Obtaining first peripheral encoding information; Determining whether the first peripheral device coding information is a preset peripheral device coding; If yes, determine whether the encoding of the peripheral device in the UART communication connection state is the same as the first peripheral device encoding information; If so, an installation exception instruction is generated according to the first peripheral encoding information.

[0039] It should be noted that in this embodiment, the peripheral device is automatically identified to determine whether the peripheral device has abnormal conditions such as repeated installation. In actual applications, only one individual communication module will be used on the same MTK platform. For example, only one Beidou positioning module is installed. In this embodiment, after detecting a newly connected peripheral device, based on the first peripheral coding information of the newly connected peripheral device and the coding of the peripheral device connected to the configured UART interface, it is determined whether there is a situation of repeated installation of the set peripheral device. If so, an installation exception instruction is generated based on the first peripheral coding information to indicate that the peripheral device corresponding to the first peripheral coding information is installed abnormally.

[0040] It is worth mentioning that it also includes: Obtaining communication protocol information according to the first handshake feedback instruction; Sending a first verification instruction according to the communication protocol information and in combination with preset verification data; Obtaining a first verification feedback instruction; According to the first feedback instruction, the UART communication configuration is adjusted.

[0041] It should be noted that, in the present embodiment, after the handshake of the peripheral device is successful, a secondary check will be performed to ensure the accuracy of the device communication. First, according to the first handshake feedback instruction, the communication protocol information is obtained. Then, in combination with the preset verification data, the first verification instruction is sent. If the first verification feedback instruction is received normally, the UART communication configuration is not adjusted. If the first verification feedback instruction is received abnormally, the UART communication configuration is adjusted to disconnect the connection between the peripheral device and the MTK platform, and the device is re-identified and verified.

[0042] Figure 4 A block diagram of a UART expansion application system based on the MTK platform of the present invention is shown.

[0043] like Figure 4 As shown, the second aspect of the present invention discloses a UART expansion application system 4 based on the MTK platform, including a memory 41 and a processor 42, wherein the memory includes a UART expansion application method program based on the MTK platform, and the UART expansion application method program based on the MTK platform is executed by the processor to implement the following steps: Acquiring first level information; Determining whether the first level information is a preset level threshold; If yes, determining first number information according to the first level information; Sending a first handshake instruction according to the first number information; Determining whether a first handshake feedback instruction is received; If yes, determining the first peripheral device encoding information according to the first handshake feedback instruction; The UART communication configuration is set according to the first numbering information and the first peripheral encoding information.

[0044] It should be noted that the first level information is an interface level value used to detect the insertion of a peripheral device, and includes at least two level states, namely a high level and a low level; a switch circuit or the like is usually used, and when a peripheral device is connected, the output level of the switch circuit changes. The first numbering information is the number of the UART interface, which is used to configure the UART interface of the MTK platform. The first handshake instruction is an instruction for establishing a communication connection set according to a preset communication protocol of the peripheral device; the first handshake feedback instruction is a communication instruction that the peripheral device feeds back to the MTK platform according to the correct first handshake instruction. The first peripheral coding information is a code set according to the peripheral device, for example, the code of the Beidou positioning module is 0x01, and the code of the RFID module is 0x02.

[0045] In this embodiment, if the first level information is switched to a preset level threshold, it indicates that the set UART interface is newly connected to a peripheral device, then the number of the UART interface connected to the peripheral device is determined according to the first level information, and the first number information is obtained. A first handshake instruction is sent to the peripheral device through the UART interface pointed to by the first number information. If a communication instruction fed back by the peripheral device, i.e., a first feedback instruction, is received, it indicates that the UART interface pointed to by the first number information has established a connection with the peripheral device; and the encoding of the peripheral device is determined according to the first feedback instruction. Finally, the communication protocol is determined according to the encoding of the peripheral device, and then the communication configuration parameters of the corresponding UART interface are set according to the first number information.

[0046] According to an embodiment of the present invention, the determining whether the first handshake feedback instruction is received is specifically: According to the preset handshake instruction library, the first handshake instruction is obtained and sent in sequence; Within a preset first time, determining whether feedback instruction information is received; If yes, the feedback instruction information is a first handshake feedback instruction; If not, update the first timeout number information; Determining whether to send a handshake instruction again according to the first timeout number information; If not, the first handshake feedback instruction is not received.

[0047] It should be noted that, in the present embodiment, handshake instructions are sent in sequence according to the handshake instruction library, and whether the feedback instruction information is received within the preset first time is judged to determine whether the first handshake feedback instruction is received. First, according to the preset handshake instruction library, the first handshake instruction is obtained in sequence and then the handshake instruction is sent to the peripheral device; if the feedback instruction information returned by the peripheral device is received within the preset first time, it means that the handshake with the peripheral device is successful, that is, the communication is successfully established, and the feedback instruction information of the peripheral device is the first handshake feedback instruction; if the feedback instruction information is not received within the preset first time, it means that the handshake fails, and the first timeout number information of the current first handshake instruction is updated. Finally, it is judged whether the handshake instruction needs to be sent again according to the first timeout number information. If not, it means that the handshake of the peripheral device fails and the communication connection cannot be established, that is, it is determined that the first handshake feedback instruction has not been received.

[0048] According to an embodiment of the present invention, judging whether to send the first handshake instruction again according to the first timeout number information is specifically: Determine whether the first timeout number information is lower than a preset number threshold; If yes, resend the first handshake instruction; If not, determining whether the first handshake instruction is the last handshake instruction in the handshake instruction library; If yes, stop sending handshake instructions; If not, the first handshake instruction is acquired and sent in sequence according to the preset handshake instruction library.

[0049] It should be noted that, in the present embodiment, the handshake instructions in the handshake instruction library are switched according to the first timeout number information. When the first timeout number information is lower than the preset number threshold, the current first handshake instruction is resent. When the first timeout number information is not lower than the preset number threshold, the handshake instruction is switched from the handshake instruction library. When the handshake instruction switching is required, it is determined whether the current first handshake instruction is the last handshake instruction in the handshake instruction library; if so, it means that all handshake instructions and peripheral devices cannot shake hands successfully, then stop sending handshake instructions; if not, select the next handshake instruction in the handshake instruction library to set it as the first handshake instruction.

[0050] According to an embodiment of the present invention, determining the first peripheral encoding information according to the first handshake feedback instruction is specifically: Obtaining communication protocol information according to the first handshake feedback instruction; Analyze the frame header information, frame tail information and check information of the communication protocol information to determine the peripheral communication device; According to the peripheral communication device, first peripheral coding information is obtained.

[0051] It should be noted that, in this embodiment, the communication protocol in the handshake feedback instruction is analyzed to confirm the encoding of the peripheral communication device. First, according to the first handshake feedback instruction, the communication protocol information is obtained, which includes but is not limited to the frame header, frame tail, and verification method in the communication data frame. Then, according to the communication protocol information, the type of the peripheral device is determined by querying the communication protocol in the stored peripheral device list, thereby determining the encoding of the peripheral device.

[0052] According to an embodiment of the present invention, it also includes: The peripheral communication device includes at least a Beidou positioning module and an RFID module.

[0053] It should be noted that in this embodiment, the peripheral communication devices that the MTK platform needs to connect to at least include a Beidou positioning module and an RFID module. The Beidou positioning module refers to an electronic module that integrates the Beidou satellite navigation system positioning technology. It can receive signals sent by Beidou satellites and calculate the receiver's precise position, speed, time and other information through an internal processing algorithm, and then communicate with the MTK platform through a UART interface. The RFID module, or radio frequency identification module, is a wireless electronic tag system that can identify tags on items through electromagnetic fields and then communicate with the MTK platform through a UART interface.

[0054] According to an embodiment of the present invention, it also includes: The SPI interface is converted to UART interface through the conversion chip CH432T.

[0055] It should be noted that, as an implementation method, the UART interface expansion of the MTK platform is realized through a conversion chip. CH432T is a UART interface conversion chip, which can convert USB interface, SPI interface and other interfaces into independent UART interfaces, and is used to provide additional communication channels when serial port resources are limited.

[0056] It is worth mentioning that it also includes: Obtaining first peripheral encoding information; Determining whether the first peripheral device coding information is a preset peripheral device coding; If yes, determine whether the encoding of the peripheral device in the UART communication connection state is the same as the first peripheral device encoding information; If so, an installation exception instruction is generated according to the first peripheral encoding information.

[0057] It should be noted that in this embodiment, the peripheral device is automatically identified to determine whether the peripheral device has abnormal conditions such as repeated installation. In actual applications, only one individual communication module will be used on the same MTK platform. For example, only one Beidou positioning module is installed. In this embodiment, after detecting a newly connected peripheral device, based on the first peripheral coding information of the newly connected peripheral device and the coding of the peripheral device connected to the configured UART interface, it is determined whether there is a situation of repeated installation of the set peripheral device. If so, an installation exception instruction is generated based on the first peripheral coding information to indicate that the peripheral device corresponding to the first peripheral coding information is installed abnormally.

[0058] It is worth mentioning that it also includes: Obtaining communication protocol information according to the first handshake feedback instruction; Sending a first verification instruction according to the communication protocol information and in combination with preset verification data; Obtaining a first verification feedback instruction; According to the first feedback instruction, the UART communication configuration is adjusted.

[0059] It should be noted that, in the present embodiment, after the handshake of the peripheral device is successful, a secondary check will be performed to ensure the accuracy of the device communication. First, according to the first handshake feedback instruction, the communication protocol information is obtained. Then, in combination with the preset verification data, the first verification instruction is sent. If the first verification feedback instruction is received normally, the UART communication configuration is not adjusted. If the first verification feedback instruction is received abnormally, the UART communication configuration is adjusted to disconnect the connection between the peripheral device and the MTK platform, and the device is re-identified and verified.

[0060] The third aspect of the present invention provides a computer-readable storage medium, which includes a UART expansion application method program based on the MTK platform. When the UART expansion application method program based on the MTK platform is executed by a processor, the steps of the UART expansion application method based on the MTK platform as described in any one of the above items are implemented.

[0061] In summary, the present invention provides a UART expansion application method, system and storage medium based on the MTK platform. First, it is determined whether a peripheral device is connected according to the first level information; when a peripheral device is connected, the first numbering information of the connected UART interface is obtained, and then the first handshake instruction is sent according to the first numbering information; then, if the first handshake feedback instruction is received, the first peripheral coding information is determined according to the first handshake feedback instruction; finally, according to the first numbering information and the first peripheral coding information, the UART communication configuration of the MTK platform is configured to establish a communication connection with the peripheral; by automatically identifying and configuring the UART interface, the number of UART peripherals connected to the MTK platform is increased, while the problem of being unable to communicate due to the peripheral accessing the wrong channel is avoided, thereby improving the fault tolerance rate of production work.

[0062] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0063] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A UART expansion application method based on MTK platform, characterized in that: The method comprises: Acquiring first level information; Determining whether the first level information is switched to a preset level threshold; If yes, determining first number information according to the first level information; Sending a first handshake instruction according to the first number information; Determining whether a first handshake feedback instruction is received; If yes, determining the first peripheral device encoding information according to the first handshake feedback instruction; The UART communication configuration is set according to the first numbering information and the first peripheral encoding information.

2. The UART expansion application method based on the MTK platform according to claim 1, characterized in that: The determining whether the first handshake feedback instruction is received is specifically: According to the preset handshake instruction library, the first handshake instruction is obtained and sent in sequence; Within a preset first time, determining whether feedback instruction information is received; If yes, the feedback instruction information is a first handshake feedback instruction; If not, update the first timeout number information; Determining whether to send a handshake instruction again according to the first timeout number information; If not, the first handshake feedback instruction is not received.

3. The UART expansion application method based on the MTK platform according to claim 2, characterized in that: The determining, according to the first timeout number information, whether to send the first handshake instruction again is specifically: Determine whether the first timeout number information is lower than a preset number threshold; If yes, resend the first handshake instruction; If not, determining whether the first handshake instruction is the last handshake instruction in the handshake instruction library; If yes, stop sending handshake instructions; If not, the first handshake instruction is acquired and sent in sequence according to the preset handshake instruction library.

4. The UART expansion application method based on the MTK platform according to claim 1, characterized in that: The determining the first peripheral encoding information according to the first handshake feedback instruction is specifically: Obtaining communication protocol information according to the first handshake feedback instruction; Analyze the frame header information, frame tail information and check information of the communication protocol information to determine the peripheral communication device; According to the peripheral communication device, first peripheral coding information is obtained.

5. The UART expansion application method based on the MTK platform according to claim 4, characterized in that: Also includes: The peripheral communication device includes at least a Beidou positioning module and an RFID module.

6. The UART expansion application method based on the MTK platform according to claim 1, characterized in that: Also includes: The SPI interface is converted to UART interface through the conversion chip CH432T.

7. A UART expansion application system based on MTK platform, characterized in that: The system includes a memory and a processor, wherein the memory includes a UART expansion application method program based on the MTK platform, and the UART expansion application method program based on the MTK platform implements the following steps when executed by the processor: Acquiring first level information; Determining whether the first level information is switched to a preset level threshold; If yes, determining first number information according to the first level information; Sending a first handshake instruction according to the first number information; Determining whether a first handshake feedback instruction is received; If yes, determining the first peripheral device encoding information according to the first handshake feedback instruction; The UART communication configuration is set according to the first numbering information and the first peripheral encoding information.

8. The UART expansion application system based on the MTK platform according to claim 7, characterized in that: The determining whether the first handshake feedback instruction is received is specifically: According to the preset handshake instruction library, the first handshake instruction is obtained and sent in sequence; Within a preset first time, determining whether feedback instruction information is received; If yes, the feedback instruction information is a first handshake feedback instruction; If not, update the first timeout number information; Determining whether to send a handshake instruction again according to the first timeout number information; If not, the first handshake feedback instruction is not received.

9. The UART expansion application system based on the MTK platform according to claim 7, characterized in that: The determining the first peripheral encoding information according to the first handshake feedback instruction is specifically: Obtaining communication protocol information according to the first handshake feedback instruction; Analyze the frame header information, frame tail information and check information of the communication protocol information to determine the peripheral communication device; According to the peripheral communication device, first peripheral coding information is obtained.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer-readable storage medium includes a UART expansion application method program based on the MTK platform. When the UART expansion application method program based on the MTK platform is executed by the processor, the steps of the UART expansion application method based on the MTK platform as described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • A chip-based communication method and device

    CN109828938A

  • UART interface expansion circuit based on programmable logic device

    CN112395230A

  • Low-power-consumption serial port expansion method and system based on mobile equipment and storage medium

    CN116991223A

  • Multi-slave control method and system based on serial port communication and storage medium

    CN117349201A

  • Communication interface multiplexing method and device, communication system and storage medium

    CN117407342A

Cited By

  • High-power high-frequency RFID circuit based on MTK platform

    CN120218108A