Chip code generating and writing method and device

By generating a unique code through the host computer software and combining it with USB serial port communication and verification algorithms, the problems of code duplication and long communication time caused by the PLC control board are solved, and efficient and accurate chip code generation and writing are achieved, supporting accurate product identification and fault tracking.

CN120805946APending Publication Date: 2025-10-17NINGBO DEYE INVERTER TECHNOLOGY CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510622036.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-15
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the existing technology, when multiple people operate the PLC control panel at the same time, it causes repeated coding and long communication time, making it difficult to achieve accurate product identification and fault tracking.

Method used

The host computer software generates a unique code, communicates with the chip through the USB serial port communication protocol, combines the cyclic redundancy check algorithm and the two-way communication protocol, monitors the communication status in real time, and verifies the code after it is written, automating the code generation and writing process.

Benefits of technology

It improves the automation level of code writing, reduces the error rate, shortens the processing time, ensures the uniqueness and accuracy of the code, and facilitates product traceability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120805946A_ABST
    Figure CN120805946A_ABST
Patent Text Reader

Abstract

The invention discloses a chip code generating and writing method and device, and relates to the technical field of electronic information. The chip code generating and writing method comprises the following steps: S1, generating a unique code based on upper computer software; the upper computer software sends a reading instruction to the chip based on a USB serial port communication protocol to verify a communication state; s2, if the communication state is normal, the upper computer software sends a write-in instruction to write the unique code into a chip; s3, the upper computer sends the reading instruction again to obtain the code written by the chip, and the code written by the chip and the unique code are verified; s4, if the verification result is consistent, the upper computer software displays and outputs the two-dimensional code of the unique code; if the verification result is inconsistent, the step S1 is executed again; by improving the automation level of the code writing process, the error rate is reduced, and the processing speed is increased.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronic information, in particular to a chip code generation and writing method and device. BACKGROUND

[0002] Chip burning is a process of writing specific codes into chips through device sending instructions to realize accurate product identification and fault tracking.

[0003] In the prior art, the code writing method using PLC control board has the problem of code repetition when multiple people operate simultaneously, and the communication time is long, which is difficult to manage uniformly, affecting the identification accuracy and tracking efficiency of the product. SUMMARY

[0004] To solve the above problems, the present application provides a chip code generation and writing method, which improves the automation level of the code writing process, reduces the error rate and speeds up the processing speed; and a corresponding chip code generation and writing device is also provided to realize the chip code generation and writing method under different conditions.

[0005] The first technical solution adopted by the present application is to provide a chip code generation and writing method, comprising the following steps:

[0006] S1: generating a unique code based on the host computer software; the host computer software sends a read instruction to the chip based on the USB serial communication protocol to verify the communication state;

[0007] S2: if the communication state is normal, the host computer software sends a write instruction to write the unique code into the chip;

[0008] S3: the host computer sends a read instruction again to obtain the code written by the chip, and verifies the code written by the chip with the unique code;

[0009] S4: if the verification is consistent, the host computer software displays the two-dimensional code of the unique code and outputs; if the verification is inconsistent, step S1 is re-executed.

[0010] In step S2, if the communication state between the chip and the host computer software is abnormal, the communication failure information is automatically detected and displayed.

[0011] In step S3, the consistency of the code is verified by using the cyclic redundancy check (CRC) algorithm.

[0012] The second technical solution adopted by the present application is to provide a chip code generation and writing device, which can apply the chip code generation and writing method as claimed in any one of the above, comprising:

[0013] A host computer software module generates a unique code to be written into the chip based on a preset encoding rule;

[0014] A USB serial communication module is connected with the host computer software module; the USB serial communication module sends a read instruction and a write instruction to the chip;

[0015] An encoding verification module verifies whether the code returned by the chip is consistent with the unique code generated by the host computer software based on the encoding verification module;

[0016] A two-dimensional code generation module generates and displays a two-dimensional code corresponding to the unique code after the encoding verification is consistent.

[0017] The USB serial communication module adopts a bidirectional communication protocol to receive a response signal of the chip and determine the communication state between the host computer software module and the chip based on the response signal.

[0018] The encoding verification module triggers an alarm prompt when detecting that the codes are inconsistent and controls the host computer software module to regenerate the code and perform a write operation.

[0019] The preset encoding rule includes a combination algorithm of a timestamp, a station number, and a serial number to ensure the uniqueness of the generated code.

[0020] The device further includes a printing module to print the generated two-dimensional code on a product label to realize product traceability.

[0021] The third technical solution adopted by the present application is to provide an electronic device, which includes a memory and a processor coupled with each other, and the processor is configured to execute program instructions stored in the memory to implement the chip encoding generation and writing method according to any one of the above.

[0022] The fourth technical solution adopted by the present application is to provide a computer readable storage medium, which stores program data, and the program data can be executed by a processor to implement the chip encoding generation and writing method according to any one of the above.

[0023] Compared with the prior art, the present application has at least one of the following beneficial effects:

[0024] 1. By optimizing the USB serial communication protocol and the automatic encoding generation and writing process, the time for writing the chip code is reduced.

[0025] 2. The host computer software generates a unique code according to the preset encoding rule, and monitors the communication state of the chip in real time in combination with the bidirectional communication protocol, effectively avoiding the problem of code duplication that may occur when multiple people operate at the same time.

[0026] 3. After the code is written, the consistency of the code returned by the chip is verified through the cyclic redundancy check (CRC) algorithm, ensuring that the written information is accurate and correct.

[0027] 4. A two-dimensional code generation function is provided, and the two-dimensional code can be directly printed on the product label through a printing module, facilitating subsequent product tracking and management. BRIEF DESCRIPTION OF DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0029] Among them:

[0030] Figure 1 The flowchart of an embodiment of the chip code generation and writing method provided by the present application;

[0031] Figure 2 The framework diagram of an embodiment of the chip code generation and writing device provided by the present application;

[0032] Figure 3 The framework diagram of another embodiment of the chip code generation and writing device provided by the present application;

[0033] Figure 4 The structural diagram of an embodiment of the computer device provided by the present application;

[0034] Figure 5 The structural diagram of an embodiment of the computer readable storage medium provided by the present application. DETAILED DESCRIPTION

[0035] The technical solutions in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. It can be understood that the specific embodiments described herein are only used to explain the present application, not to limit the present application. In addition, it should be noted that only the parts related to the present application are shown in the drawings, not all the structures. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0036] The terms "first", "second", and the like in the specification are used to distinguish between different objects, not to describe a particular sequential order. Furthermore, the terms "comprise", "comprising", and the like are intended to cover non-exclusive inclusion. For example, processes, methods, articles, or equipment that comprise a list of steps or elements are not limited to the listed steps or elements, but can optionally further comprise additional steps or elements not listed.

[0037] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive or alternative embodiments. It is expressly understood that the embodiments described herein are combinable with each other.

[0038] In the prior art, the burning process is a widely used PLC method, which writes the allocated code into the chip through the use of a control board to achieve accurate identification and fault tracking of products. However, when using the control board to write the code, the problem of repeated writing of the code occurs when multiple people use the control board to write the code at multiple workstations. The communication time is relatively long when using the control board to write the code into the chip. Because the control board is difficult to manage uniformly in the process of generating the code, it is easy to cause the code to be repeatedly written into different chips, thereby failing to accurately identify and track the fault of the product. In order to solve the drawbacks of the existing code generation and writing method, the application provides a chip code generation and writing method, which improves the automation level of the code writing process, reduces the error rate and speeds up the processing speed, such as Figure 1 As shown in the figure, Figure 1 The flowchart of an embodiment of the chip code generation and writing method provided by the application includes the following steps:

[0039] S1: generating a unique code based on the upper computer software; when the user starts the code writing process, the upper computer software calls the code rule algorithm in real time, generates a unique code in combination with the current time, workstation information and serial number; the unique code generated by the upper computer software each time is stored in the historical database, and the upper computer software compares the unique code generated at the current time with the historical code in the historical database to ensure the uniqueness of the code generated at the current time; if a duplicate code is detected, a re-generation process is triggered immediately until a globally unique code is obtained.

[0040] The host computer software sends a read instruction to the chip based on a USB serial communication protocol to verify the communication state; the USB serial communication protocol includes a bidirectional handshake protocol and a retry mechanism, and the working principle of the USB serial communication protocol is a conventional technical means, which will not be described here. It needs to be clear that the application does not limit the communication protocol to the USB serial communication protocol. In other embodiments, the communication protocol can use I2C (Inter-Integrated Circuit), SPI (Serial Peripheral Interface), CAN, or Ethernet protocol.

[0041] S2: If the communication state is normal, the host computer software sends a write instruction to write a unique code into the chip; the format of the unique code is usually an ASCII string or binary data, and the storage format supported by the chip is usually HEX or a specific encoding structure. If the unique code is directly written into the chip, the chip cannot store the unique code. The host computer software can convert the generated unique code into a format that can be stored by the chip before writing it into the chip.

[0042] S3: The host computer sends a read instruction again to obtain the code written by the chip, and checks the code written by the chip with the unique code; after completing the code writing operation, the host computer software sends a read instruction to the chip through the USB serial communication module again to obtain the code information just written into the chip. After receiving the read instruction, the chip returns the internal stored code to the host computer software. After the host computer software obtains the code returned by the chip, it uses a specific algorithm to compare and check it with the unique code generated and written initially, and judges whether the writing operation is successful and whether there is an error in the data transmission process based on the comparison and checking result.

[0043] Through the re-reading and checking steps, data writing failure or data damage caused by hardware failure, communication error, etc. can be effectively detected, ensuring that the code in each chip is accurate and correct; ensuring the correctness of the code in the chip is crucial for subsequent product traceability; only when the code is accurate and correct, it can be effectively used for product identification and fault tracking, thereby improving the overall management level and service quality.

[0044] S4: If the check is consistent, the host computer software displays the two-dimensional code of the unique code and outputs; that is, when the code in the chip completely matches the unique code generated by the host computer, it means that the code writing is successful and the data is accurate and correct. At this time, the host computer software will display the two-dimensional code corresponding to the unique code, and can further output or print the two-dimensional code for product identification and subsequent traceability.

[0045] If the check is inconsistent, step S1 is re-executed; if it is found that the code in the chip does not match the unique code generated by the upper computer, it means that there may be a write failure, communication error or other problems; in this case, the system will prompt to re-execute step S1, that is, to start from generating a new unique code and re-attempt the entire code writing process.

[0046] The function of automatically triggering the re-execution of the writing process in the case of inconsistent check reduces the need for human intervention, reduces the operation complexity, and also ensures that even if the initial writing fails, the error can be quickly corrected, improving the reliability and stability of the system.

[0047] In summary, the chip code generation and writing method of the embodiment includes the following steps: S1: generating a unique code based on the upper computer software; the upper computer software sends a read instruction to the chip based on the USB serial communication protocol to verify the communication state; S2: if the communication state is normal, the upper computer software sends a write instruction to write the unique code into the chip; S3: the upper computer sends a read instruction again to obtain the code written by the chip, and checks the code written by the chip with the unique code; S4: if the check is consistent, the upper computer software displays the two-dimensional code of the unique code and outputs; if the check is inconsistent, step S1 is re-executed; by improving the automation level of the code writing process, the error rate is reduced and the processing speed is accelerated.

[0048] In step S2, if the communication state between the chip and the upper computer software is abnormal, the communication failure information is automatically detected and displayed; the upper computer software sends a read instruction to the chip based on the USB serial communication protocol to verify the communication state with the chip, if the chip fails to respond correctly or returns the expected data, the system will automatically identify this abnormal situation as a communication failure, after detecting the communication failure, the upper computer software will immediately display the corresponding communication failure information.

[0049] By monitoring and automatically detecting the communication state in real time, communication failures can be found and prompted at the first time, avoiding the waste of time and resources due to long waiting time; clear failure information can help users quickly locate the root cause of the problem, reduce troubleshooting time, and thus speed up the problem solving speed, improving the operation efficiency of the entire code writing process.

[0050] In step S3, the cyclic redundancy check (CRC) algorithm is used to verify the consistency of the code; after the writing operation is completed, the upper computer sends a read instruction again to read the code and its CRC check value just written from the chip; the upper computer uses the same CRC algorithm to re-calculate the CRC check value based on the read code data.

[0051] The newly calculated CRC value is compared with the CRC check value read back from the chip; if consistent, it means that the encoding writing is successful and no data corruption or error occurs; if inconsistent, it means that there may be a writing failure, data corruption or other problems.

[0052] The CRC algorithm can effectively detect errors that may occur during transmission, such as single-bit errors or multi-bit burst errors, ensuring the integrity of data during transmission; through the CRC check mechanism, the risk of encoding mismatch due to data transmission errors can be significantly reduced, enhancing the stability and reliability of the entire system operation.

[0053] It should be noted that the present application does not limit the consistency verification to only using the CRC algorithm for encoding, in other embodiments, parity check or hash function can be used for consistency verification, which is not limited.

[0054] The present application also provides a chip encoding generation and writing device, which can apply the chip encoding generation and writing method as described in the above embodiments, such as Figure 2 as shown, Figure 2 The framework diagram of an embodiment of the chip encoding generation and writing device provided by the present application includes:

[0055] The host computer software module generates a unique code to be written into the chip based on a preset encoding rule.

[0056] The USB serial communication module is connected with the host computer software module; based on the USB serial communication module, read and write instructions are sent to the chip.

[0057] The encoding check module verifies whether the encoding returned by the chip is consistent with the unique code generated by the host computer software.

[0058] The two-dimensional code generation module is used to generate and display the two-dimensional code corresponding to the unique code after the encoding check is consistent.

[0059] In an embodiment, the USB serial communication module adopts a bidirectional communication protocol, which is used to receive the response signal of the chip and judge the communication state between the host computer software module and the chip based on the response signal; the bidirectional communication protocol allows the system to monitor the state of the communication link in real time, discovers and handles potential problems in time, and ensures the reliability of data transmission; when a communication failure is detected, immediate measures such as retry mechanism, user prompt, etc. can be taken, enhancing the stability and fault tolerance of the system.

[0060] The USB serial communication module's transmission rate can be configured in adaptive mode, dynamically adjusting communication timing based on chip type to optimize write efficiency. By adaptively adjusting the transmission rate, the USB serial communication module can dynamically optimize communication timing based on the specific chip type and performance characteristics. For different chip types, the system can automatically select the most appropriate transmission speed, thereby speeding up the data transfer process and reducing write time.

[0061] Different chips may support different communication rates and protocols; the adaptive mode allows the USB serial communication module to automatically identify and adapt to these differences, allowing it to communicate effectively with multiple types of chips without manual configuration, enhancing the versatility and flexibility of the system.

[0062] In one embodiment, the coding verification module triggers an alarm prompt when it detects coding inconsistency, and controls the upper computer software module to regenerate the coding and perform the write operation; the automated verification and retry mechanism ensures that the process is terminated only after the coding is confirmed to be correct, greatly reducing the problem of data inaccuracy caused by coding errors; the self-correction design increases the stability and reliability of the system, and even if the initial write fails, measures can be taken quickly to remedy the situation, avoiding potential operational interruptions or product recognition failures.

[0063] The warning prompt may be visual, such as a pop-up warning window, auditory, such as a sound warning, or other forms of notification, so as to promptly notify the user of the problem, without any limitation.

[0064] In one embodiment, the preset coding rules include a combination algorithm of timestamp, workstation number and serial number to ensure the uniqueness of the generated code; the structured coding method facilitates subsequent product tracking and management, and each code can clearly indicate the specific time and place of its generation; the unique code not only helps in product identification and fault tracking, but also can be used to prevent counterfeiting and tampering, thereby increasing product safety and the reliability of the entire system.

[0065] like Figure 3 As shown, Figure 3 This is a framework diagram of another embodiment of the chip code generation and writing device provided in this application. The chip code generation and writing device also includes a printing module, which prints the generated QR code on the product label based on the printing module to achieve product traceability; by printing the QR code on the product label, detailed information of the product can be quickly obtained, including production date, batch, work station number, etc., which greatly improves the speed and accuracy of product traceability; the automated printing and label management system reduces the possibility of manual input errors and simplifies information processing work in inventory management and logistics distribution.

[0066] To further accelerate the encoding generation and writing efficiency, the chip encoding generation and writing device supports multi-station parallel operation. Each station is connected with the upper computer software module through an independent communication channel to ensure that the encoding writing process is conflict-free. Each station has an independent communication channel to ensure that there is no data packet collision or confusion when multiple encoding writing tasks are performed simultaneously. This helps to maintain the stability and reliability of the system and avoid operation failure or data damage caused by data conflict.

[0067] For the above-mentioned embodiments, the present application provides a computer device, please refer to Figure 4 , Figure 3 The structural schematic diagram of an embodiment of the computer device of the present application. The computer device comprises a memory and a processor, wherein the memory and the processor are coupled to each other, the memory stores program data, and the processor is used to execute the program data to realize the steps of any embodiment of the chip encoding generation and writing method.

[0068] In this embodiment, the processor can also be referred to as CPU (Central Processing Unit). The processor can be an integrated circuit chip with signal processing capability. The processor can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0069] For the method of the above-mentioned embodiments, it can be realized in the form of a computer program, so the present application provides a computer readable storage medium, please refer to Figure 5 , Figure 5 The structural schematic diagram of an embodiment of the computer readable storage medium of the present application. The computer readable storage medium stores program data capable of being executed by the processor, and the program data can be executed by the processor to realize the steps of any embodiment of the chip encoding generation and writing method.

[0070] The computer readable storage medium of the present embodiment can be a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, etc. which can store program data, or it can also be a server which stores the program data. The server can send the stored program data to other devices for running, or it can also run the stored program data itself.

[0071] In several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other manners. For example, the embodiments of the device described above are merely schematic. For example, the division of the modules or units is merely logical function division. There can be another division manner for the actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In this way, the actual implementation can be divided into other forms.

[0072] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units. That is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to the actual needs to achieve the purposes of the embodiments.

[0073] In addition, each functional unit in the embodiments of the present application can be integrated in a processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.

[0074] The above descriptions are merely some embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent flow transformation made by using the content of the present application specification and drawings, or directly or indirectly applied to other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A chip code generation and writing method, characterized in that: The steps include: S1: Generate a unique code based on the host computer software; the host computer software sends a read instruction to the chip based on the USB serial port communication protocol to verify the communication status; S2: If the communication status is normal, the host computer software sends a write instruction to write the unique code into the chip; S3: The host computer sends a read instruction again to obtain the code written by the chip, and verifies the code written by the chip with the unique code; S4: If the verification is consistent, the host computer software displays the uniquely encoded QR code and outputs it; If the verification is inconsistent, step S1 is executed again.

2. The chip code generation and writing method according to claim 1, characterized in that: In step S2, if the communication status between the chip and the host computer software is abnormal, communication fault information is automatically detected and displayed.

3. The chip code generation and writing method according to claim 2, characterized in that: In step S3, a cyclic redundancy check (CRC) algorithm is used to verify the consistency of the code.

4. A chip code generation and writing device, applicable to the chip code generation and writing method according to any one of claims 1 to 3, characterized in that: include: A host computer software module, which generates a unique code to be written into the chip based on a preset coding rule; A USB serial communication module, the USB serial communication module is connected to the host computer software module; based on the USB serial communication module, a read instruction and a write instruction are sent to the chip; A coding verification module, which verifies whether the code returned by the chip is consistent with the unique code generated by the host computer software based on the coding verification module; A QR code generation module is used to generate and display a QR code corresponding to the unique code after the code verification is consistent.

5. The chip code generating and writing device according to claim 4, characterized in that: The USB serial port communication module adopts a bidirectional communication protocol, is used to receive a response signal from the chip, and determines the communication status between the host computer software module and the chip based on the response signal.

6. The chip code generating and writing device according to claim 4, characterized in that: The coding verification module triggers an alarm prompt when detecting coding inconsistency, and controls the host computer software module to regenerate the coding and perform a write operation.

7. The chip code generating and writing device according to claim 4, characterized in that: The preset coding rules include a combination algorithm of timestamp, workstation number and serial number to ensure the uniqueness of the generated code.

8. The chip code generating and writing device according to any one of claims 4 to 7, characterized in that: The device further comprises a printing module, based on which the generated two-dimensional code is printed onto a product label to achieve product traceability.

9. An electronic device, characterized in that: The electronic device includes: a memory and a processor coupled to each other, and the processor is used to execute program instructions stored in the memory to implement the chip code generation and writing method according to any one of claims 1 to 3.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores program data, and the program data can be executed by a processor to implement the chip code generation and writing method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • USB type-C cable and method for reading / writing a chip in a USB type-C cable

    CN105824573A

  • Serial port data programming method for embedded chip and electronic equipment

    CN116483755A

  • Chip verification method and device, equipment and storage medium

    CN117331773A

  • Method, system and device for improving efficiency of inter-chip communication, and medium

    CN118916324A

  • Method for identity verification, consumable box and storage medium

    US20210056235A1