CN111433765A - Log storage method, log reading method, intelligent battery and unmanned aerial vehicle - Google Patents

Log storage method, log reading method, intelligent battery and unmanned aerial vehicle Download PDF

Info

Publication number
CN111433765A
CN111433765A CN201880069257.9A CN201880069257A CN111433765A CN 111433765 A CN111433765 A CN 111433765A CN 201880069257 A CN201880069257 A CN 201880069257A CN 111433765 A CN111433765 A CN 111433765A
Authority
CN
China
Prior art keywords
log
flag
value
information
header information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201880069257.9A
Other languages
Chinese (zh)
Inventor
江帆
房玲江
龚如
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SZ DJI Technology Co Ltd
Original Assignee
SZ DJI Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SZ DJI Technology Co Ltd filed Critical SZ DJI Technology Co Ltd
Publication of CN111433765A publication Critical patent/CN111433765A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

Provided are a log storage method, a log reading method, an intelligent battery and an unmanned aerial vehicle. A log storage method, comprising: reading log header information, the log header information including flag information (101); and determining whether to write the log into a flash memory device according to the value of each zone bit in the zone information (102). The storage unit can be determined through the log header information, and each storage unit does not need to be detected, so that the detection time can be reduced. In addition, the log needing to be stored does not need to be written into the originally stored log, so that the data processing amount and the size of occupied cache in the log storing process can be reduced, and the requirement on resources is reduced.

Description

Log storage method, log reading method, intelligent battery and unmanned aerial vehicle Technical Field
The embodiment of the invention relates to the technical field of intelligent batteries, in particular to a log storage method, a log reading method, an intelligent battery and an unmanned aerial vehicle.
Background
In the unmanned aerial vehicle, the storage resources and the computing resources of the battery microprocessor MCU are limited, and an external flash memory device F L ASH is required to store log information so as to record the battery state and locate the abnormal condition of the battery.
Disclosure of Invention
The embodiment of the invention provides a log storage method, a log reading method, an intelligent battery and an unmanned aerial vehicle.
In a first aspect, an embodiment of the present invention provides a log storage method, including:
reading log header information, wherein the log header information comprises mark information;
and determining whether to write the log into a flash memory device according to the value of each zone bit in the zone information.
In a second aspect, an embodiment of the present invention provides a log reading method, including:
reading log header information, wherein the log header information comprises mark information;
determining the initial minimum storage unit in the flash memory device according to the value of each zone bit in the zone information;
and sequentially reading the logs from the initial minimum storage unit until the initial minimum storage unit is reached.
In a third aspect, an embodiment of the present invention provides a smart battery, including a processor and a memory storing executable instructions of the processor, where the processor is in communication with the memory, and is configured to read the executable instructions from the memory to implement:
reading log header information, wherein the log header information comprises mark information;
and determining whether to write the log into a flash memory device according to the value of each zone bit in the zone information.
In a fourth aspect, an embodiment of the present invention provides a log reading apparatus, including:
reading log header information, wherein the log header information comprises mark information;
determining the initial minimum storage unit in the flash memory device according to the value of each zone bit in the zone information;
and sequentially reading the logs from the initial minimum storage unit until the initial minimum storage unit is reached.
In a fifth aspect, an embodiment of the present invention provides an unmanned aerial vehicle, which at least includes a machine body, and the intelligent battery, the power system, and the flight controller, which are provided on the machine body, of the third aspect, where the intelligent battery can supply power to the power system, and the power system provides flight power for the unmanned aerial vehicle.
In a sixth aspect, an embodiment of the present invention provides a machine-readable storage medium, on which computer instructions are stored, and when executed, the computer instructions implement the steps of the log storage method in the first aspect.
In a seventh aspect, an embodiment of the present invention provides a machine-readable storage medium, on which computer instructions are stored, and when the computer instructions are executed, the steps of the log reading method in the second aspect are implemented.
As can be seen from the above technical solution, in this embodiment, by setting the log header information, when there is a need to store a log, the log header information is read; and then determining whether to write the log into the flash memory device according to the value of each zone bit in the zone information. For example, when the flag bit takes the first preset value, the log is written into a storage unit corresponding to the flag bit in the flash memory device. And if no flag bit takes the first preset value, the log is not stored. Therefore, in the embodiment, the storage unit can be determined through the log header information, and each storage unit does not need to be detected, so that the detection time can be reduced. In addition, in the embodiment, the log to be stored does not need to be written into the originally stored log, so that the data processing amount and the size of the occupied cache in the log storage process can be reduced, and the requirement on resources is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
Fig. 1 is a schematic flowchart of a log storage method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating the verification of the validity of a signature according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a process for determining whether a signature is legitimate according to an embodiment of the invention;
FIG. 4 is a flowchart illustrating a process for determining a minimum memory location according to a sequence number according to an embodiment of the present invention;
fig. 5 is a flowchart illustrating a log reading method according to an embodiment of the present invention;
fig. 6 and fig. 7 are schematic diagrams of minimum storage units and corresponding flag bit values in a flash memory device according to an embodiment of the present invention;
fig. 8 is a block diagram of a smart battery according to an embodiment of the present invention;
fig. 9 is a block diagram of a log reading apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. In addition, the features in the embodiments and the examples described below may be combined with each other without conflict.
In the unmanned aerial vehicle, the storage resources and the computing resources of the battery microprocessor MCU are limited, and an external flash memory device F L ASH is required to store log information so as to record the battery state and locate the abnormal condition of the battery.
The invention provides a log storage method, which comprises the steps of setting log header information, reading the log header information when the log is required to be stored, wherein the log header information comprises mark information; then, whether to write the log into the flash memory device can be determined according to the value of each flag bit in the flag information. For example, when the value of the flag bit meets the requirement, the log may be stored in the minimum storage unit corresponding to the flag bit, and the flash memory device includes a plurality of minimum storage units.
It should be noted that the minimum memory cell in this embodiment refers to the minimum memory cell that can be operated each time the flash memory device is erased, for example, 4 kbits. Of course, the technician may also adjust the size of the minimum storage unit according to the specific scenario, and the corresponding scheme falls within the scope of the present application.
Fig. 1 is a schematic flow diagram of a log storage method according to an embodiment of the present invention, and referring to fig. 1, the log storage method may be applied to an electronic device such as an intelligent battery and a battery manager, and for convenience of description, a following description will be given by taking an intelligent battery as an example, where the log storage method includes steps 101 and 102, where:
and 101, reading log header information, wherein the log header information comprises mark information.
In this embodiment, the log header information may be preset, and the content of the log header information may be specifically set according to a specific scenario. Referring to table 1, table 1 shows log header information provided in this embodiment.
TABLE 1 Log header information
Figure PCTCN2018118654-APPB-000001
In the embodiment, the signature is used for verifying the validity of the log header information, whether the signature is valid or not can be determined through the value of the signature, and when the signature is valid, an effective minimum storage unit exists in the flash memory device, so that the log can be stored in the effective minimum storage unit; in the case of an illegal situation, there is no valid storage unit in the flash memory device, in which case the log cannot be stored in the flash memory device.
Note that the default value of the signature value may be, but is not limited to, 0xAA 55. In some embodiments, after the log is written into a minimum storage location in the flash memory device, the value of the flag bit information changes, and accordingly, the default value of the signature also changes. Thus, the proportion or the number of the effective minimum storage units in the flash memory device to all the storage units can be determined according to the variation of the value of the signature, or the current value and the default value (or the maximum value) of the signature.
In other embodiments, the signature changes its value from a default value to 0x FFFF only when all of the minimum memory locations in the flash memory device are unavailable. The signature of the present embodiment is changed in this manner.
In some embodiments, a plurality of flag bits are included in the flag information. The flag bits may be of different lengths to indicate the active state (i.e., usable or unusable) of the plurality of memory cells.
For example, if the length of the flag bit is 2 bits, 4 states, namely 00, 01, 10 and 11, can be represented, and the valid state of each corresponding minimum memory cell can be determined according to the change condition of the flag bit from 00 to 11 or from 11 to 00. For another example, if the length of the flag bit is 1 bit, 2 states can be represented, i.e. 0 represents that the minimum memory cell is not available, and 1 represents that the minimum memory cell is available. Technicians can select the length of the zone bits according to specific scenes, and under the condition that the scheme of the application can be realized, the corresponding scheme falls into the protection scope of the application.
Considering some of the physical properties of flash memory devices: the write operation can only change the data bit in the minimum memory cell from 1 to 0, and the erase operation can only change the data bit in the minimum memory cell from 0 to 1. In this embodiment, the length of the flag bit is 1 bit (1 bit), the flag bit may take a first preset value or a second preset value in this scenario, for example, the first preset value is 1, and the second preset value is 0, and this value is taken as an example in the following embodiments to describe the scheme. In addition, the number of the flag bits is the same as the number of the minimum storage units in the flash memory device, so that the flag bits in the flag information and the minimum storage units in the flash memory device are in one-to-one correspondence.
In this embodiment, the log header information further includes a flag length, where the flag length represents an effective value range of all flag bits in the flag information, and the effective value range is strongly related to the number of minimum storage units in the flash memory device. For example, the number of the minimum storage units is 4096, the effective value range can be 1-4096 (or 0-4095), and the like, so that the value of the flag bit can be judged without exceeding the effective value range, and the data processing amount can be reduced. In other words, the flag length is used to describe how many minimum storage units in the flash memory device can store the log when the log is not stored.
In the case where the difference between the maximum value and the minimum value of the valid range is equal to the number of minimum memory cells, the flag length may not be set in the log header information.
In some embodiments, the log header information may include at least one of: signature, flag length, and flag information. In this embodiment, the log header information may include flag information. It should be noted that the composition of the log header information may be set according to a specific scenario, and is not limited herein.
In some embodiments, the log header information may be stored in a local memory, cache, or cloud, and may also be stored in a flash memory device. In this embodiment, the log header information is stored in a minimum storage unit of the flash memory device. The smallest memory cell may be the first or last memory cell in a flash memory device, thereby facilitating the querying, reading, and refreshing.
In this embodiment, when the smart battery detects that there is a log to be saved, the smart battery may read the log header information from the flash memory device, and may read all the log header information or only read the flag information.
In some embodiments, referring to fig. 2, the smart battery detects the validity of the signature in the log header information before writing the log into the flash memory device after detecting the power-up (corresponding to step 201). By judging whether the signature is legal (corresponding to step 202), if so, executing a step of determining whether to write the log into the flash memory device according to the value of each zone bit in the zone information (corresponding to step 203), namely executing step 102; if the log header information is illegal, the log header information is reinitialized, and the step of reading the log header information (corresponding to step 204), namely step 102, is continuously executed.
It should be noted that, in this embodiment, the sequence of step 203 and step 204 is not sequential, and includes at least one of the following: step 203 is executed before step 204, step 204 is executed before step 203, and step 203 and step 204 are executed simultaneously.
In this embodiment, the checking the validity of the signature in the log header information by the smart battery may include: referring to fig. 3, the smart battery obtains the current value of the signature in the log information (corresponding to step 301). Then. The smart battery compares the current value with a preset value (i.e., a default value) (corresponding to step 302), and when the current value is equal to the preset value, the smart battery determines that the signature is valid (corresponding to step 303), and when the current value is not equal to the preset value, the smart battery determines that the signature is invalid (corresponding to step 304). In the present embodiment, by determining whether the log header information is legitimate,
and 102, determining whether to write the log into the flash memory device according to the value of each flag bit in the flag information.
After the mark information is read, the intelligent battery can obtain the value of each mark bit in the mark information. The obtaining mode may include:
in a first mode, the intelligent battery can randomly read the values of the flag bits, and then select one flag bit with the value as the first preset value.
And in the second mode, the intelligent battery can read the values of the flag bits in sequence according to the sequence of the flag bits. Then, a flag bit with a value of a first preset value is selected from the flag bits.
And thirdly, the intelligent battery can read the values of the flag bits randomly or sequentially, and if the value of the flag bit is the second preset value, the intelligent battery continues to read the flag bit until the value of one flag bit is read to be the first preset value.
Considering that the number of times of erasing each memory cell in the flash memory device is limited, the number of times of erasing each memory cell is equalized, that is, the method of sequentially storing logs into the smallest memory cells is adopted in this embodiment to achieve the effect of equalizing the number of times of erasing. In other words, in this embodiment, the value of the flag bit is obtained in the third mode.
In this embodiment, when the smart battery detects that the flag information includes a flag bit whose value is a first preset value, the log to be stored is written into the minimum storage unit corresponding to the flag bit. Wherein determining the location of the minimum storage unit may include: referring to fig. 4, when the smart battery detects a flag bit whose value is a first preset value, a serial number of the flag bit may be determined (corresponding to step 401). In some scenarios, the sequence number is a sequence number of a first flag bit taking a value of a first preset value. Then, the smart battery obtains the offset address of the minimum memory cell corresponding to the flag bit in the flash memory device according to the serial number of the flag bit based on the relationship between the serial number and the offset address (corresponding to step 402). Finally, the smart device sequentially writes the logs into the minimum storage units corresponding to the offset addresses (corresponding to step 403). In this way, in this embodiment, the logs are sequentially written into the minimum storage units, so that the erase and write times of the minimum storage units are kept the same (or similar), an erase and write balancing effect is achieved, and the service life of the flash memory device is prolonged.
In practical applications, the size of each minimum memory unit is fixed, for example, 4 kbytes. Moreover, the physical address (i.e., the first address) of the first storage unit in the flash memory device is also fixed, so the relationship between the serial number and the offset address can be determined according to the size and the serial number of each minimum storage unit. For example, if the physical address of the first memory cell is 0x00FF and the sequence number is 2, the offset address of the 2 nd smallest memory cell can be 2 × 4 kbytes. Then, the intelligent battery is combined with the physical address of the first storage unit to obtain the physical address of the 2 nd minimum storage unit. For convenient reference, a table can be established by the serial number and the offset address in advance and stored in a cache, a local memory or a cloud and other positions.
In this embodiment, in consideration of the physical property of the flash memory device, before the intelligent device writes the log into the minimum storage unit, the intelligent device performs an erase operation on the minimum storage unit, and then writes the log into the minimum storage unit after the erase operation. In addition, before, after or at the same time of erasing the minimum storage unit, the intelligent setting also changes the value of the corresponding zone bit from the first preset value to the second preset value, so that the state of the minimum storage unit is changed from 'available' to 'unavailable'.
In some application scenarios, the length of the log may be adjusted. In this embodiment, a log of 128 bytes is taken as an example for explanation. Table 1 shows the format of the log, and Table 2 is a description of the contents of each part in the log
Table 1 Log Format
Figure PCTCN2018118654-APPB-000002
Table 2 description of contents of each part in log
Content providing method and apparatus Description of the invention
Log_item Uniform format Log record Unit, fixed Length 128 bytes
Log_set Log type
Log_id Log sub-types
Sys_sec System time
UTC UTC time synchronization to smart battery for current flight control
Data Log data segment, the meaning of specific field is determined by log type and sub-type
Crc8 Crc8 check value of the first 127 bytes of a logging unit
The intelligent battery writes one 128-byte log into the minimum storage unit at a time until the minimum storage unit is full of logs. Then, the intelligent battery obtains the next flag bit whose value is the first preset value, where the start position may be the first flag bit of all the flag bits or the flag bit corresponding to the minimum storage unit of the just-full log, and then returns to step 101.
In this embodiment, after the intelligent device detects all the zone bits in the zone information, if the zone information does not include a zone bit whose value is the first preset value, that is, if all the zone bits have values which are the second preset value, the log header information is refreshed.
It should be noted that, in this embodiment, the log header information is refreshed, and not only the signature but also the flag information is refreshed. Taking the refresh flag information as an example, the values of all flag bits in the flag information are adjusted from the second preset value to the first preset value. After the log header information is refreshed, it indicates that all the minimum storage units of the flash memory device are in an available state, in other words, all the minimum storage units are subjected to one-time erasing operation, so that all the minimum storage units have the same (or similar) erasing times, and the effect of balancing the erasing times is achieved.
To this end, in this embodiment, by setting the log header information, when there is a need to store a log, the log header information is read; and then determining whether to write the log into the flash memory device according to the value of each zone bit in the zone information. For example, when the flag bit takes the first preset value, the log is written into a storage unit corresponding to the flag bit in the flash memory device. And if no flag bit takes the first preset value, the log is not stored. Therefore, in the embodiment, the storage unit can be determined through the log header information, and each storage unit does not need to be detected, so that the detection time can be reduced. In addition, in the embodiment, the log to be stored does not need to be written into the originally stored log, so that the data processing amount and the size of the occupied cache in the log storage process can be reduced, and the requirement on resources is reduced.
After the log is stored in the flash memory device based on the log storage method, an embodiment of the present invention further provides a log reading method, and fig. 5 is a schematic flow diagram of the log reading method provided in the embodiment of the present invention, and the log reading method can be applied to a log reading device. The log reading device may be an electronic device such as a mobile terminal, a smart battery, a reading card, a tablet computer, or a personal computer, and the description will be continued with the smart battery as an example. Referring to fig. 5, a log reading method includes steps 501 to 503, where:
and 501, reading log header information, wherein the log header information comprises mark information.
The specific method and principle of step 501 and step 101 are the same, please refer to fig. 1 and related contents of step 101 for detailed description, which is not repeated herein.
502, determining a starting minimum storage unit in the flash memory device according to the value of each flag bit in the flag information.
In this embodiment, the intelligent battery obtains values of flag bits in the flag information to obtain a first flag bit with a first preset value, and a minimum storage unit corresponding to the first flag bit is used as a minimum storage unit for reading a start of a log.
It should be noted that, in this embodiment, the intelligent device obtains the value of each flag bit and the initial minimum storage unit, which may adopt the related contents of the third method in fig. 1 and step 102, and details are not described here.
Of course, the intelligent battery may also obtain values of the flag bits in the flag information to obtain the flag bits with the value of the first preset value, and the minimum storage unit corresponding to one of the flag bits is used as the minimum storage unit for reading the start of the log, which also may implement the scheme of the present application and is not described herein again.
In another embodiment, when the intelligent battery detects that the flag information does not include a flag bit whose value is the first preset value, that is, all the flag bits have the second preset value, the intelligent battery determines that the initial minimum storage unit is the first unit whose value is the second preset value.
And 503, sequentially reading the logs from the initial minimum storage unit until the initial minimum storage unit is reached.
In this embodiment, the intelligent battery sequentially reads the logs stored in the flash memory device from the initial minimum storage unit, returns to the first minimum storage unit of the flash memory device after reading the last storage unit, and continues to read the logs until the initial minimum storage unit determined before is reached. That is, the smart battery reads each minimum storage unit in the flash memory device in turn from the starting minimum storage unit, thereby obtaining the entire log.
It can be understood that, since the corresponding minimum storage unit does not store a new log when the flag bit takes the first preset value, and the minimum storage unit taking the second preset value stores the latest log, the log is read from the old to the new log according to the above manner. When the reading direction changes, the starting minimum storage unit is the minimum storage unit which takes the second preset value as the value and corresponds to the zone bit closest to the first zone bit taking the first preset value, and under the condition, the logs from the new to the old can be read.
Fig. 6 is a schematic diagram of minimum storage units and corresponding flag bits in a flash memory device according to an embodiment of the present invention, referring to fig. 6, an intelligent battery determines that a flag bit taking a first preset value is a flag bit in row 3 and column 3, and then reads a sequence of the minimum storage units to indicate positions of the minimum storage units (row, column), as follows:
(3,3)、(3,4)、(3,5);
(4,1)、(4,2)、(4,3)、(4,4)、(4,5);
(5,1)、(5,2)、(5,3)、(5,4)、(5,5);
(1,1)、(1,2)、(1,3)、(1,4)、(1,5);
(2,1)、(2,2)、(2,3)、(2,4)、(2,5);
(3,1)、(3,2)、(3,3)
note that the last one is(3,3)And distinguishing other minimum storage units by adopting different fonts, and indicating that the data are not read again when the minimum storage units return to the initial minimum storage units.
In this way, the smart battery can read all the logs stored in the flash memory device, and the log time is from old to new.
In another embodiment, the intelligent battery may further read the logs stored in the minimum storage units in the opposite direction, and the reading sequence is as follows:
(3,2)、(3,1);
(2,5)、(2,4)、(2,3)、(2,2)、(2,1);
(1,5)、(1,4)、(1,3)、(1,2)、(1,1);
(5,5)、(5,4)、(5,3)、(5,2)、(5,1);
(4,5)、(4,4)、(4,3)、(4,2)、(4,1);
(3,5)、(3,4)、(3,3)、(3,2)
in this way, the smart battery can read all the logs stored in the flash memory device, and the log time is from new to old.
In another embodiment, when the intelligent battery detects that the flag information does not include a flag bit whose value is the first preset value, that is, all the flag bits have the second preset value, the intelligent battery determines that the initial minimum storage unit is the first unit whose value is the second preset value.
Fig. 7 is a schematic diagram of minimum storage units and corresponding flag bit values in a flash memory device according to an embodiment of the present invention, and referring to fig. 7, an intelligent battery reads logs stored in the minimum storage units, where the reading sequence is:
(1,1)、(1,2)、(1,3)、(1,4)、(1,5);
(2,1)、(2,2)、(2,3)、(2,4)、(2,5);
(3,1)、(3,2)、(3,3)、(3,4)、(3,5);
(4,1)、(4,2)、(4,3)、(4,4)、(4,5);
(5,1)、(5,2)、(5,3)、(5,4)、(5,5)。
in this way, the smart battery can read all the logs stored in the flash memory device, and the log time is from old to new.
Therefore, in this embodiment, the initial minimum storage unit can be determined through the log header information, and then all logs from old to new or new to old are read, so that the reading efficiency is improved.
Fig. 8 is a block diagram of a smart battery according to an embodiment of the present invention, and referring to fig. 8, a smart battery 800 includes a processor 801 and a memory 802 storing executable instructions of the processor 801, where the processor 801 communicates with the memory 802 through a communication bus 803 for reading the executable instructions from the memory 802 to implement:
reading log header information, wherein the log header information comprises mark information;
and determining whether to write the log into a flash memory device according to the value of each zone bit in the zone information.
In some embodiments, the processor 801 is configured to determine whether to write the log into the flash memory device according to values of flag bits in the flag information, including:
and if the flag information contains a flag bit with a value of a first preset value, writing the log into a minimum storage unit corresponding to the flag bit.
In some embodiments, the processor 801 configured to write the log into the minimum storage unit corresponding to the flag bit includes:
determining the serial number of the flag bit;
based on the relation between the serial number and the offset address, acquiring the offset address of the minimum storage unit in the flash memory device according to the serial number of the zone bit;
and sequentially writing the logs into the minimum storage units corresponding to the offset addresses.
In some embodiments, the sequence number is a sequence number of a first flag bit taking a value of a first preset value.
In some embodiments, the sequentially writing the logs into the minimum storage units corresponding to the offset addresses by the processor 801 includes:
performing an erase operation on the minimum memory cell;
and writing the log into the minimum storage unit after the erasing operation.
In some embodiments, the sequentially writing the logs into the minimum storage units corresponding to the offset addresses by the processor 801 further includes:
and modifying the value of the zone bit from the first preset value to a second preset value.
In some embodiments, the log header information is stored in any one of the smallest storage units in the flash memory device.
In some embodiments, the processor 801 is configured to determine whether to write the log into the flash memory device according to values of flag bits in the flag information, including:
and if all the zone bits in the zone information take on the second preset value, refreshing the log header information.
In some embodiments, the number of flag bits in the flag bit information is the same as the minimum number of memory cells in the flash memory device.
In some embodiments, each flag bit length is one bit.
In some embodiments, the log header information further includes a flag length; the mark length is strongly correlated to each mark bit length.
In some embodiments, the log header information further includes a flag length; the value of the flag length is strongly related to the number of minimum memory cells in the flash memory device.
In some embodiments, the log header information further comprises a signature; after detecting that the power is turned on again, before determining whether to write the log into the flash memory device according to the value of each flag bit in the flag information, the processor 801 is further configured to:
verifying the validity of the signature in the log header information;
if the log header information is illegal, the log header information is reinitialized, and the step of reading the log header information is continuously executed;
and if the log is legal, determining whether to write the log into the flash memory device according to the value of each zone bit in the zone information.
In some embodiments, the processor 801 configured to verify the validity of the signature in the log header information includes:
acquiring a current value of a signature in the log header information;
comparing the current value with a preset value;
if the current value is equal to the preset value, the signature is legal; if not, the signature is illegal.
Fig. 9 is a block diagram of an intelligent battery according to an embodiment of the present invention, and referring to fig. 9, a log reading apparatus 900 includes a processor 901 and a memory 902 storing executable instructions of the processor 901, where the processor 901 communicates with the memory 902 through a communication bus 903, and is configured to read the executable instructions from the memory 902 to implement:
reading log header information, wherein the log header information comprises mark information;
determining the initial minimum storage unit in the flash memory device according to the value of each zone bit in the zone information;
and sequentially reading the logs from the initial minimum storage unit until the initial minimum storage unit is reached.
In some embodiments, if the flag information includes a flag bit whose value is a first preset value, the starting minimum storage unit is a unit whose flag bit value is the first preset value.
In some embodiments, if the flag information includes a flag bit whose value is a first preset value, the starting minimum storage unit is a first unit whose flag bit value is the first preset value.
In some embodiments, if the flag information does not include a flag bit whose value is a first preset value, the starting minimum storage unit is a first unit whose value of the flag bit is a second preset value.
The embodiment of the invention also provides an unmanned aerial vehicle which at least comprises a body, and the intelligent battery, the power system and the flight controller which are arranged on the body and are shown in the figure 8, wherein the intelligent battery can supply power for the power system, and the power system provides flight power for the unmanned aerial vehicle.
The embodiment of the present invention further provides a machine-readable storage medium, where computer instructions are stored on the machine-readable storage medium, and when the computer instructions are executed, the computer instructions implement the steps of the log storage method described in fig. 1 to fig. 7.
The embodiment of the present invention further provides a machine-readable storage medium, where computer instructions are stored on the machine-readable storage medium, and when the computer instructions are executed, the steps of the log reading method are implemented according to the steps of the log storage method described in fig. 1 to fig. 7.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above detailed description of the detection apparatus and method provided by the embodiments of the present invention has been presented, and the present invention has been made by applying specific examples to explain the principle and the implementation of the present invention, and the above description of the embodiments is only used to help understanding the method and the core idea of the present invention; to sum up, the present disclosure should not be construed as limiting the invention, which will be described in the following description but will be modified within the scope of the invention by the spirit of the present disclosure.

Claims (39)

  1. A method of log storage, comprising:
    reading log header information, wherein the log header information comprises mark information;
    and determining whether to write the log into a flash memory device according to the value of each zone bit in the zone information.
  2. The log storage method according to claim 1, wherein determining whether to write the log into the flash memory device according to a value of each flag bit in the flag information comprises:
    and if the flag information contains a flag bit with a value of a first preset value, writing the log into a minimum storage unit corresponding to the flag bit.
  3. The log storage method according to claim 2, wherein writing the log into the minimum storage unit corresponding to the flag bit comprises:
    determining the serial number of the flag bit;
    based on the relation between the serial number and the offset address, acquiring the offset address of the minimum storage unit in the flash memory device according to the serial number of the zone bit;
    and sequentially writing the logs into the minimum storage units corresponding to the offset addresses.
  4. The log storage method of claim 3, wherein the sequence number is a sequence number of a first flag bit taking a value of a first preset value.
  5. The log storage method according to claim 3, wherein sequentially writing the log into the minimum storage unit corresponding to the offset address comprises:
    performing an erase operation on the minimum memory cell;
    and writing the log into the minimum storage unit after the erasing operation.
  6. The log storage method according to claim 5, wherein sequentially writing the log into the minimum storage unit corresponding to the offset address further comprises:
    and modifying the value of the zone bit from the first preset value to a second preset value.
  7. The log storage method of claim 1, wherein the log header information is stored in any one of minimum storage units in the flash memory device.
  8. The log storage method according to claim 1, wherein determining whether to write the log into the flash memory device according to a value of each flag bit in the flag information comprises:
    and if all the zone bits in the zone information take on the second preset value, refreshing the log header information.
  9. The log storage method of claim 1, wherein the number of flag bits in the flag bit information is the same as a minimum number of storage units in a flash memory device.
  10. The log storage method of claim 9 wherein each flag bit length is one bit.
  11. The log storage method of claim 1, wherein the log header information further comprises a flag length; the mark length is strongly correlated to each mark bit length.
  12. The log storage method of claim 1, wherein the log header information further comprises a flag length; the value of the flag length is strongly related to the number of minimum memory cells in the flash memory device.
  13. The log storage method of claim 1, wherein the log header information further comprises a signature; after detecting that the power is turned on again, before determining whether to write the log into the flash memory device according to the value of each flag bit in the flag information, the method further includes:
    verifying the validity of the signature in the log header information;
    if the log header information is illegal, the log header information is reinitialized, and the step of reading the log header information is continuously executed;
    and if the log is legal, determining whether to write the log into the flash memory device according to the value of each zone bit in the zone information.
  14. The log storage method of claim 13, wherein verifying the validity of the signature in the log header information comprises:
    acquiring a current value of a signature in the log header information;
    comparing the current value with a preset value;
    if the current value is equal to the preset value, the signature is legal; if not, the signature is illegal.
  15. A log reading method, comprising:
    reading log header information, wherein the log header information comprises mark information;
    determining the initial minimum storage unit in the flash memory device according to the value of each zone bit in the zone information;
    and sequentially reading the logs from the initial minimum storage unit until the initial minimum storage unit is reached.
  16. The log reading method according to claim 15, wherein if the flag information includes a flag bit whose value is a first preset value, the initial minimum storage unit is a unit whose flag bit value is the first preset value.
  17. The log reading method according to claim 15, wherein if the flag information includes a flag bit whose value is a first preset value, the initial minimum storage unit is a first unit whose flag bit value is the first preset value.
  18. The log reading method according to claim 15, wherein if the flag information does not include a flag bit whose value is a first preset value, the starting minimum storage unit is a first unit whose flag bit has a value of a second preset value.
  19. A smart battery comprising a processor and a memory storing processor-executable instructions, the processor in communication with the memory for reading executable instructions from the memory to implement:
    reading log header information, wherein the log header information comprises mark information;
    and determining whether to write the log into a flash memory device according to the value of each zone bit in the zone information.
  20. The smart battery of claim 19, wherein the processor configured to determine whether to write the log into the flash memory device according to values of flag bits in the flag information comprises:
    and if the flag information contains a flag bit with a value of a first preset value, writing the log into a minimum storage unit corresponding to the flag bit.
  21. The smart battery of claim 20, wherein the processor configured to write the log into the minimum storage unit corresponding to the flag bit comprises:
    determining the serial number of the flag bit;
    based on the relation between the serial number and the offset address, acquiring the offset address of the minimum storage unit in the flash memory device according to the serial number of the zone bit;
    and sequentially writing the logs into the minimum storage units corresponding to the offset addresses.
  22. The smart battery of claim 21, wherein the serial number is a serial number of a first flag bit taking a value of a first preset value.
  23. The smart battery of claim 21, wherein the processor is configured to sequentially write the log into the minimum storage unit corresponding to the offset address comprises:
    performing an erase operation on the minimum memory cell;
    and writing the log into the minimum storage unit after the erasing operation.
  24. The intelligent battery of claim 23, wherein the processor is configured to sequentially write the log into the minimum storage unit corresponding to the offset address further comprises:
    and modifying the value of the zone bit from the first preset value to a second preset value.
  25. The smart battery of claim 19, wherein the log header information is stored in any one of the smallest storage units in the flash memory device.
  26. The smart battery of claim 19, wherein the processor configured to determine whether to write the log into the flash memory device according to values of flag bits in the flag information comprises:
    and if all the zone bits in the zone information take on the second preset value, refreshing the log header information.
  27. The smart battery of claim 19, wherein the number of flag bits in the flag bit information is the same as the minimum number of memory cells in the flash memory device.
  28. The smart battery of claim 27, wherein each flag bit length is one bit.
  29. The smart battery of claim 19, wherein the log header information further comprises a flag length; the mark length is strongly correlated to each mark bit length.
  30. The smart battery of claim 19, wherein the log header information further comprises a flag length; the value of the flag length is strongly related to the number of minimum memory cells in the flash memory device.
  31. The smart battery of claim 19, wherein the log header information further comprises a signature; after detecting that the power is turned on again, before determining whether to write the log into the flash memory device according to the value of each flag bit in the flag information, the processor is further configured to:
    verifying the validity of the signature in the log header information;
    if the log header information is illegal, the log header information is reinitialized, and the step of reading the log header information is continuously executed;
    and if the log is legal, determining whether to write the log into the flash memory device according to the value of each zone bit in the zone information.
  32. The smart battery of claim 31, wherein the processor configured to verify the validity of the signature in the log header information comprises:
    acquiring a current value of a signature in the log header information;
    comparing the current value with a preset value;
    if the current value is equal to the preset value, the signature is legal; if not, the signature is illegal.
  33. A log reading device comprising a processor and a memory storing processor-executable instructions, the processor in communication with the memory for reading executable instructions from the memory to implement:
    reading log header information, wherein the log header information comprises mark information;
    determining the initial minimum storage unit in the flash memory device according to the value of each zone bit in the zone information;
    and sequentially reading the logs from the initial minimum storage unit until the initial minimum storage unit is reached.
  34. The log reading apparatus of claim 33, wherein if the flag information includes a flag bit with a first preset value, the starting minimum storage unit is a unit whose flag bit has the first preset value.
  35. The log reading apparatus of claim 33, wherein if the flag information includes a flag bit having a first preset value, the initial minimum storage unit is a first unit whose flag bit has the first preset value.
  36. The log reading apparatus of claim 33, wherein if the flag information does not include a flag bit taking a first preset value, the starting minimum storage unit is a first unit whose flag bit takes a second preset value.
  37. An unmanned aerial vehicle, characterized in that includes the organism at least and locate intelligent battery, driving system and flight controller of any one of claims 19 ~ 32 on the organism, intelligent battery can be for driving system supplies power, driving system does unmanned aerial vehicle provides flight power.
  38. A machine-readable storage medium having stored thereon computer instructions which, when executed, implement the steps of the log storage method of any of claims 1 to 15.
  39. A machine-readable storage medium having stored thereon computer instructions which, when executed, implement the steps of the log reading method of any one of claims 16 to 18.
CN201880069257.9A 2018-11-30 2018-11-30 Log storage method, log reading method, intelligent battery and unmanned aerial vehicle Pending CN111433765A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/118654 WO2020107430A1 (en) 2018-11-30 2018-11-30 Log storing method, log reading method, smart battery, and unmanned aerial vehicle

Publications (1)

Publication Number Publication Date
CN111433765A true CN111433765A (en) 2020-07-17

Family

ID=70854261

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201880069257.9A Pending CN111433765A (en) 2018-11-30 2018-11-30 Log storage method, log reading method, intelligent battery and unmanned aerial vehicle

Country Status (2)

Country Link
CN (1) CN111433765A (en)
WO (1) WO2020107430A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112992066A (en) * 2021-04-26 2021-06-18 北京集创北方科技股份有限公司 Display data access method and control circuit thereof, display and information processing device

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1742243A (en) * 2002-12-23 2006-03-01 西门子能量及自动化公司 Method for utilizing a memory device for a PLC
WO2006064498A2 (en) * 2004-12-16 2006-06-22 Ramot At Tel-Aviv University Ltd. Transactional flash file system for microcontrollers and embedded systems
CN101079008A (en) * 2006-05-22 2007-11-28 中国软件与技术服务股份有限公司 Mobile memory divulgence protection method and system
JP2010061397A (en) * 2008-09-03 2010-03-18 Ntt Docomo Inc Device and method for management of operation log
CN102089746A (en) * 2008-05-13 2011-06-08 微软公司 Flash recovery employing transaction log
CN102567184A (en) * 2011-12-27 2012-07-11 青岛海信宽带多媒体技术有限公司 Journal storage method based on Flash
US20170010833A1 (en) * 2013-12-24 2017-01-12 Feitian Technologies Co., Ltd. Data writing and reading methods for flash
CN106408790A (en) * 2016-08-26 2017-02-15 恒银金融科技股份有限公司 Method for writing and reading log information of circulating machine core of financial equipment
CN106951521A (en) * 2017-03-20 2017-07-14 广东欧珀移动通信有限公司 The reading/writing method of journal file, apparatus and system
CN108829342A (en) * 2018-05-09 2018-11-16 青岛海信宽带多媒体技术有限公司 A kind of log storing method, system and storage device
CN108875075A (en) * 2018-07-09 2018-11-23 深圳市道通智能航空技术有限公司 The storage method and unmanned plane image transmission system of UAV system log

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106033322B (en) * 2015-03-17 2019-11-01 北京元心科技有限公司 A kind of date storage method and device
GB201601303D0 (en) * 2016-01-25 2016-03-09 Above Surveying Ltd Utilising UAVs for detecting defects in solar panel arrays
CN107291892A (en) * 2017-06-21 2017-10-24 郑州云海信息技术有限公司 A kind of method and apparatus of log
CN108829345B (en) * 2018-05-25 2020-02-21 华为技术有限公司 Data processing method of log file and terminal equipment

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1742243A (en) * 2002-12-23 2006-03-01 西门子能量及自动化公司 Method for utilizing a memory device for a PLC
WO2006064498A2 (en) * 2004-12-16 2006-06-22 Ramot At Tel-Aviv University Ltd. Transactional flash file system for microcontrollers and embedded systems
CN101079008A (en) * 2006-05-22 2007-11-28 中国软件与技术服务股份有限公司 Mobile memory divulgence protection method and system
CN102089746A (en) * 2008-05-13 2011-06-08 微软公司 Flash recovery employing transaction log
JP2010061397A (en) * 2008-09-03 2010-03-18 Ntt Docomo Inc Device and method for management of operation log
CN102567184A (en) * 2011-12-27 2012-07-11 青岛海信宽带多媒体技术有限公司 Journal storage method based on Flash
US20170010833A1 (en) * 2013-12-24 2017-01-12 Feitian Technologies Co., Ltd. Data writing and reading methods for flash
CN106408790A (en) * 2016-08-26 2017-02-15 恒银金融科技股份有限公司 Method for writing and reading log information of circulating machine core of financial equipment
CN106951521A (en) * 2017-03-20 2017-07-14 广东欧珀移动通信有限公司 The reading/writing method of journal file, apparatus and system
CN108829342A (en) * 2018-05-09 2018-11-16 青岛海信宽带多媒体技术有限公司 A kind of log storing method, system and storage device
CN108875075A (en) * 2018-07-09 2018-11-23 深圳市道通智能航空技术有限公司 The storage method and unmanned plane image transmission system of UAV system log

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112992066A (en) * 2021-04-26 2021-06-18 北京集创北方科技股份有限公司 Display data access method and control circuit thereof, display and information processing device

Also Published As

Publication number Publication date
WO2020107430A1 (en) 2020-06-04

Similar Documents

Publication Publication Date Title
US10120752B2 (en) Data storage device and data access-method
US20090228634A1 (en) Memory Controller For Flash Memory
CN103823642A (en) Method and system used for Flash balance storage
US20230057089A1 (en) Upgrade method, computer system, and remote upgrade device implementing efficient remote upgrade
EP3142014A1 (en) Method, device and user equipment for reading/writing data in nand flash
CN111933199B (en) Data read-write method and device based on memory and storage medium
EP3543858A1 (en) Method for checking and compiling system start-up files
CN107045423B (en) Memory device and data access method thereof
TW201526007A (en) Method, device and operating system for processing, using a NAND flash memory burn data
CN114327258B (en) Solid state disk processing method, system, equipment and computer storage medium
CN107678977B (en) Reading and writing method and device of counter
CN111433765A (en) Log storage method, log reading method, intelligent battery and unmanned aerial vehicle
CN111737161B (en) File transmission method, terminal and storage medium of Flash memory
US9443604B2 (en) Electronic device and data-management method thereof
CN106502839B (en) Storage method and system based on automobile BCM Flash
CN107257281B (en) Method, apparatus and computer readable storage medium for NOR F L ASH storage key record
US11720276B2 (en) Memory system and controller for managing write status
CN105867833A (en) Data storage apparatus and data storage method
CN107203332B (en) Data storage device, flash memory controller and operation method thereof
CN112148220B (en) Method, device, computer storage medium and terminal for realizing data processing
CN112433959A (en) Method and device for realizing data storage processing, computer storage medium and terminal
CN113434086A (en) Data storage method and device, nonvolatile memory device and memory
US20150012688A1 (en) Computer system and operating method thereof
US8312205B2 (en) Method for identifying a page of a block of flash memory, and associated memory device
CN116610269B (en) Data storage method, device, storage medium and controller

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200717