Electronic device with one-time programmable memory and writing and reading method thereof
By introducing a write verification mechanism in the electronic device and generating and storing verification codes, the problem of numerical jump during OTP memory writing is solved, and reliable data verification and restoration is realized, reducing hardware costs and detection costs.
Patent Information
- Application Number
- CN202110219143.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-26
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2041-02-26
AI Technical Summary
During the writing process of OTP memory, numerical jumps are prone to occur, resulting in inconsistent with the expected value, which in turn affects the function of the OTP memory. The batch manufacturing detection efficiency of the prior art is low and costly.
An electronic device with a single-time programmable memory with write verification is designed, the original value is written to the OTP memory through a processor, and the burned code is read. When the recorded code is inconsistent with the original value, a check code is generated and stored in the internal memory, and the checksum restore of the data is realized through the verification operation program.
It effectively solves the problem of numerical jumps when writing OTP memory, reduces the risk of data leakage, simplifies the verification process, reduces hardware costs, and improves the efficiency of batch manufacturing inspection.
Smart Images

Figure CN114968068B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to an electronic device with a memory and an access method thereof, and in particular, to an electronic device with a one-time programmable memory and a writing and reading method thereof. Background Art
[0002] With the demand for data protection in electronic devices, many electronic manufacturers will use One Time Programmable (OTP) memory as a storage device for important data. The characteristic of OTP memory is that data is written once, making data storage irreversible. Therefore, in addition to storing the identification code of the integrated circuit (IC), OTP memory is also used in firmware upgrade version confirmation, to store encrypted information, personal identification code or device verification code and other information.
[0003] The ways to write data to the OTP memory include fuse burning, ultraviolet irradiation or electrical actuation. When the OTP memory is writing to a specific bit, the bits of two adjacent positions may be affected, causing the written value to jump. The jump will cause the problem that the burned code stored in the OTP memory is inconsistent with the expected written value. Due to the single-write characteristic of the OTP memory, the OTP memory that has a jump is bound to be scrapped, thereby affecting the function corresponding to the OTP field. In addition, if the sampling test of the batch-produced OTP memory is carried out according to the previous technology, the efficiency is low, and the cost of comprehensive testing is too high. Summary of the invention
[0004] In view of this, according to some embodiments, the electronic device with a one-time programmable memory is suitable for executing a writing and reading method, which solves the problem of the OTP memory having to be discarded due to a value jump during the OTP memory burning.
[0005] In some embodiments, an electronic device with a write-verification single-time programmable memory includes an OTP memory, an internal memory, and a processor. The processor is used to write an original value into the OTP memory as a burned code, and read the burned code of the OTP memory. When the burned code is inconsistent with the original value, the processor obtains a verification code according to the original value and the burned code, and stores the verification code in the internal memory. Since the burned code does not directly involve the original value, the process of accessing data can reduce the risk of data leakage.
[0006] In some embodiments, the processor performs a verification operation on the original value and the recorded code to obtain a verification code.
[0007] In some embodiments, the check operation procedure is selected from at least one of the group consisting of the following items: exclusive OR operation, OR operation, AND operation, addition operation, subtraction operation. The check operation mechanism can achieve the advantages of simple implementation, fast operation and low hardware cost.
[0008] In some embodiments, an electronic device with a write-verification single-time programmable memory includes an OTP memory, an internal memory, and a processor. The OTP memory stores a burned code; the internal memory stores the verification code; and the processor performs a restoration operation program according to the burned code and the verification code to obtain an original value.
[0009] In some embodiments, the restoration operation procedure is selected from at least one of the group consisting of: exclusive OR operation, OR operation, AND operation, addition operation, and subtraction operation.
[0010] In some embodiments, a method for writing to a one-time programmable memory includes the following steps: burning an original value into an OTP memory as a burned code; reading the burned code of the OTP memory; when the original value is inconsistent with the burned code, obtaining a verification code based on the original value and the burned code; and storing the verification code.
[0011] In some embodiments, the step of obtaining the verification code further includes: performing a verification operation on the original value and the recorded code to obtain the verification code.
[0012] In some embodiments, a method for reading a one-time programmable memory includes the following steps: reading a recorded code and a verification code; performing a restoration operation on the recorded code and the verification code to obtain an original value.
[0013] In some embodiments, the step of reading the recorded code and the verification code includes: determining whether the verification code exists; if the verification code does not exist, outputting the recorded code; if the verification code exists, reading the recorded code and the verification code.
[0014] The electronic device with write-check single-time programmable memory and the write and read method described can check the erroneous burned code existing in the OTP memory, especially the jump of the original value when writing into the OTP memory. When the external device wants to read the electronic device and the original value, the electronic device can obtain the correct original value through the verification method. When writing and reading the original value, the processor only needs to process the bit operation to achieve the purpose of verification. The setting cost of the hardware or software of the bit operation is more economical and simpler than other verification methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a schematic diagram of the system architecture of an embodiment of the present disclosure.
[0016] Figure 2AIt is a schematic diagram of the writing of the original value and the correct burned code disclosed in the present invention.
[0017] Figure 2B It is a schematic diagram of writing the original value and the erroneous recorded code disclosed in the present invention.
[0018] Figure 3A It is a schematic diagram of the writing verification process of the original value disclosed in the present invention.
[0019] Figure 3B It is a schematic diagram of the system architecture of another embodiment of the present disclosure.
[0020] Figure 3C It is a schematic diagram of the generation of the original value, the recorded code and the check code disclosed in the present invention.
[0021] Figure 4 It is a schematic diagram of the verification process flow of reading the recorded code and the verification code disclosed in the present invention.
[0022] Figure 5 It is a schematic diagram of the verification process flow of reading the recorded code and the verification code in some embodiments of the present disclosure. DETAILED DESCRIPTION
[0023] Please refer to Figure 1 As shown, it is a schematic diagram of the system architecture of an embodiment of the present disclosure. In some embodiments, the electronic device 100 includes a single-time programmable memory 110 (hereinafter referred to as OTP memory 110), an internal memory 120 and a processor 130. The electronic device 100 can be applied to a mobile communication device, a computer device or a multimedia device, etc. The processor 130 is coupled to the OTP memory 110 and the internal memory 120. The OTP memory 110 stores a burned code 111. The internal memory 120 stores a checksum 121. The types of the internal memory 120 are not limited to non-volatile memory (Non-Volatile Memory) or volatile memory (Volatile Memory). Generally speaking, the checksum 121 is stored in a non-volatile memory to avoid data loss during power failure.
[0024] The processor 130 is used to receive an original value 210 from the external device 200, or the processor 130 generates the original value 210 by itself. The disclosure is not limited to the source of the generation of the original value 210. The content of the original value 210 can be, but is not limited to, the identification code of the integrated circuit, firmware version information, encrypted information, personal identification number (PIN) or device verification code. The processor 130 burns the original value 210 into the OTP memory 110.
[0025] For example, the electronic device 100 receives a write request from the external device 200, and the processor 130 burns the original value 210 into the OTP memory 110 according to the write request. As for the external device 200, the external device 200 writes the original value 210 into the electronic device 100 and the OTP memory 110. As for the electronic device 100, the processor 130 burns the original value 210 into the OTP memory 110. The actions of writing or burning refer to storing the original value 210 into the OTP memory 110.
[0026] As mentioned above, since some value jumps may occur during the process of burning the original value 210 into the OTP memory 110, the value burned into the OTP memory 110 is different from the expected original value 210, such as Figure 2A and Figure 2B Therefore, the value actually recorded in the OTP memory 110 is represented as the recorded code 111. Figure 2A Indicates that the value of the recorded code 111 is the same as the original value 210, and Figure 2B Indicates that the value of the recorded code 111 is different from the original value 210. The difference is as follows Figure 2B The original value 210 and the bit length of the recorded code 111 are determined according to each application scenario. Figure 2A , 2B The original value and the bit length of the recorded code are only examples and are not limited to this. Figure 2A and 2B The values shown are examples only and the transitions are not limited to these.
[0027] To further explain the operation process of this embodiment, please also refer to Figure 3A Schematic diagram of the writing verification process of the original value. In some embodiments, the writing verification process includes the following steps:
[0028] Step S311: the processor burns the original value into the OTP memory as a burned code;
[0029] Step S312: the processor reads the recorded code of the OTP memory;
[0030] Step S313: determine whether the recorded code is consistent with the original value;
[0031] Step S314: When the original value is consistent with the recorded code, the processor ends the recording process;
[0032] Step S315: when the original value is inconsistent with the recorded code, a verification code is obtained according to the original value, the recorded code and the verification operation procedure; and
[0033] Step S316: The processor stores the verification code in the internal memory.
[0034] First, after the electronic device 100 receives a write request from the external device 200, the processor 130 obtains the original value 210 according to the write request. The processor 130 burns the original value 210 into the OTP memory 110, so that the OTP memory 110 stores the burned code 111. After the storage of the burned code 111 is completed, the processor 130 reads the burned code 111 from the OTP memory 110. The processor 130 determines whether the burned code 111 is consistent with the original value 210.
[0035] If the recorded code 111 is consistent with the original value 210 , the processor 130 will terminate the current recording process. If the recorded code 111 is inconsistent with the original value 210 , the processor 130 generates a check code 121 according to the original value 210 and the recorded code 111 .
[0036] In some embodiments, the electronic device 100 is adapted to execute a bit operation process 122. The bit operation process 122 may be stored in the internal memory 120 or other storage devices. The bit operation process 122 is a general term for the check operation process 123 and the restoration operation process 124. Figure 3B In some embodiments, the verification operation procedure 123 and the restoration operation procedure 124 are invertible operation procedures, and the invertible operation will be explained later.
[0037] In some embodiments, the bit operation program 122 may include a check operation program 123 corresponding to an exclusive-OR operation (XOR). The processor 130 may execute the check operation program 123 according to the original value 210 and the recorded code 111 to obtain a check code 121. Figure 2B For example, in Figure 2B The original value 210 is "00100001", and the recorded code 111 is "0010 0011". The processor 130 can obtain the check code 121 "0000 0010" by performing the check operation program 123 on the original value 210 and the recorded code 111. Figure 3C The processor 130 writes the verification code 121 into the internal memory 120 .
[0038] In some embodiments, the check operation procedure 123 may be selected from at least one of the group consisting of, but not limited to: exclusive OR operation (XOR), OR operation (OR), AND operation (AND), addition operation, and subtraction operation.
[0039] In some embodiments, the verification code may be stored in another OTP memory, an electronic fuse, or a secure storage device, but is not limited thereto.
[0040] With respect to the aforementioned writing process of the original value 210, the following is the reading verification process performed by the electronic device 100 according to the original value 210. In this embodiment, the hardware architecture of the electronic device 100 can refer to Figure 1 The reading and verification process of the original value 210 of the electronic device 100 can be coordinated with Figure 4 The read verification process includes the following steps:
[0041] Step S411: the processor reads the recorded code and the verification code;
[0042] Step S412: the processor performs a restoration operation program according to the recorded code and the verification code, and obtains the original value; and
[0043] Step S413: Output the original value to an external device.
[0044] First, the processor 130 receives a request from the external device 200 to read the original value 210. For example, the external device 200 wants to obtain the firmware version information of the electronic device 100 (for example, the value corresponding to the written original value 210). The processor 130 directly reads the OTP memory 110 and the internal memory 120 to obtain the burned code 111 and the verification code 121. The processor 130 executes the restoration operation program 124 according to the burned code 111 and the verification code 121.
[0045] The reversible operation refers to: the input data obtains the output result through the bit operation program 122, and the output result can also obtain the input data through the bit operation program 122. The operation combination of the check operation program 123 and the restoration operation program 124 may not necessarily be the same, and may also differ depending on the different bit operations and adopted. As mentioned above, the check operation program 123 corresponds to the exclusive or (XOR) operation, and the restoration operation program 124 is the same as the check operation program 123, and also corresponds to the XOR operation. The processor 130 can obtain the original value 210 according to the calculation of the restoration operation program 124, and send the original value 210 to the external device 200.
[0046] by Figure 3CThe burned code 111 and the check code 121 are taken as an example. In the above text, the processor 130 obtains the check code 121 "0000 0010" after calculation, and the internal memory 120 records the burned code 111 "0010 0011". The processor 130 passes the check code 121 and the burned code 111 through the restoration operation program 124, and the restoration operation program 124 performs the operation with "XOR". Finally, the processor 130 obtains the output result "0010 0001" of the restoration operation program 124. The processor 130 outputs the calculated original value 210 (i.e., the output result "0010 0001" of the restoration operation program 124) to the external device 200.
[0047] In some embodiments, the processor 130 can further determine whether there is a check code 121 in the internal memory 120. Figure 5 In this embodiment, the read verification process includes the following steps:
[0048] Step S511: The processor determines whether the verification code exists in the internal memory;
[0049] Step S512: if the verification code does not exist in the internal memory, output the burned code to the external device;
[0050] Step S513: If the internal memory has a verification code, the processor reads the recorded code and the verification code; and
[0051] Step S514: The processor executes a restoration operation program according to the recorded code and the verification code to obtain the original value.
[0052] In this embodiment, when the electronic device 100 receives a read request for the original value 210 from the external device 200, the processor 130 first reads the internal memory 120 and determines whether the verification code 121 is stored in the internal memory 120. If the verification code 121 is not stored in the internal memory 120, the processor 130 directly reads the burned code 111 of the OTP memory 110 and outputs the burned code 111 to the external device 200. If the verification code 121 is stored in the internal memory 120, the processor 130 reads the verification code 121 from the internal memory 120.
[0053] In addition, the processor 130 also reads the recorded code 111 from the OTP memory 110. The processor 130 can execute the restoration operation program 124 according to the recorded code 111 and the verification code 121 to obtain the original value 210. The verification operation program 123 and the restoration operation program 124 are reversible operations. The electronic device 100 sends the original value 210 to the external device 200.
[0054] In summary, according to the electronic device 100 with write-check single-time programmable memory, the write and read method can check the erroneous burned code 111 existing in the OTP memory 110, especially the original value 210 jumps when writing into the OTP memory 110. And when the external device 200 wants to read the electronic device 100 and the original value 210, the electronic device 100 can obtain the correct original value 210 through the verification method. When writing and reading the original value 210, the processor 130 only needs to process the bit operation to achieve the purpose of verification. Even if the hardware or software setting of the bit operation is implemented in all or most of the programmable memories produced in batches, its cost is more economical and efficient than other verification methods.
[0055] Although the present disclosure has been disclosed as above by way of embodiments, it is not intended to limit the present disclosure. Any person skilled in the art may make various changes and modifications without departing from the spirit and scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to that defined by the scope of the attached patent application.
[0056]
Explanation of symbols
[0057] 100: Electronic devices
[0058] 110: OTP memory
[0059] 111: Code has been recorded
[0060] 120: Internal memory
[0061] 121: Check code
[0062] 122: Bitwise Operation Program
[0063] 123: Checksum calculation program
[0064] 124: Restore the operation program
[0065] 130: Processor
[0066] 200: External devices
[0067] 210: Original value
[0068] S311~S316: Steps
[0069] S411~S413: Steps
[0070] S511~S514: Steps
Claims
1. An electronic device having a one-time programmable memory, comprising: OTP memory; Internal memory, and A processor is used to write the original value into the OTP memory as a burned code and read the burned code of the OTP memory. When the burned code is inconsistent with the original value, the processor obtains a check code according to the original value and the burned code, and stores the check code in the internal memory.
2. The electronic device with a one-time programmable memory according to claim 1, wherein the processor executes a verification operation program according to the original value and the recorded code to obtain the verification code.
3. The electronic device with a one-time programmable memory according to claim 2, wherein the verification operation procedure is selected from at least one of the group consisting of the following items: exclusive OR operation, OR operation, AND operation, addition operation, and subtraction operation.
4. An electronic device with a single-time programmable memory according to claim 1, 2 or 3, wherein the processor reads the burned code of the OTP memory according to a read request, and obtains the original code according to the burned code and a restoration operation program, and the restoration operation program is a reversible operation program of the verification operation program. 5 . The electronic device with a one-time programmable memory according to claim 4 , wherein the restoration operation procedure and the verification operation procedure are mutually exclusive OR operations.
6. A method for writing to a one-time programmable memory, comprising: Burn the original value into the OTP memory as the burned code; Reading the recorded code of the OTP memory; When the original value is inconsistent with the recorded code, a check code is obtained according to the original value, the recorded code and a check operation program; as well as The verification code is stored.
7. The method for writing into a one-time programmable memory according to claim 6, wherein: When the original value is consistent with the recorded code, the writing method ends.
8. The method for writing a one-time programmable memory according to claim 6 or 7, wherein the verification operation procedure is selected from at least one of the group consisting of the following items: exclusive OR operation, OR operation, AND operation, addition operation, and subtraction operation.
9. A method for reading an OTP memory, wherein the OTP memory is written according to the method of claim 6, the method for reading the OTP memory comprising: Determine whether the verification code exists; If the verification code exists, reading the recorded code and the verification code; as well as According to the recorded code and the verification code, a restoration operation procedure is executed to obtain the original value, and the restoration operation procedure is a reversible operation procedure of the verification operation procedure.
10. The reading method according to claim 9, further comprising: If the verification code does not exist, the recorded code is output.
Citation Information
Patent Citations
Integrated circuit and electronic system and renewable method providing one time programmable (OTP) internal memory configuration
CN103064654A
Data burning method of one-time programmable read-only memory (OTP ROM)
CN104598408A