Trim area reading device and reading method
By designing the reading device of the trim area, the accuracy and security of the trim data are ensured by using multiple protection mechanisms, the error problem when reading the trim value is solved, and the success rate and performance of chip initialization are improved.
Patent Information
- Application Number
- CN202111423036.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2041-11-26
AI Technical Summary
When reading the trim value in eFlash, a read error may occur, resulting in chip initialization failure and affecting chip performance. In the prior art, when reading the trim area, the security is low and it is not advisable to increase complex reading methods to avoid expanding the power consumption and area of the chip.
A trim area reading device is designed, including a data reading module, a data comparison module and a loop execution module. Through the multiple protection mechanisms of pilot words and check bits, the accuracy and security of trim data are ensured. When reading trim data, if an error is found, the device will cycle through the matching and perform third-level protection through the shadow register.
Through the multiple protection mechanism, the security and accuracy of reading trim data are improved, ensuring successful chip initialization, and reducing the increase in chip power consumption and area.
Smart Images

Figure CN114090341B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of chip design, and in particular to a trim area reading device and a reading method. Background Art
[0002] Reading the trim value in eFlash is the first operation performed after the MCU is powered on. It is an important part of the MCU chip and plays a decisive role in whether the MCU can achieve the expected functions and performance. The process of reading the trim area is intended to initialize the entire chip and adjust the analog module. Due to the influence of process, voltage or temperature, the trim value read in the process of reading the trim area may be wrong, resulting in chip initialization failure and ultimately affecting the performance of the chip. Generally, when implementing a small-scale MCU chip, the leader word in the trim area will be read first during the process of reading the trim area. If the leader word read does not match the expectation, the chip will repeatedly read the leader word until the leader word read is correct. However, this method can only preliminarily ensure that the chip reads the trim value correctly, and the security is low. In addition, in the design of small-scale MCU chips, it is not advisable to design an overly complex reading method to avoid increasing the power consumption and area of the chip. Summary of the invention
[0003] The technical problem of the present invention is to provide a trim area reading device and a reading method, which can realize multiple protection and confirmation of trim data reading and improve the security and accuracy of trim data reading.
[0004] To achieve the above object, the technical solution adopted by the present invention is:
[0005] The reading device of the trim area comprises a data reading module, a data comparison module and a loop execution module; the data reading module is used for the leading word and trim data of the trim area, and the trim data includes a check bit; the data comparison module is used for matching whether the read leading word and check bit are consistent with the preset expected value, and sending a signal to the loop execution module according to the comparison result; the loop execution module is used for triggering the data reading module to loop read the trim data according to the matching failure information sent by the data comparison module, until the data comparison module matches successfully, and then sending the trim data to the corresponding simulation module to complete the trimming.
[0006] The trim area reading device also includes a shadow register, which is used to store the leading word and trim data read by the data reading module, and send the correct trim data to the corresponding simulation module after the data comparison module successfully matches.
[0007] The method for reading a trim area includes the following steps: S1 reads a leading word and trim data in a trim area; S2 if the leading word in the trim area or the check bit value in the trim data does not match a preset expected value, then cyclically reads the leading word and trim data until the leading word and the check bit value both match the preset expected value; S3 sends the correct trim data to a corresponding analog module to complete the trimming.
[0008] S1 includes: S11, the data reading module reads the leading word of the trim area and stores it in the shadow register. If the data comparison module obtains that the leading word does not match the preset expected value, a fail signal is sent to the loop execution module; S12, after reading the leading word, the data reading module reads the trim data and stores it in the shadow register. If the data comparison module obtains that the value of the check bit in the trim data does not match the preset expected value, a fail signal is sent to the loop execution module;
[0009] S2 includes: after S21 loop execution module detects the fail signal, triggering the data reading module to loop read the leader word and trim data; if within the preset number of loops, the check bits in the leader word and trim data match the preset expected value, the loop ends; otherwise, S22 is executed; S22 sends a trim_fail signal to the MCU.
[0010] S3 includes: S31 if the MCU receives the trim_fail signal, use the reset value pre-stored in the analog module to perform subsequent operations and complete the adjustment; otherwise execute S32; S32 the shadow register sends the correct trim data to the corresponding analog module to complete the adjustment. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The present invention and its features, configurations and advantages will become more apparent by reading the detailed description of non-limiting embodiments with reference to the following drawings. The same reference numerals indicate the same parts throughout the drawings. The drawings are not drawn to scale, but rather to illustrate the subject matter of the present invention.
[0012] Figure 1 It is a flow chart of the trim area reading method provided by the present invention. DETAILED DESCRIPTION
[0013] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.
[0014] The trim area reading device provided by the present invention includes a data reading module, a data comparison module and a loop execution module; the data reading module includes a process of reading a leading word and a process of reading a check bit in the trim data. The process of reading the leading word is used as the first level of protection, and can display the voltage status after the chip is powered on. If the leading word is read incorrectly, it may be caused by the unstable voltage after the chip is powered on; the process of reading the check bit is used as the second level of protection, and can determine whether the read trim data is accurate. The data comparison module is used to match whether the read leading word and the check bit in the trim data are consistent with the preset expected value, and send a signal to the loop execution module according to the comparison result; the loop execution module is used to trigger the data reading module to loop read the leading word and trim data according to the matching failure information sent by the data comparison module, until the data comparison module matches successfully, and then send the trim data to the corresponding simulation module to complete the adjustment.
[0015] In order to prevent erroneous trim data from being sent to the corresponding analog module and causing unknown impact on the chip, the reading device of the trim area sets a shadow register as the third-level protection. During the process of reading the trim data, the trim data is first stored in the corresponding shadow register. When the read leading word and check bit are consistent with the expected value, that is, no fail signal is generated during the process of reading the leading word and all the trim data, the MCU will read the trim data in the shadow register and send it to the corresponding analog module to complete the corresponding adjustment work.
[0016] When the trim area reading device is implemented, Figure 1 As shown, first, the data reading module reads the leading word of the trim area and stores it in the shadow register. If the data comparison module finds that the leading word does not match the preset expected value, a fail signal is sent to the loop execution module. After reading the leading word, the data reading module reads the trim data and stores it in the shadow register. If the data comparison module finds that the value of the check bit in the trim data does not match the preset expected value, a fail signal is sent to the loop execution module. After the loop execution module detects the fail signal, it triggers the data reading module to loop read the leading word and trim data. If the check bits of the obtained leading word and trim data match the preset expected value within the preset number of cycles, the loop ends; otherwise, a trim_fail signal is sent to the MCU. If the MCU receives the trim_fail signal, it uses the reset value pre-stored in the analog module for subsequent operations to complete the adjustment; otherwise, the shadow register sends the correct trim data to the corresponding analog module to complete the adjustment.
[0017] The present invention retains the leading word and adds a check bit to the high position of each trim value. If an error occurs in any process of reading the leading word or reading the check bit, it is reported to the loop execution module, and the corresponding loop reading process is performed. After a certain number of loop readings, the subsequent operations are continued to ensure that the chip does not enter an infinite loop so that the user can find the cause of the error. For small-scale MCU chips, this method is simple to implement and can further improve the accuracy of reading trim data.
[0018] The preferred embodiments of the present invention are described above; it should be understood that the present invention is not limited to the above-mentioned specific embodiments, and the devices and structures not described in detail should be understood to be implemented in a common manner in the art; any technician familiar with the art can make many possible changes and modifications without departing from the technical solution of the present invention, or modify them into equivalent embodiments with equivalent changes, which does not affect the essential content of the present invention; therefore, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of protection of the technical solution of the present invention.
Claims
1. A trim area reading device, characterized in that: It includes a data reading module, a data comparison module and a loop execution module; The data reading module is used for the leading word and trimming data of the trim area, and the trimming data includes a check bit; The data comparison module is used to match the read leading word and check bit to see whether they are consistent with the preset expected value, and send a signal to the loop execution module according to the comparison result; The loop execution module is used to trigger the data reading module to loop read the trim data according to the matching failure information sent by the data comparison module, until the data comparison module matches successfully, and then send the trim data to the corresponding simulation module to complete the trimming; The reading device further comprises a shadow register, wherein the shadow register is used to store the leading word and trim data read by the data reading module, and to send the correct trim data to the corresponding simulation module after the data comparison module successfully matches; The process of the data reading module reading the leading word serves as the first level of protection, and is used to determine whether the voltage is stable after the chip is powered on; The process of the data reading module reading the check bit serves as the second level of protection, and is used to determine whether the trim data read out is accurate; The reading device sets the shadow register as the third level protection, which is used to determine whether a fail signal is generated during the process of reading the leading word and all trim data.
2. A trim area reading method, based on the trim area reading device according to claim 1, characterized in that: The reading method comprises: The data reading module reads the leading word and trim data of the trim area and stores them in the shadow register. If the data comparison module compares the leading word of the trim area and the check bit in the trim data and finds that they match the preset expected value, the correct trim data will be sent to the corresponding simulation module to complete the trimming; otherwise, a fail signal will be sent to the loop execution module.
3. The method for reading a trim area according to claim 2, wherein: After sending the fail signal to the loop execution module, the method further includes: After the loop execution module detects the fail signal, it triggers the data reading module to loop read the leader word and trim data; if within the preset number of loops, the check bits in the leader word and trim data match the preset expected value, the loop ends; otherwise, a trim_fail signal is sent to the MCU.
4. The method for reading a trim area according to claim 3, wherein: After the trim_fail signal is sent to the mcu, the method further includes: If the MCU receives the trim_fail signal, it uses the reset value stored in the analog module to perform subsequent operations and complete the trim; otherwise, the shadow register sends the correct trim data to the corresponding analog module to complete the trim.