Search

CN-122018802-A - Nonvolatile memory protection method, device and equipment

CN122018802ACN 122018802 ACN122018802 ACN 122018802ACN-122018802-A

Abstract

The invention discloses a protection method, a device and equipment of a nonvolatile memory, and relates to the field of automatic control, wherein the method comprises the steps of obtaining the erasing condition of a target nonvolatile memory in a preset time period; the invention adopts the thought of writing time integration to identify the frequent erasure of the target nonvolatile memory, avoids the process of counting the writing times of each storage unit, can occupy less resources, realizes the accurate identification of the frequent erasure of the nonvolatile memory, realizes the write protection function of the nonvolatile memory by executing the preset frequent erasure protection operation after the frequent erasure is identified, and can effectively identify and block the long-term and low-frequency accumulated erasure.

Inventors

  • LUO WEIWEI
  • SHEN TAO
  • LI LONGFEI
  • GAO ZHAN

Assignees

  • 长沙市英威腾电气技术有限公司

Dates

Publication Date
20260512
Application Date
20260130

Claims (10)

  1. 1. A method for protecting a nonvolatile memory, comprising: acquiring the erasing condition of the target nonvolatile memory in a preset time period, wherein the erasing condition comprises an erasing state in which erasing exists and an unerased state in which erasing does not exist; If the erasing condition is the erasing state, increasing a time integral count value by using a preset accumulated value, wherein the increased time integral count value is larger than or equal to the sum of the time integral count value before the increase and the preset accumulated value; and when the time integral count value is greater than or equal to a frequent erasing threshold, determining that the target nonvolatile memory has frequent erasing, and executing preset frequent erasing protection operation.
  2. 2. The method for protecting a nonvolatile memory according to claim 1, wherein after the erasing condition of the acquisition target nonvolatile memory for a preset period of time, further comprising: and if the erasing condition is the un-erasing state, adjusting the time integral count value to be the difference between the time integral count value and a preset decrement value.
  3. 3. The method for protecting a nonvolatile memory according to claim 1, wherein the increasing the time-integration count value using a preset accumulated value includes: And adjusting the time integral count value to be the sum of the time integral count value and the preset accumulated value.
  4. 4. The method for protecting a nonvolatile memory according to claim 1, wherein the acquiring the erasing condition of the target nonvolatile memory in the preset time period includes: Determining that the erasing condition is the erasing state when the target nonvolatile memory is erased at least once within the preset time period; And when the target nonvolatile memory is not erased in the preset time period, determining that the erasing condition is the un-erased state.
  5. 5. The method for protecting a nonvolatile memory according to claim 1, wherein the determining that the target nonvolatile memory has frequent erasing, and performing a preset frequent erasing protection operation, comprises: and resetting the time integral count value, and outputting a frequent erasure alarm signal.
  6. 6. The method according to claim 1, wherein the predetermined accumulated value is a value determined according to a normal usage frequency, a life cycle, a erasing lifetime, and a daily usage time of the target nonvolatile memory, and the frequent erasing threshold is a product of the predetermined accumulated value and a predetermined minimum accumulated number.
  7. 7. The method for protecting a nonvolatile memory as claimed in any one of claims 1 to 6, further comprising: Obtaining an access request for accessing the target nonvolatile memory, wherein the access request is a read request or a write request; If the current storage unit corresponding to the access request is a failure unit, determining a target mapping unit according to preset failure mapping information, wherein the current storage unit is any data storage unit which is required to be accessed by the access request, the data storage unit is a storage unit in a data area of the target nonvolatile memory, the failure unit is a storage unit which fails in a failure mode in the target nonvolatile memory, the target mapping unit is a backup storage unit corresponding to the current storage unit, the backup storage unit is a storage unit in a backup area of the target nonvolatile memory, the preset failure mapping information comprises corresponding relations between each failure unit in the target nonvolatile memory and each corresponding backup storage unit, and the number of the failure units in the target nonvolatile memory is smaller than or equal to that of the backup storage units; and completing the access of the access request to the current storage unit by utilizing the target mapping unit.
  8. 8. The method for protecting a nonvolatile memory as in claim 7, further comprising: when detecting that a new failed storage unit appears in the data area, marking the new failed storage unit as a failed unit; judging whether the backup area has available backup storage units or not, wherein the available backup storage units are backup storage units which do not establish corresponding relations with corresponding failure units; If yes, establishing a corresponding relation between the new failure storage unit and a target backup storage unit in the preset failure mapping information, wherein the target backup storage unit is any available backup storage unit.
  9. 9. A protection device for a nonvolatile memory, comprising: The system comprises a state acquisition module, a storage module and a storage module, wherein the state acquisition module is used for acquiring the erasing condition of a target nonvolatile memory in a preset time period, and the erasing condition comprises an erasing state in which erasing exists and an un-erasing state in which erasing does not exist; the time integration module is used for increasing a time integration count value by using a preset accumulated value if the erasing condition is the erasing condition, wherein the increased time integration count value is greater than or equal to the sum of the time integration count value before the increase and the preset accumulated value; And the erasing protection module is used for determining that the target nonvolatile memory is frequently erased when the time integral count value is greater than or equal to a frequent erasing threshold value, and executing preset frequent erasing protection operation.
  10. 10. A protection device for a nonvolatile memory, comprising: A memory for storing a computer program; A processor for implementing the steps of the method for protecting a non-volatile memory according to any one of claims 1 to 8 when executing said computer program.

Description

Nonvolatile memory protection method, device and equipment Technical Field The present invention relates to the field of automation control, and in particular, to a method, an apparatus, and a device for protecting a nonvolatile memory. Background Currently, most of function codes (such as operation and configuration data) in automation control are stored in a nonvolatile memory, if the storage of the data is abnormal, the equipment cannot operate if the data is light, and safety accidents are caused if the equipment is heavy, for example, a frequency converter is used as a driving unit of an executing mechanism in an industrial automation control system, and thousands of function codes are stored in an EEPROM (ELECTRICALLY ERASABLE PROGRAMMABLE READ ONLY MEMORY, electrically erasable programmable read-only memory). In a conventional automation control scenario, the lifetime of a non-volatile memory is limited mainly by the number of erasures, e.g. typically about 100 tens of thousands, which is sufficient to cover the device life cycle. However, in the actual use process, the nonvolatile memory is frequently erased due to software design defects and improper operation of users, and the risk of memory cell failure is dramatically increased. In the related art, a frequent erasing detection scheme of a nonvolatile memory often needs a resource with large occupation pressure, and the accuracy is not high. Therefore, how to accurately identify frequent erasing of the nonvolatile memory with small resource occupation, so as to effectively identify and block long-term and low-frequency accumulated erasing in an automatic control scene is a problem which needs to be solved rapidly nowadays. Disclosure of Invention The invention aims to provide a protection method, a device and equipment for a nonvolatile memory, which can realize accurate identification of frequent erasing of the nonvolatile memory with smaller resource occupation. In order to solve the above technical problems, the present invention provides a protection method for a nonvolatile memory, including: acquiring the erasing condition of the target nonvolatile memory in a preset time period, wherein the erasing condition comprises an erasing state in which erasing exists and an unerased state in which erasing does not exist; If the erasing condition is the erasing state, increasing a time integral count value by using a preset accumulated value, wherein the increased time integral count value is larger than or equal to the sum of the time integral count value before the increase and the preset accumulated value; and when the time integral count value is greater than or equal to a frequent erasing threshold, determining that the target nonvolatile memory has frequent erasing, and executing preset frequent erasing protection operation. In another aspect, after the erasing condition of the target nonvolatile memory in the preset period of time, the method further includes: and if the erasing condition is the un-erasing state, adjusting the time integral count value to be the difference between the time integral count value and a preset decrement value. In another aspect, the increasing the time-integration count value with the preset accumulated value includes: And adjusting the time integral count value to be the sum of the time integral count value and the preset accumulated value. In another aspect, the obtaining the erasing condition of the target nonvolatile memory in the preset time period includes: Determining that the erasing condition is the erasing state when the target nonvolatile memory is erased at least once within the preset time period; And when the target nonvolatile memory is not erased in the preset time period, determining that the erasing condition is the un-erased state. In another aspect, the determining that the target nonvolatile memory has frequent erasing, performing a preset frequent erasing protection operation includes: and resetting the time integral count value, and outputting a frequent erasure alarm signal. In another aspect, the preset accumulated value is a value determined according to a normal usage frequency, a life cycle, a erasing lifetime and a daily usage time of the target nonvolatile memory, and the frequent erasing threshold is a product of the preset accumulated value and a preset minimum accumulated number. In another aspect, the method further comprises: Obtaining an access request for accessing the target nonvolatile memory, wherein the access request is a read request or a write request; If the current storage unit corresponding to the access request is a failure unit, determining a target mapping unit according to preset failure mapping information, wherein the current storage unit is any data storage unit which is required to be accessed by the access request, the data storage unit is a storage unit in a data area of the target nonvolatile memory, the failure unit is a storage unit which fails in a fail