Nonvolatile memory programming method, nonvolatile memory programming device, electronic device, and storage medium
1. A method of programming non-volatile memory, comprising:
obtaining a judgment result whether the programming data in the temporary storage area reaches a set value;
and controlling the nonvolatile memory to enter a programming state according to the judgment result.
2. The method as claimed in claim 1, wherein the step of controlling the nonvolatile memory to enter the programming state according to the determination result comprises:
if the programming data in the temporary storage area does not reach the set value, the programming state is not entered;
and entering a programming state if the programming data in the temporary storage area reaches a set value.
3. The method as claimed in claim 2, wherein the step of entering the program state if the program data in the temporary region reaches the set value comprises:
performing a program verify operation;
if the program verification passes, ending;
performing a program operation if the program verification is not passed;
and executing the program verification operation after executing the program operation until the program verification is passed.
4. The method as claimed in claim 2, wherein the step of entering the program state if the program data in the temporary region reaches the set value comprises:
executing a programming operation;
performing a program verify operation;
if the program verification passes, ending;
if the program verification is not passed, returning to performing the program operation until the program verification is passed.
5. The method of claim 1, further comprising:
judging whether the last byte in the programming data is a complete byte or not;
and if the last byte is an incomplete byte, performing complementary bit repair on the last byte by using preset data to enable the last byte to become a complete byte.
6. The method as claimed in claim 5, wherein the predetermined data is 0 or 1.
7. The method of claim 5, wherein after the step of repairing the last byte to a complete byte using default data if the last byte is an incomplete byte, the method further comprises:
in the next programming, the last byte is reprogrammed.
8. A non-volatile memory programming apparatus, comprising:
the first acquisition module is used for acquiring a judgment result whether the programming data in the temporary storage area reaches a set value;
and the first processing module is used for controlling the nonvolatile memory to enter a programming state according to the judgment result.
9. An electronic device comprising a processor and a memory, said memory storing computer readable instructions which, when executed by said processor, perform the steps of the method according to any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the method according to any one of claims 1-7.
Background
For the Nor Flash nonvolatile memory, a programming operation is an important operation step of a memory chip, and time consumed by programming is a key parameter for measuring programming performance. The required programming time of a conventional Nor Flash nonvolatile memory is generally 0.3-6 ms, and generally the Nor Flash programming operation comprises the following main steps: programming data recording, programming verification and programming. The program verification must be started before the program data recording is completed, and thus, before the program operation is performed, it is necessary to wait for the program data recording to be completed, which results in a long program time.
In view of the above problems, improvements are needed.
Disclosure of Invention
Embodiments of the present disclosure provide a method and an apparatus for programming a nonvolatile memory, an electronic device, and a storage medium, which have the advantage of high programming speed.
In a first aspect, an embodiment of the present application provides a method for programming a nonvolatile memory, where the technical solution is as follows:
the method comprises the following steps:
obtaining a judgment result whether the programming data in the temporary storage area reaches a set value;
and controlling the nonvolatile memory to enter a programming state according to the judgment result.
Further, in this embodiment of the present application, the step of controlling the nonvolatile memory to enter the programming state according to the determination result includes:
if the programming data in the temporary storage area does not reach the set value, the programming state is not entered;
and entering a programming state if the programming data in the temporary storage area reaches a set value.
Further, in this embodiment of the present application, the step of entering the program state if the program data in the temporary storage region reaches the set value includes:
performing a program verify operation;
if the program verification passes, ending;
performing a program operation if the program verification is not passed;
and executing the program verification operation after executing the program operation until the program verification is passed.
Further, in this embodiment of the present application, the step of entering the program state if the program data in the temporary storage region reaches the set value includes:
executing a programming operation;
performing a program verify operation;
if the program verification passes, ending;
if the program verification is not passed, returning to performing the program operation until the program verification is passed.
Further, in the embodiment of the present application, the method further includes:
judging whether the last byte in the programming data is a complete byte or not;
and if the last byte is an incomplete byte, performing complementary bit repair on the last byte by using preset data to enable the last byte to become a complete byte.
Further, in the embodiment of the present application, the preset data is 0 or 1.
Further, in this embodiment of the present application, after the step of repairing the padding of the last byte with preset data to make it become a complete byte if the last byte is an incomplete byte, the method further includes:
in the next programming, the last byte is reprogrammed.
In a second aspect, the present application also provides a non-volatile memory programming apparatus comprising:
the first acquisition module is used for acquiring a judgment result whether the programming data in the temporary storage area reaches a set value;
and the first processing module is used for controlling the nonvolatile memory to enter a programming state according to the judgment result.
In a third aspect, the present application further provides an electronic device, comprising a processor and a memory, where the memory stores computer readable instructions, and the computer readable instructions, when executed by the processor, perform the steps of the method as described above.
In a fourth aspect, the present application also provides a storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the method as described above.
In view of the above, in the nonvolatile memory programming method, the nonvolatile memory programming device, the electronic device, and the storage medium provided in the embodiments of the present application, the determination result of whether the programming data in the temporary storage region reaches the set value is obtained; whether the program state is entered or not is determined according to the judgment result, and compared with the traditional programming method, the scheme provided by the method has the advantage of high programming speed.
Additional features and advantages of the present application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the embodiments of the present application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
Fig. 1 is a flowchart of a method for programming a non-volatile memory according to an embodiment of the present disclosure.
Fig. 2 is a schematic structural diagram of a nonvolatile memory programming device according to an embodiment of the present disclosure.
Fig. 3 is a schematic view of an electronic device according to an embodiment of the present application.
Fig. 4 is a flowchart of a conventional program operation process.
Fig. 5 is a flowchart of a programming operation process provided in an embodiment of the present application.
FIG. 6 is a timeline diagram of the programming of a full 256 bytes in the example of the present application versus the full 256 bytes in the prior art.
FIG. 7 is a timeline diagram of incomplete 256-byte programming in the embodiment of the present application versus incomplete 256-byte programming of the prior art.
In the figure: 210. a first acquisition module; 220. a first processing module; 300. an electronic device; 310. a processor; 320. a memory.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1 to 7, a method for programming a nonvolatile memory includes:
s110, obtaining a judgment result whether the programming data in the temporary storage area reaches a set value;
and S120, controlling the nonvolatile memory to enter a programming state according to the judgment result.
According to the technical scheme, when a programming instruction is executed, firstly, the input programming instruction, a programming address and programming data need to be acquired, then whether the programming data in the temporary storage area reaches a set value is judged, and whether a programming state is entered is determined according to a judgment result, wherein the programming state comprises the steps of executing a programming operation and executing a programming verification operation.
In the conventional programming method, all the programming data needs to be recorded into the temporary storage area, and then the programming state is started. In the scheme of the application, the set value is set and can be adjusted to judge whether the data in the temporary storage area reaches the set value or not, and then whether the data enter the programming state or not is determined according to the judgment result.
Specifically, in some embodiments, the step of determining whether to enter the programming state according to the determination result includes:
if the programming data in the temporary storage area does not reach the set value, the programming state is not entered;
and entering a programming state if the programming data in the temporary storage area reaches a set value.
For example, when 256 bytes of data need to be programmed, the set value is set to 1 byte, in the existing programming scheme, the program verifying operation and the program operation are started after 256 bytes of program data are all recorded into the temporary storage area, and in the scheme of the present application, after 1 byte of program data is recorded into the temporary storage area, the program verifying operation and the program operation are started, compared with the prior art, the time for recording 255 bytes is saved, and the efficiency of the overall programming is effectively improved.
Further, in the embodiment of the present application, if the program data in the temporary storage region reaches the set value, the step of entering the program state includes:
performing a program verify operation;
if the program verification passes, ending;
performing a program operation if the program verification is not passed;
and executing the program verification operation after executing the program operation until the program verification is passed.
Through the technical scheme, after the programming data in the temporary storage area reach the set value, the programming state is started to enter, specifically, the programming verification operation is executed firstly, whether the state of the memory unit in the programming address is the same as the state required by the programming data is verified, if the state is the same, the programming data is already stored in the programming address at the moment, the programming operation is not required to be executed, namely, the programming verification is passed, the direct ending is carried out, if the state is not the same, the programming verification is not passed, the programming operation is required to be executed, the programming verification operation is required to be executed again after the programming operation is executed, and the process is circulated continuously until the programming verification is passed.
In some other embodiments, if the program data in the temporary region reaches the set value, the step of entering the program state includes:
executing a programming operation;
performing a program verify operation;
if the program verification passes, ending;
if the program verification is not passed, returning to performing the program operation until the program verification is passed.
Through the technical scheme, the programming state is started after the programming data in the temporary storage area reaches the set value, specifically, the programming operation is executed firstly to program the programming data to the programming address, then the programming verification operation is executed to verify the programmed data, if the programming verification is passed, the verification is finished, if the programming verification is not passed, the programming operation needs to be executed again, and then the process is circulated until the programming verification is passed.
If the program data in the temporary storage area reaches the set value, the step of entering the program state can execute the program operation and the program verification operation, and as a preferable scheme, the program verification operation is selected to be executed, because when the data on the program address is the same as the program data needing to be programmed, the program verification can be directly passed, so that the program operation does not need to be executed, and if the program operation is executed first, the unnecessary program operation can be executed once when the above situation is met.
Further, in the embodiment of the present application, the method further includes:
judging whether the last byte in the programming data is a complete byte or not;
if the last byte is an incomplete byte, the last byte is repaired by padding with preset data to become a complete byte.
Through the technical scheme, the defective data in the programmed data are repaired by bit complementing, so that programming failure is avoided, because in the existing programming, if an incomplete byte is programmed, the programming of the current time is abandoned, and all data needs to be reprogrammed subsequently, for example, in the programming of data of 256 bytes, if the last byte is an incomplete byte, namely less than 8 bits, the programming of the current time is regarded as invalid operation, and if the programming needs to be continued, a programming instruction needs to be sent again, and then the data of 256 bytes is recorded into the temporary storage area again for reprogramming.
In the scheme provided in this embodiment, the incomplete byte is complemented into a complete byte by the preset data, specifically, a 0 or 1 complement is used to replace the missing bits, so that the complete byte is formed, for example, in programming a 256-byte data, if the last byte is an incomplete byte, that is, less than 8 bits, then 1 can be used to complement the byte, so that all bits are considered as valid data, thereby avoiding reprogramming and saving programming time.
Further, in this embodiment of the present application, after the step of repairing the padding of the last byte with the preset data to make it a complete byte if the last byte is an incomplete byte, the method further includes:
in the next programming, the last byte is reprogrammed.
Through the technical scheme, the last byte is subjected to bit complementing through the preset data, so that the data information corresponding to the last byte is not necessarily real data information, and therefore, only the last byte needs to be reprogrammed in the next programming, so that the problem that reprogramming is needed if the last byte is incomplete in the existing programming is avoided on the premise of ensuring the correctness of the data information, and the programming time is effectively shortened.
Specifically, as shown in fig. 4, fig. 4 shows an operation process of the conventional programming, after a program command, a program address and program data are obtained, program data to be programmed will be entered, for example, 256 bytes of program data, and after all the 256 bytes of program data are entered into the temporary storage area, the memory will enter a program state. When the last byte of the recorded programming data is not a complete byte, namely less than 8 bits, the program is regarded as an invalid operation, if the program needs to be continued, the instruction needs to be sent again, and 256 bytes are recorded.
Fig. 5 shows a programming operation process provided in the present application. As shown in fig. 5, after the program command, the program address and the program data are obtained, the program data to be programmed is entered, for example, 256 bytes, and the memory enters the program state after the number of bytes entered into the temporary storage area reaches the set value. The set value is an adjustable parameter, for example, 1 byte can be entered before entering the programming state. If the last byte in the entry byte is not a complete byte, it will automatically be complemented with a value of '1' or '0' into a byte, considering all bits as valid data. If the complete data is to be programmed, only the last byte needs to be reprogrammed in the second programming instruction.
FIG. 6 shows a timeline for programming a full 256 bytes for the present application versus a full 256 bytes for the prior art. t0 denotes the time zero, t1 denotes the time of recording the consumption of one byte, t2 denotes the time of recording the consumption of all bytes, and t3 denotes the time of programming end. Taking the example of setting to enter the programming state after entering one byte, the time that can be shortened by the scheme of the present application can be represented as T = T2-T1.
Fig. 7 shows that for the case where incomplete bytes exist, the scheme provided by the present application can avoid the case of invalid programming instructions, and ensure that the first 255 bytes are accurately programmed, and the next programming instruction only needs to include an instruction for programming the last byte, and if the current means is adopted, 256 bytes need to be reprogrammed. Therefore, the scheme provided by the application shortens the programming time on one hand, and takes 256 bytes and the set value of 1 byte as an example in the standard SPI mode, and if the frequency of the SPI mode is 50M, the time of each programming command can be shortened by 40 microseconds; in addition, the scheme of the method also solves the influence caused by incomplete bytes, and the efficiency and the flexibility of the practical application of the memory are improved.
In a second aspect, the present application also provides a programming apparatus for a non-volatile memory 320, comprising:
a first obtaining module 210, configured to obtain a determination result of whether the programming data in the temporary storage region reaches a set value;
the first processing module 220 is configured to control the nonvolatile memory to enter a programming state according to the determination result.
According to the above technical solution, when a programming instruction is executed, first, an input programming instruction, a programming address and programming data need to be acquired, and before entering a programming state, programming data recording needs to be completed, where programming data recording generally refers to recording programming data in a temporary storage area, and then judging whether the programming data in the temporary storage area reaches a set value, the first acquiring module 210 is configured to acquire the judgment result, and then the first processing module 220 determines whether to enter the programming state according to the judgment result, where the programming state includes executing a programming operation and executing a programming verification operation.
In the conventional programming method, all the programming data needs to be recorded into the temporary storage area, and then the programming state is started. In the scheme of the application, whether the data in the temporary storage area reaches the set value is judged by setting the set value, and then whether the data enters the programming state is determined according to the judgment result.
In a third aspect, the present application further provides an electronic device 300, which includes a processor 310 and a memory 320, where the memory 320 stores computer-readable instructions, and the computer-readable instructions, when executed by the processor 310, perform the steps of the method as described above.
By the above technical solution, the processor 310 and the memory 320 are interconnected and communicate with each other through a communication bus and/or other form of connection mechanism (not shown), and the memory 320 stores a computer program executable by the processor 310, and when the computing device runs, the processor 310 executes the computer program to execute the method in any optional implementation manner of the foregoing embodiment to implement the following functions: obtaining a judgment result whether the programming data in the temporary storage area reaches a set value; and determining whether to enter a programming state according to the judgment result.
In a fourth aspect, the present application also provides a storage medium having a computer program stored thereon, where the computer program is executed by a processor to perform the steps of the method as described above.
Through the technical scheme, when being executed by a processor, the computer program executes the method in any optional implementation manner of the embodiment to realize the following functions: obtaining a judgment result whether the programming data in the temporary storage area reaches a set value; and determining whether to enter a programming state according to the judgment result.
The storage medium may be implemented by any type of volatile or nonvolatile storage device or combination thereof, such as a Static Random Access Memory (SRAM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), an Erasable Programmable Read-Only Memory (EPROM), a Programmable Read-Only Memory (PROM), a Read-Only Memory (ROM), a magnetic Memory, a flash Memory, a magnetic disk, or an optical disk.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.