Methods to help identify blank sectors of a microcontroller's non-volatile memory
By associating registers with non-volatile memory sectors in the microcontroller and dynamically updating the register state, the problem of time-consuming and laborious identification of blank sectors in the microcontroller's non-volatile memory is solved, achieving fast and reliable sector identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- VTESCO TECH GMBH
- Filing Date
- 2020-10-08
- Publication Date
- 2026-06-30
AI Technical Summary
Identifying blank sectors in the non-volatile memory of a microcontroller is a time-consuming and laborious process. Existing methods require scanning all memory cells and are prone to errors and configuration difficulties.
By associating the microcontroller’s registers with sectors of non-volatile memory, the registers are dynamically updated to reflect the sector status and are updated synchronously during write or erase operations. The interface module is used to quickly read register information to identify blank sectors.
It significantly reduces the time and resource consumption for identifying blank sectors, improves identification efficiency, and avoids errors and configuration difficulties.
Smart Images

Figure CN114514511B_ABST
Abstract
Description
Technical Field
[0001] This invention generally relates to memory integrated into a microcontroller. More specifically, it relates to identifying blank sectors of a microcontroller's non-volatile memory. This invention is particularly applicable to microcontrollers equipped with flash memory, where programming flash memory cells requires prior checking for blankness. Background Technology
[0002] Generally, the term "microcontroller" refers to an integrated circuit that includes at least one processor, memory (at least one volatile memory and at least one non-volatile memory), and input / output interfaces adapted to enable the microcontroller to be connected to other electronic circuits in an electronic system that uses it. A microcontroller is an autonomous component that can execute programs contained in its non-volatile memory as long as it is powered on, can acquire data in digital or analog form, and can generate and transmit digital data and / or analog electrical signals.
[0003] Microcontrollers are now commonly used in all embedded electronic systems, especially in automotive applications. They enable the implementation of specific functions in environments where there are significant constraints on system size, power consumption, and cost.
[0004] In the field of motor vehicles, most electronic systems in modern vehicles are controlled by such microcontrollers. Examples include systems that control the injection of fuel into the engine, anti-lock braking systems (ABS), or embedded systems used to analyze radar images in more autonomous vehicles. In each of these examples, the microcontroller can perform a wide variety of operations to control the relevant system.
[0005] A specific function of the non-volatile memory equipped on a microcontroller is to store programs that can be executed by the microcontroller. For this purpose, the non-volatile memory must be programmable according to the specific use of the microcontroller in the system in which it is embedded, and reprogrammable if necessary. Programming the microcontroller's non-volatile memory aims to write specific data (corresponding to the program) from a dedicated interface of the non-volatile memory into it. When the data is useful data to be retained in memory as binary values "0" and "1", it is called a "write operation" so that a subsequent read operation can be generated as needed by the application. Erasing all or part of the memory is also a specific type of programming operation because, depending on the type of technology used, it involves writing "0" or "1" to all memory cells to be erased.
[0006] Currently, for some non-volatile memory technologies commonly used in microcontrollers, especially flash memory, writing any information to the memory requires the memory space containing the information to be written to be blank memory space. Within the scope of this specification, blank memory space is memory space that does not contain any previously written useful data (user information) at the time of the write operation. In other words, either the memory space contains no useful information when the write process begins, so the determined information can be written directly; or the memory space already contains information to be written, and that information needs to be erased before new information can be written. Therefore, a write operation includes checking the blank status of the memory cells involved in the operation.
[0007] Furthermore, in non-volatile memories used in microcontrollers, such as flash memory, data is stored in partitioned arrays of memory cells. A sector (also called a block of memory cells or a memory block) refers to a group of memory cells in the array that must be erased together when an erase operation is performed. In other words, any erase operation specifically means erasing all memory cells within a defined sector. Conversely, in some cases, a write operation may involve only one memory cell. However, a write operation can obviously also involve multiple memory cells simultaneously, regardless of whether these memory cells belong to one or multiple sectors.
[0008] However, in the case of sectorized non-volatile memory, due to reasons related to the aforementioned techniques, for any data write to any sector, all memory cells in the sector in question must be empty as they were originally, or erased if they have been previously written to. In both cases, the sector is empty and can be written to in whole or in part according to commands. Therefore, managing data storage in such non-volatile memory by a microcontroller involves periodically identifying empty sectors of the non-volatile memory.
[0009] To date, the process of identifying blank sectors in such non-volatile memory is known to be lengthy and laborious. In fact, according to a first known method, this process involves, on the one hand, the use of user code (user software), designed to perform sequential operations of reading all memory cells of the array of non-volatile memory when executed, and on the other hand, interpreting the results of these reads. In this case, specific user code tailored to each given microcontroller technology must be developed to perform these operations. Furthermore, such code involves the risk of errors and / or configuration difficulties.
[0010] The second known method is based on the fact that such non-volatile memory is managed by a control module integrated into the memory, which includes an interface module. In addition to providing basic memory control functions (e.g., write, read, or erase), the interface module also provides a so-called checking function to examine the status of memory cells in erased sectors, referred to in the literature as "verifying erased logical sector ranges." This function can be invoked by user code to check the blanking status of memory cells in individual sectors of the non-volatile memory's array of memory cells.
[0011] Regardless of whether the first or second method is used, all memory cells of the non-volatile memory must be scanned (i.e., read or inspected) to determine which sectors of the memory cell array are blank. Therefore, the operations required to identify blank sectors in non-volatile memory have proven to be particularly lengthy and resource-intensive, as these operations involve checking the blank status of each memory cell within that sector. Furthermore, the total storage capacity of a given memory or the specific partitioning of a given memory's sectors (i.e., their number and size) can also extend the time required to identify blank sectors. Summary of the Invention
[0012] The present invention aims to mitigate the aforementioned drawbacks of the prior art by providing a method that enables the simple and rapid writing of information—including whether the sectors of a microcontroller's non-volatile memory array are blank or not—into the microcontroller's registers. Specifically, the invention stems from the inventors' observation that a register's memory cell (i.e., a bit) can be associated with each sector of the non-volatile memory to reflect the sector's state, i.e., whether it has been written to or erased. Furthermore, advantageously, the writing to the register can be performed simultaneously with each write or erase operation on a sector. Therefore, the invention essentially involves dynamically updating the register to reflect the actual state of the sector at a given moment—blank or non-blank. Finally, reading the register to identify blank sectors of the non-volatile memory array is a much faster operation than performing this identification process according to the known methods described and discussed above.
[0013] To this end, a first aspect of the present invention provides a method for managing a rewritable non-volatile memory of a microcontroller, the memory comprising a memory cell array organized into multiple sectors, each sector comprising multiple memory cells, and the memory further comprising a control module adapted to manage the memory cell array, the control module being and including an interface module configured to receive write, read, or erase commands for data in the memory, interpret the received commands, and perform operations corresponding to the received commands on determined memory cells of the non-volatile memory, the method comprising the following steps performed by the interface module in response to receiving a command to write data to at least one memory cell of a determined sector of the memory cell array or a command to erase the determined sector:
[0014] - On the one hand, execute the write operation or erase operation corresponding to the write command or erase command respectively; and
[0015] On the other hand, information representing the non-blank or blank state of the memory cell of the determined sector is written into the memory cell of the register of the microcontroller associated with the determined sector.
[0016] Implementation methods, considered individually or in combination, also propose:
[0017] - The non-volatile memory also includes multiple memory banks, each memory bank including a local memory cell array and a local control module, the local control module being configured to receive commands from the control module of the non-volatile memory and perform operations associated with the received commands on determined memory cells of the memory bank;
[0018] - The method also includes, in response to the interface module receiving a request to detect blank sectors of the memory cell array:
[0019] - Read information from the microcontroller's registers indicating the blank or non-blank state of memory cells representing sectors of the memory cell array; and / or
[0020] - The method includes reading the memory cells of the microcontroller's registers, which are associated with sectors of the memory, by means of a binary mask.
[0021] In a second aspect, another subject of the invention is a non-volatile memory suitable for storing data that can be written, read, and erased by a processor of a microcontroller, the non-volatile memory comprising a memory cell array and a control module, the memory cell array being organized into multiple sectors, each sector comprising multiple memory cells, and the control module comprising an interface module suitable for implementing all steps of the method according to the first aspect.
[0022] Implementation methods, considered individually or in combination, also propose:
[0023] - Non-volatile memory is flash memory; and / or
[0024] - The interface module of the control module for non-volatile memory is a Flash Standard Interface (FSI) type module.
[0025] In a third aspect, another subject of the invention is a microcontroller comprising a processor, at least one input / output interface, and a non-volatile memory adapted to store data and exchange data with the processor via a computer bus, the non-volatile memory comprising a memory cell array and a control module, the memory cell array comprising a plurality of sectors each consisting of a plurality of memory cells, and the control module comprising an interface module adapted to implement all steps of the method according to the first aspect. Attached Figure Description
[0026] Other features and advantages of the invention will become more apparent from the following description. This description is purely illustrative and should be read with reference to the accompanying drawings, in which:
[0027] Figure 1 This is a schematic representation of a microcontroller according to an embodiment of the present invention;
[0028] Figure 2 This is a schematic representation of a non-volatile memory according to an embodiment of the present invention;
[0029] Figure 3 This is a schematic representation of the registers of a microcontroller according to an embodiment of the present invention; and
[0030] Figure 4 This is a step diagram of one embodiment of the method according to the present invention. Detailed Implementation
[0031] In the following description of the embodiments and in the accompanying drawings, the same or similar elements have the same reference numerals in each figure.
[0032] While the application of this invention is not limited to this type of memory, embodiments will be described in the context of flash memory applications. Flash memory is a rewritable semiconductor mass storage device, meaning it possesses the characteristics of a read-write memory, but differs from a read-write memory in that it is adapted to retain recorded data even when it is no longer powered. Functionally, flash memory stores data bits in storage cells that are retained when power is cut off.
[0033] From a technical perspective, flash memory is based on EEPROM (Electrically Erasable Programmable Read-Only Memory) chips. It uses MOS transistors as its basic units. MOS transistors have a floating gate buried between the channel and the gate oxide layer, and information is stored temporarily by trapping electrons in this floating gate. Data is written to and erased from flash memory (called programming) by applying various voltages to the input points of the cells. These voltages are higher than those required for simple read operations. Therefore, flash memory is a special type of EEPROM. Data is typically erased and written in blocks. Finally, existing data must be erased before new data can be written.
[0034] Figure 1 An example of a microcontroller including non-volatile memory is shown, to which the method according to the invention can be applied.
[0035] The microcontroller 101 includes a processor 102, non-volatile memory 103, volatile memory 104, an oscillator 105, and input / output interfaces 107a, 107b, 107c, and 107d. Furthermore, the microcontroller includes one or more peripheral components 106, such as analog-to-digital converters or bus controllers. In practice, the various components of the microcontroller exchange data in binary signals via the computer bus connecting them; however, the microcontroller can also receive analog electrical signals from sensors and / or generate analog electrical signals for the circuit to be manipulated. As described above, such a microcontroller can be integrated into any embedded electronic system and then act as a control unit to manage defined functions.
[0036] As a recap of known information, processor 102 can execute user programs stored in non-volatile memory 103 of microcontroller 101. Volatile memory 104 is used to store data and variables that are useful for the operation of the microcontroller but are lost when the microcontroller is no longer powered. Oscillator 105 is used to time all operations performed by components of the microcontroller. For example, it can be an RC circuit. Finally, as its name suggests, input / output interfaces can be connected to other electronic components or circuits of the embedded system with which the microcontroller interacts.
[0037] refer to Figure 2 An embodiment of a rewritable nonvolatile memory to which the method according to the invention can be applied will now be described in more detail. As previously mentioned, the memory considered herein is a flash memory type, but those skilled in the art will understand that the invention is not limited to this type of memory.
[0038] Advantageously, flash memory offers high access speeds, long lifespans, and low power consumption. This is why it is widely used, especially in microcontrollers used in automotive applications.
[0039] The rewritable non-volatile memory 103 includes a memory cell array 201 (referred to as an "array") and a control module 202. The memory cell array 201 includes multiple sectors, each sector consisting of multiple memory cells. For recap, a memory cell is the basic unit for storing data in memory. Specifically, each memory cell stores binary information bits in the form of "0" or "1". Those skilled in the art will understand that the method according to the invention is applicable to non-volatile memories regardless of the size of the memory (i.e., the total storage space), the number of sectors included in its memory cell array, or the corresponding size of its individual sectors.
[0040] Control module 202 manages access to and operation of the entire memory. More specifically, control module 202 includes interface module 203, which is configured to receive commands, for example, via the microcontroller's computer bus 206, interpret the commands, and perform determined operations corresponding to the received commands on determined memory cells of the non-volatile memory. The operations in question may be, for example, writing, reading, erasing, or checking the memory cells of the array. More specifically, "checking" means checking the blanking status of memory cells. Furthermore, in a particular embodiment, interface module 203 may also interact with code correction module 204, which enables the correction of errors related to potential corruption of data contained in the memory. Finally, interface module 203 also accesses the microcontroller's status register 205 (or flag register), where it can write to and erase memory cells. Status register 205 is a dedicated part of the non-volatile memory and is not integrated into the memory cell array 201. As is known per se, status registers are therefore memories that can be accessed very quickly, especially for storing information related to the state of non-volatile memory or to operations performed on said non-volatile memory. Of course, the microcontroller may include other status registers (not shown) similar to register 205 for managing other functions of the microcontroller.
[0041] Figure 3 A schematic representation of the state register 205 of a microcontroller according to an embodiment of the present invention is shown. More specifically, Figure 3A status register 205 with three subsets 301, 302, and 303 is shown. Each subset 301, 302, and 303 has a 32-bit storage cell, which is used to store specific information related to, for example, the identification of non-volatile memory or the state of non-volatile memory. As will be described below, the method according to the invention involves using some of these storage cells of the status register 205 to store information reflecting the state of determined sectors of the array of storage cells of non-volatile memory. The state of the determined sector can be blank (that is, the sector has never experienced data writing, or although data was written, it was subsequently erased by an erase operation) or non-blank (that is, useful data was written to the sector and is still stored there). In other words, the state of the determined bits of the status register is directly related to whether the storage cells of the determined sector are blank or not. In particular, depending on whether the value of the bit in question is 0 or 1, the corresponding determined sector is either blank or written, and vice versa.
[0042] Back Figure 2 Those skilled in the art will understand that, in a particular embodiment, the non-volatile memory may include multiple memory banks. The microcontroller's processor can access each memory bank in the same manner via a computer bus, and each memory bank integrates the features referenced above. Figure 2 The non-volatile memory described includes substantially the same elements. Specifically, each memory bank includes a local memory cell array and a local control module configured to receive commands from the control module of the non-volatile memory and execute operations associated with the received commands on specific memory cells within the memory bank. Advantageously, each operation managing data in the memory can be executed in parallel on multiple memory banks of a single non-volatile memory. Furthermore, in this configuration, instructions / commands from the bus are first received and interpreted by a single control module of the non-volatile memory, which then forwards them to the local control module specific to each memory bank, which is responsible for executing the associated commands.
[0043] refer to Figure 4 An embodiment of the method according to the present invention will now be described. This method can be executed by an interface module of the control module of a non-volatile memory.
[0044] Step 401 includes receiving a command PROG_req programmed in the memory. This command can be either a command to write data to at least one memory cell in a defined sector of the memory cell array, or a command to erase a defined sector of the memory cell array. In practice, for recap, an erase operation can only be performed on an entire sector, while a write operation can, if necessary, be performed on only a portion of a sector. Typically, the write resolution, i.e., the minimum number of memory cells that can be written simultaneously in a write operation, is 8 bytes. A "page" is used to represent such a set of bytes that forms a subdivision of a sector of the memory.
[0045] Block 402 of the step diagram illustrates the choice made by the interface module in response to receiving the programming command PROG_req in step 401, depending on whether the command received in this step is a write command or an erase command. The first case results in the execution of step 403a of the method, and the second case results in the execution of step 403b of the method. Those skilled in the art will understand that regardless of which case is chosen, step 403 is executed concurrently with the execution of the commanded write or erase operation. In particular, it is this aspect that enables the dynamic updating of the microcontroller's status register 205, and thus enables the monitoring over time of the blank or non-blank status of the individual sectors of the non-volatile memory's cell array.
[0046] Therefore, in the first case, step 403a includes writing information indicating that the determined sector has been written (i.e., the logical value "1" in the illustrated example) to the determined memory cell REGi in the microcontroller's status register 205 associated with the sector thus written. In other words, while the interface module actually writes all or part of the determined sector, it also writes a determined bit REGi in the status register 205, which is specifically associated with that sector, such that the bit indicates the write status of the sector.
[0047] In the second case, step 403b includes writing information (i.e., the logical value "0" in the illustrated example) to the determined memory cell REGi in the microcontroller's status register 205 associated with the erased sector. This information reflects the fact that the sector in question is therefore blank, that is, all its memory cells are empty. In other words, while the interface module actually erases the entire determined sector, it also writes a determined bit REGi to the status register 205, specifically corresponding to that sector, such that the bit indicates the blank state of the sector.
[0048] In one particular embodiment of the method, the method further includes: in response to the interface module receiving a request to detect blank sectors of the memory cell array, reading a register of the microcontroller and sending information indicating that a sector of the memory cell array has been written to or erased. These steps enable reliable identification of individual blank sectors of the non-volatile memory at a given time, particularly for programming the memory cells of the non-volatile memory.
[0049] Therefore, advantageously, this method enables the writing of information related to sector state into a very fast-accessible memory and updates this information each time the sector state changes. Consequently, the resource consumption for identifying blank sectors is significantly lower than that of methods known to date, particularly in terms of time consumption.
[0050] Furthermore, in one particular embodiment of this method, a binary mask is used to associate each read of a microcontroller's register with a sector of memory. As is known per se, such a binary mask is a binary sequence designed to indicate the location of the bits involved in the determined operation. The determined logical operation applied to the combination of the mask and the register cell anchors only to the cell of interest. Therefore, the operation of reading the microcontroller's register is only performed on a determined portion of the register's memory cells deemed useful, further reducing the duration of the operation.
[0051] In a particular embodiment of the non-volatile memory, the interface module of the control module for the non-volatile memory can be a Flash Standard Interface (FSI) type module, which is typically found in flash memory. Advantageously, such an interface module is commonly used to receive, interpret, and execute commands from the microcontroller bus, thus eliminating the need for any specific means of implementing this method in the microcontroller.
[0052] In the claims, the terms "comprising" or "including" do not exclude other elements or other steps. A single processor or multiple other units may be used to implement the invention. Various presented and / or claimed features may be advantageously combined. Their presence in the specification or different dependent claims does not preclude this possibility. Reference numerals should not be construed as limiting the scope of the invention.
Claims
1. A method for managing a rewritable non-volatile memory (103) of a microcontroller (101), the non-volatile memory comprising a memory cell array (201) organized into multiple sectors, each sector comprising multiple memory cells, and the memory further comprising a control module (202) adapted to manage the memory cell array, the control module (202) comprising an interface module (203) configured to receive write, read, or erase commands for data in the non-volatile memory, interpret the received commands, and perform an operation corresponding to the received commands on a determined memory cell of the non-volatile memory, the method comprising the following steps performed by the interface module: - Receive a command to write data to at least one memory cell of a defined sector of the memory cell array or to erase the defined sector; - Execute a write operation or an erase operation that corresponds to a command to write data to the at least one memory cell of the determined sector or a command to erase the determined sector; - Associating a defined memory cell of a microcontroller's register with a defined sector among the plurality of sectors, wherein the microcontroller's register is a dedicated portion of non-volatile memory that is not integrated into the memory cell array, and wherein the defined memory cell of the microcontroller's register is a single bit of the microcontroller's register associated with a corresponding sector among the plurality of sectors. - Information representing the non-blank state or blank state of the memory cell of the determined sector is written to the determined memory cell of the microcontroller's register, wherein while performing a write operation corresponding to a write command, information representing the non-blank state of the memory cell of the determined sector is written to the memory cell of the microcontroller's register associated with the determined sector, and wherein while performing an erase operation corresponding to an erase command, information representing the blank state of the memory cell of the determined sector is written to the memory cell of the microcontroller's register associated with the determined sector; as well as - By means of a binary mask, the corresponding determined memory cells associated with the microcontroller's registers and the plurality of sectors of the memory are read, wherein reading the corresponding determined memory cells associated with the microcontroller's registers and the respective sectors of the plurality of sectors are read by means of a binary mask.
2. The method according to claim 1, wherein, The non-volatile memory also includes multiple memory banks, each including a local memory cell array and a local control module, the local control module being configured to receive commands from the control module of the non-volatile memory and execute operations associated with the received commands on determined memory cells of the memory bank.
3. The method according to any one of claims 1 and 2, further comprising, in response to the interface module receiving a request to detect blank sectors of the memory cell array: - Read information from the microcontroller's registers indicating the blank or non-blank state of memory cells representing sectors of the memory cell array.
4. The method of claim 1, wherein reading the corresponding determined memory cell of the microcontroller's register comprises anchoring the determined memory cell of the microcontroller's register to include information representing the non-blank state or blank state of the memory cell, respectively, representing the determined sector.
5. A non-volatile memory (103) adapted to store data that can be written, read and erased by a processor (102) of a microcontroller (101), the non-volatile memory comprising a memory cell array (201) and a control module (202), the memory cell array being organized into a plurality of sectors, each sector comprising a plurality of memory cells, the control module comprising an interface module (203) adapted to implement all steps of the method according to any one of claims 1 to 4.
6. The non-volatile memory according to claim 5, wherein the non-volatile memory is a flash memory.
7. The non-volatile memory according to claim 5, wherein, The interface module of the control module for non-volatile memory is a Flash Standard Interface (FSI) type module.
8. A microcontroller (101) comprising a processor (102), at least one input / output interface (107), and a non-volatile memory (103) adapted to store data and exchange data with the processor via a computer bus, the non-volatile memory comprising a memory cell array and a control module, the memory cell array comprising a plurality of sectors each consisting of a plurality of memory cells, and the control module comprising an interface module adapted to implement all steps of the method according to any one of claims 1 to 4.