GNSS (Global Navigation Satellite System) chip sealing FLASH exception protection method and file system
By adding the CRC32 checksum repeat read mechanism to the FLASH of the GNSS chip, the three-state problem of the chip when the external power supply is disconnected is solved, preventing crashes, ensuring the normal operation of the GNSS chip and the output of the positioning result.
Patent Information
- Application Number
- CN202411612627.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The FLASH sealed in the GNSS chip is prone to enter the three states when the external power supply is disconnected, resulting in file information changes, incorrect operation of the firmware area, and causing crashes.
When writing a file, add the CRC32 field to verify it to ensure data integrity; when reading, repeat the reading several times to ensure data consistency and prevent misoperation.
It effectively prevents FLASH from being misoperated, avoids GNSS chip crashing, and ensures the output of positioning results.
Smart Images

Figure CN119152918A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of GNSS technology, and in particular to a GNSS chip packaged FLASH abnormality protection method and a file system. Background Art
[0002] In the prior art, GNSS chips are sealed with FLASH, and FLASH is used as a storage medium to store firmware and parameters that need to be saved during operation. Due to the characteristics of FLASH, when the FLASH sealed in the GNSS chip stores data during operation, if the external power is suddenly disconnected, the area being erased or written will enter a three-state characteristic (the data in the area read multiple times will be different and not the saved data). Because the software uses the file system to read and write data in the form of files, if the three-state occurs, the file information (address, length, file name, etc.) of the file will change. When the next power-on write operation is performed, due to the address change, the write FALSH operation mistakenly operates the FLASH program firmware area, and the code cannot run, resulting in a freeze, and the GNSS chip has no output. Summary of the invention
[0003] The technical problem to be solved by the embodiments of the present invention is to provide a GNSS chip packaged FLASH abnormality protection method and a file system to prevent a crash after the FLASH occurs in a three-state state.
[0004] In order to solve the above technical problems, an embodiment of the present invention proposes a GNSS chip package FLASH abnormality protection method, comprising: File writing step: read whether there is a file to be written in FLASH, wherein the file to be written includes the file data to be written and the file header information. If not, add a corresponding CRC32 field to the file header information of the file to be written, and then write the file to be written into FLASH; then read the file existing in FLASH, perform CRC32 check on the file header information of the read file except the CRC32 field. If the check passes, write the file data as needed to update the file header information of the read file, and update the corresponding CRC32 field in the file header information of the read file according to the check value of the CRC32 check, and finally write the updated file header information and the file data to be written into FLASH; if the check fails, directly return an error; File reading step: read the target file in FLASH, wherein the reading is performed several times, and if the results of the several times are the same, the data of the target file is returned.
[0005] Accordingly, the embodiment of the present invention further provides a file system for GNSS chip encapsulated FLASH abnormal protection. When writing a file, the system reads the interface of FLASH to determine whether there is a file to be written in FLASH, wherein the file to be written includes the file data to be written and the file header information. If not, the system adds a corresponding CRC32 field to the file header information of the file to be written, and then writes the file to be written in FLASH; then the file existing in FLASH is read, and a CRC32 check is performed on the file header information of the read file except for the CRC32 field. If the check passes, the file data is written as needed to update the file header information of the read file, and the corresponding CRC32 field in the file header information of the read file is updated according to the check value of the CRC32 check, and finally the updated file header information and the file data to be written are written into FLASH; if the check fails, an error is directly returned; When reading a file, the system reads the interface of the FLASH, and reads it several times. If the results of the several times are the same, the data of the target file is returned.
[0006] The beneficial effects of the present invention are as follows: after the FLASH is in the three-state state, the present invention will not cause erroneous operation and will not operate the firmware area of the FLASH, thereby preventing the GNSS chip from being unable to operate and outputting positioning results. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] Figure 1 It is a flowchart of the file writing step of an embodiment of the present invention.
[0008] Figure 2 It is a flowchart of the file reading step of an embodiment of the present invention. DETAILED DESCRIPTION
[0009] It should be noted that, in the absence of conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. The present invention is further described in detail below in conjunction with the drawings and specific embodiments.
[0010] In the embodiments of the present invention, if there are directional indications (such as up, down, left, right, front, back, etc.), they are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0011] In addition, in the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0012] The GNSS chip package FLASH abnormality protection method according to the embodiment of the present invention includes a file writing step and a file reading step.
[0013] Please refer to Figure 1 , file writing step: read whether there is a file to be written in FLASH. Among them, the file to be written includes the file data and file header information that need to be written. The file header information stores many parameters, such as file name, size, storage address, etc. If not, add a corresponding CRC32 field to the file header information of the file to be written, and then write the file to be written into FLASH. The CRC32 field is the CRC32 check value obtained by performing CRC32 check on other fields in the file header information except the CRC32 field. If so, read the file existing in FLASH, and perform CRC32 check on the file header information of the read file except the CRC32 field. That is, compare it with the CRC32 field in the read file header information, and the check passes if they are the same.
[0014] If the check passes, the file data is written as needed to update the file header information, and the corresponding CRC32 field in the file header information of the read file is updated (that is, a CRC32 check is performed on the fields other than the CRC32 field in the updated file header information to obtain the CRC32 check value, and the corresponding CRC32 field in the file header information is updated according to the CRC32 check value). Finally, the updated file header information and the file data to be written are written to FLASH.
[0015] If the check fails, an error is returned directly. If the check fails, it means that there is rewriting, so you cannot write it casually.
[0016] Please refer to Figure 2 , File reading step: read the target file in FLASH, wherein, when reading, read several times, if the results of several times are the same, then return the data of the target file. Preferably, read three times, and only when the results of three times are the same, return the data to the file system, otherwise return an error.
[0017] As an implementation method, the file writing step further includes an address determination step: When writing data to FLASH, it is determined whether the FLASH address to be written is the firmware area. If so, an error is directly returned without writing. The underlying FLASH writing interface of the file system determines the FLASH address to be operated. If the address to be operated is the firmware area, an error is directly returned without calling the FLASH write operation.
[0018] The file system for abnormal protection of the FLASH package of the GNSS chip in the embodiment of the present invention includes File system and Firmware (ie, the program firmware area of the FLASH).
[0019] When writing a file, the file system reads the FLASH interface to determine whether there is a file to be written in the FLASH. If not, the file system adds a corresponding CRC32 field to the file header information of the file to be written, and then writes the file to be written into the FLASH. If so, the file existing in the FLASH is read, and the file header information of the read file is checked by CRC32 except for the CRC32 field. If the check passes, the file data is written as needed to update the file header information of the read file, and the corresponding CRC32 field in the file header information of the read file is updated according to the check value of the CRC32 check. Finally, the updated file header information and the file data to be written are written into the FLASH. If the check fails, an error is directly returned. When writing a file, the file system determines whether the FLASH address to be written is the firmware area. If so, an error is directly returned without writing.
[0020] When reading a file, the file system reads the FLASH interface and reads it several times. If the results of the several times are the same, the data of the target file is returned to the file system.
[0021] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A GNSS chip package FLASH abnormality protection method, characterized in that: include: File writing step: read whether there is a file to be written in FLASH, wherein the file to be written includes the file data to be written and the file header information. If not, add a corresponding CRC32 field to the file header information of the file to be written, and then write the file to be written into FLASH; if so, read the file existing in FLASH, perform CRC32 check on the file header information of the read file except the CRC32 field, if the check passes, write the file data as needed to update the file header information of the read file, and update the corresponding CRC32 field in the file header information of the read file according to the check value of the CRC32 check, and finally write the updated file header information and the file data to be written into FLASH; if the check fails, directly return an error; File reading step: read the target file in FLASH, wherein the reading is performed several times, and if the results of the several times are the same, the data of the target file is returned.
2. The GNSS chip package FLASH abnormality protection method according to claim 1, characterized in that: The file writing step also includes the address determination step: When writing data to FLASH, it is determined whether the FLASH address to be written is the firmware area. If so, an error is directly returned without further writing.
3. A file system with GNSS chip encapsulated FLASH abnormal protection, characterized in that: When writing a file, the system reads the interface of FLASH to determine whether there is a file to be written in FLASH, wherein the file to be written includes the file data to be written and the file header information. If not, the system adds a corresponding CRC32 field to the file header information of the file to be written, and then writes the file to be written in FLASH; then the file existing in FLASH is read, and a CRC32 check is performed on the file header information of the read file except for the CRC32 field. If the check passes, the file data is written as needed to update the file header information of the read file, and the corresponding CRC32 field in the file header information of the read file is updated according to the check value of the CRC32 check, and finally the updated file header information and the file data to be written are written into FLASH; if the check fails, an error is directly returned; When reading a file, the system reads the interface of the FLASH, and reads it several times. If the results of the several times are the same, the data of the target file is returned.
4. The GNSS chip sealed FLASH abnormal protection file system as claimed in claim 3, characterized in that: When writing a file, the system determines whether the FLASH address to be written is a firmware area. If so, an error is directly returned without further writing.
Citation Information
Patent Citations
Method and device for storing file backups and backup method for file systems
CN102411523A
A self-checking method and system for files
CN106126367A
Access protection method and device applied to PNOR flash
CN117150583A
File safety detection method
CN1770051A
Self-verification method and system for file
WO2018001140A1
