Electronic apparatus
Patent Information
- Application Number
- JP2023142734
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-09-04
- Publication Date
- 2025-03-14
AI Technical Summary
【0008】 本発明によれば、書き換え不要なデータ項目の再書き込みが発生する頻度が低い電子機器が得られる。
Smart Images

Figure 2025035597000001_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to an electronic device. [Background technology]
[0002] In one mobile phone, two blocks are reserved in flash memory for the data item to be backed up, and the backup process is performed on the older of the two blocks (i.e., the block where a backup was saved earlier) (see, for example, Patent Document 1). [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2002-157710 A Summary of the Invention [Problem to be solved by the invention]
[0004] Unlike EEPROM (Electrically Erasable Programmable Read-Only Memory), which is a type of non-volatile memory, flash memory such as NAND flash memory and NOR flash memory erases data on a sector-by-sector (block as mentioned above) basis. Therefore, every time a data item that needs to be backed up occurs, data is written to all data items corresponding to the sector that corresponds to that data item.
[0005] Therefore, when a large number of data items are allocated to one sector, the frequency with which data items that do not need to be rewritten occurs increases.
[0006] The present invention has been made in consideration of the above problems, and has an object to provide an electronic device in which data items that do not need to be rewritten occur less frequently. [Means for solving the problem]
[0007] The electronic device of the present invention comprises a non-volatile memory having a plurality of sectors, and when erasing certain data, erasing the sector containing the data; and a processor: (a) assigning a plurality of sector groups obtained by dividing a plurality of sectors to a plurality of data item groups obtained by dividing the plurality of sectors, respectively; (b) setting a plurality of data surface areas in each of the sector groups in the plurality of sector groups; and (c) for a certain sector, writing data of the data item group assigned to the sector group in each of the plurality of data surface areas so that the data are identical to each other after erasing the sector. Effect of the Invention
[0008] According to the present invention, an electronic device can be obtained in which the frequency with which data items that do not need to be rewritten occurs is low.
[0009] The above and other objects, features and advantages of the present invention will become more apparent from the following detailed description taken in conjunction with the accompanying drawings. [Brief description of the drawings]
[0010] [Figure 1] FIG. 1 is a block diagram showing a configuration of an electronic device according to an embodiment of the present invention. [Diagram 2] FIG. 2 is a diagram showing an example of a data structure in the nonvolatile memory 2 in FIG. [Diagram 3] FIG. 3 is a flowchart illustrating data rewriting (data updating) in the nonvolatile memory 2 in FIG. [Figure 4] FIG. 4 is a flowchart illustrating the data reading from the nonvolatile memory 2 in FIG. [Diagram 5]FIG. 5 is a diagram for explaining a majority decision for adopting data when there are three data surface areas. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0011] Hereinafter, an embodiment of the present invention will be described with reference to the drawings.
[0012] FIG. 1 is a block diagram showing a configuration of an electronic device according to an embodiment of the present invention.
[0013] The electronic device shown in FIG. 1 is a device having predetermined functions, and includes a processor 1 such as a CPU (Central Processing Unit), a non-volatile memory 2, an internal device 3, a communication device 4, a display device 5, and an input device 6.
[0014] The processor 1 operates according to a program, controls the internal device 3, and reads and writes data from and to the non-volatile memory 2.
[0015] The non-volatile memory 2 has a plurality of sectors, and when erasing certain data, the sector containing the data is erased. In this embodiment, the non-volatile memory 2 is a NOR flash memory.
[0016] The internal device 3 is a device for realizing a predetermined function. For example, when the electronic device is an image forming device such as a printer or a multifunction device, the internal device 3 is a printing device, an image reading device, or the like.
[0017] The communication device 4 is an internal device such as a network interface or a peripheral device interface that performs data communication with other devices.
[0018] The display device 5 is a device that presents information to the user, such as a liquid crystal display, an indicator, etc. The input device 6 is a touch panel, a hard key, etc., that accepts user operations and outputs electrical signals corresponding to the user operations.
[0019] FIG. 2 is a diagram showing an example of a data structure in the nonvolatile memory 2 in FIG.
[0020] In particular, the processor 1 (a) assigns a plurality of sector groups 31-1 to 31-N obtained by dividing a plurality of sectors #1 to #M (M=12 in FIG. 2) to a plurality of data item groups 21-1 to 21-N (N=6 in FIG. 2) obtained by dividing a plurality of data items (backup data #1 to #6000 in this case), (b) sets a plurality of data surface areas 41 in each of a plurality of sectors #j in the sector group 31-i for each sector group 31-1 to 31-N, and (c) writes, for a certain sector #j, data of the data item group 21-i assigned to the sector group 31-i (such as setting data of the internal device 3 and an operation log of the internal device 3) to each of the plurality of data surface areas 41 so that the data surface areas 41 are identical to each other after erasing the sector #j.
[0021] 2, for example, increment data is stored in (the free space of) each sector #j in the sector group 31-i. The processor 1 updates the increment data of the erased sector #j to a value larger than the increment data of the other sectors in the sector group 31-i.
[0022] At that time, the processor 1 updates the increment data after erasing, and then writes the data of the data item group.
[0023] Furthermore, in this embodiment, the number of the multiple data surface areas 41 in each sector #i is an odd number (3 in FIG. 2), and the processor 1 determines the data surface area 41 from which data should be adopted by majority vote for the data of each data item group in the multiple data surface areas 41. In other words, if the data for a certain data item in more than half of the data surface areas 41 are identical to each other, that data is adopted by majority vote.
[0024] Next, the operation of the electronic device will be described.
[0025] (a) Rewriting data in non-volatile memory 2 (updating data)
[0026] FIG. 3 is a flowchart illustrating data rewriting (data updating) in the nonvolatile memory 2 in FIG.
[0027] Processor 1 selects sector #j (focused sector) from which data is to be adopted in each sector group 31-i. In the initial state, processor 1 writes data only to the data item area 41 of the focused sector. Therefore, data in sectors other than the focused sector are all set to the initial value (a single value, here 0xFF).
[0028] When rewriting data of a certain data item, the processor 1 (a) first identifies the sector group 31-j corresponding to the data item group 21-j to which the data item to be rewritten belongs, (b) identifies a target sector in the identified sector group 31-j, (c) selects a sector other than the target sector in the sector group 31-j, and erases the selected sector (step S1). Note that all data values after erasure are reset to the initial value (0xFF).
[0029] Next, the processor 1 reads the increment data of the target sector, adds 1 to the read increment data, and writes the resultant value as increment data in the erased sector (step S2).
[0030] Then, the processor 1 writes the data of the data item group 21-j, which includes new data for the data item to be rewritten, to each of all (here, three) data surface areas 41 in the erased sector (step S3), and switches the sector where the data has been rewritten to the sector of interest (step S4).
[0031] (b) Reading data from non-volatile memory 2
[0032] Fig. 4 is a flow chart for explaining how data is read from the nonvolatile memory 2 in Fig. 1. Fig. 5 is a diagram for explaining a majority decision for adopting data when there are three data surface areas.
[0033] When reading data of a certain data item, the processor 1 (a) first identifies the sector group 31-j corresponding to the data item group 21-j to which the data item of the data to be read belongs, and (b) performs a normality test on each of all (two) sectors in the identified sector group 31-j (step S11).
[0034] In the normality test, (a) the data in each data surface area 41 is checked to see if the data is correct based on the checksum data included in the data, (b) more than half of the data in the data surface area 41 (two or more in the case of three data surface areas 41) is not set to the initial value (0xFF), and (c) for the data item from which data is to be read, the data in the first data surface area 41 is D1, the data in the second data surface area 41 is D2, and the data in the third data surface area 41 is D3. For example, as shown in FIG. 5, the data in the three data surface areas 41 in each sector is compared. That is, if the checksums of D1, D2, and D3 are normal, D1, D2, and D3 are not initial values, and two of D1, D2, and D3 are identical to each other, the data Di is adopted as the data to be read. Also, if there are no two identical data in D1, D2, and D3, the sector is determined to be abnormal. In other words, if more than half of the data Di are identical to each other, the data Di (that sector) is determined to be normal by majority vote.
[0035] Then, the processor 1 determines whether or not all (here, two) sectors in the identified sector group 31-j are normal (step S12).
[0036] If all (two) sectors (and their data) in the identified sector group 31-j are normal, the processor 1 compares the increment data of those sectors, selects the sector with the largest increment data (step S13), and adopts the data to be read from the selected sector (step S14).
[0037] On the other hand, if the identified sector group 31-j has a sector that is not normal, the processor 1 determines whether or not the sector of interest has usable data (step S15). Specifically, the processor 1 determines whether or not the sector of interest has two (or three) pieces of data Di that are identical to each other.
[0038] If the applicable data is in the target sector, the processor 1 determines whether the increment data of the target sector is equal to or greater than the increment data of the other sectors in the sector group 31-j (step S16).
[0039] If the increment data of the noted sector is equal to or greater than the increment data of the other sectors in the sector group 31-j, the processor 1 adopts the read target data of the noted sector (step S17).
[0040] On the other hand, if there is no adoptable data in the target sector in step S15, and if the increment data of the target sector is not greater than or equal to the increment data of the other sectors in the sector group 31-j in step S16, if there is adoptable data Di in the other sector, the processor 1 adopts the data Di to be read from the other sector (step S18).
[0041] If there is no normal sector in the identified sector group 31-j, the processor 1 determines that an error has occurred. If the processor 1 determines that an error has occurred, it may stop the operation of the internal device 3, or may determine whether or not to stop the operation of the internal device 3 depending on the data item to be read when the error occurred. For example, in this case, if the data item to be read when the error occurred is data unnecessary for the operation of the internal device 3 (such as logs such as event history and various count values), the processor 1 does not stop the operation of the internal device 3, and if the data item to be read when the error occurred is data necessary for the operation of the internal device 3 (such as setting data), the processor 1 stops the operation of the internal device 3.
[0042] (c) Data Guarantee
[0043] The following describes data guarantee when a power outage occurs during data rewrite. The timings of power outages that guarantee data are (1) during erasure, (2) during writing incremental data, (3) during data writing to the first data surface area 41 of the three data surface areas 41, (4) during data writing to the second data surface area 41 of the three data surface areas 41, and (5) during data writing to the third data surface area 41 of the three data surface areas 41.
[0044] If a power outage occurs during erasure, some of the data in the sector to be erased will be erased, causing the checksum to become incorrect, and the above-mentioned normality test (step S11) will determine that the sector is not normal. As a result, data from a sector other than the sector to be erased will be used, and the data will be guaranteed.
[0045] If a power outage occurs while writing incremental data, the data values in all data surface areas 41 in the sector to be erased will remain at their initial values, and the above-mentioned normality test (step S11) will determine that the data is not normal, and data from a sector other than the sector to be erased will be used, thereby guaranteeing the data.
[0046] If a power outage occurs while writing data to the first data surface area 41 of the three data surface areas 41, the data values in more than half of the data surface areas 41 in the sectors to be erased will remain at their initial values, and the above-mentioned normality test (step S11) will determine that the data is not normal, and data from a sector other than the sector to be erased will be used, thereby guaranteeing the data.
[0047] If a power outage occurs while writing data to the second data surface area 41 of the three data surface areas 41, the data D1, D2, and D3 in the three data surface areas 41 do not contain two identical pieces of data (i.e., normality is denied by majority vote), so the above-mentioned normality test (step S11) determines that the data is not normal, and data from a sector other than the sector to be erased is used, thereby guaranteeing the data.
[0048] If a power outage occurs while writing data to the third data surface area 41 of the three data surface areas 41, if the data D1 and D2 in the two data surface areas 41 are identical to each other, that data is adopted, and the data is guaranteed.
[0049] In this way, read data is guaranteed even in the event of a power outage or noise inside the hardware.
[0050] As described above, according to the above embodiment, the non-volatile memory 2 has a plurality of sectors, and when erasing certain data, the entire sector including the data is erased. The processor 1 (a) assigns a plurality of sector groups 31-1 to 31-N obtained by dividing a plurality of sectors #1 to #M (M=12 in FIG. 2) to a plurality of data item groups 21-1, . . . , 21-N (N=6 in FIG. 2) obtained by dividing a plurality of data items, respectively, (b) sets a plurality of data surface areas 41 in each sector #j in the sector group 31-i for each sector group 31-i in the plurality of sector groups 31-1 to 31-N, and (c) writes data (setting data of the internal device 3, operation log of the internal device 3, etc.) of the data item group 21-i assigned to the sector group 31-i so as to be mutually identical to each other after erasing the sector #j.
[0051] As a result, since multiple data surface areas 41 are set in each sector for a certain data item group, the number of data items corresponding to each sector is reduced, and the frequency of rewriting data items that do not need to be rewritten is reduced, thereby extending the life of the non-volatile memory 2.
[0052] For example, in the case of the above-mentioned mobile phone having data only on one side in a sector, in order to store the backup data #1 to #6000 shown in FIG. 2 in 12 sectors and 6 sides, the backup data #1 to #3000 are stored in sectors #1 to #3, respectively, and the backup data #3001 to #6000 are stored in sectors #4 to #6, respectively. In this situation, for example, when updating the backup data #500, the above-mentioned mobile phone requires erasing and writing three sectors, sectors #1 to #3, but in the example shown in FIG. 2, it is sufficient to erase and write only two sectors, sectors #1 and #2. In this way, by providing multiple data surface areas 41 in each sector, the frequency of erasing and rewriting data items that do not need to be rewritten is reduced.
[0053] It should be noted that various changes and modifications to the above-described embodiments will be apparent to those skilled in the art. Such changes and modifications may be made without departing from the spirit and scope of the subject matter and without diminishing its intended advantages. In other words, such changes and modifications are intended to be included within the scope of the claims.
[0054] For example, in the above embodiment, in addition to the increment data, at least one increment data having the same value as the increment data may be stored in each sector. In other words, as for the increment data, similarly to the data stored in the data surface area 41, a plurality of (odd number) increment data may be stored in the free area of the sector, and the normality of the increment data may be determined in the same manner. [Industrial Applicability]
[0055] The present invention is applicable to, for example, electronic devices. [Explanation of symbols]
[0056] 1 processor 2. Non-volatile memory
Claims
1. a non-volatile memory having a plurality of sectors, and when erasing certain data, erasing a sector including the data; a processor that (a) assigns a plurality of sector groups obtained by dividing a plurality of sectors to a plurality of data item groups obtained by dividing a plurality of data items, respectively; (b) sets a plurality of data plane areas in each of the sector groups in each of the sector groups; and (c) writes, for a certain sector, data of the data item group to which the sector group is assigned, to each of the plurality of data plane areas so that the data are mutually identical after erasing the sector; An electronic device comprising:
2. Each sector in the sector group stores increment data; the processor updates the increment data of the sector in which the erase has occurred to a value greater than increment data of other sectors in the sector group; 2. The electronic device according to claim 1,
3. 3. The electronic device according to claim 2, wherein the processor updates the increment data after the erasing, and then writes the data of the data item group.
4. 3. The electronic device according to claim 2, wherein in each sector, in addition to the increment data, at least one increment data having the same value as the increment data is stored.
5. the number of the plurality of data surface areas is odd, the processor determines, by majority vote for the data of the data item group in each of the plurality of data surface areas, which data surface area should be adopted; 2. The electronic device according to claim 1,
Citation Information
Patent Citations
Magnetic head, and method and device for magnetic recording / Reproducing using the same
JP2002157710A