A method for vehicle mileage statistics based on pulse counting

By using the method of pulse counting and check value in vehicle mileage statistics, the problems of data loss and increased hardware complexity in the existing technology are solved, high-precision and real-time mileage statistics are achieved, and the impact of the system on real-time performance is reduced. .

CN114116296BActive Publication Date: 2024-10-15WUHAN SOUTH SAGITTARIUS INTEGRATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111441608.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2024-10-15
Estimated Expiration
2041-11-30

AI Technical Summary

Technical Problem

In the existing technology, the vehicle mileage statistics method results in data loss, increased hardware complexity and cost due to frequent NVM memory erasure, and may lead to increased mileage errors and reduced real-time performance at high vehicle speeds.

Method used

By acquiring the output signal of the vehicle pulse sensor, the hardware comparator circuit is used to convert it into a digital signal that can be recognized by the MCU, and the input capture function of the MCU is used to obtain the rising edge event of the pulse signal, and the pulse count accumulation and check value calculation are performed, and stored in Backup domain registers avoid additional memory usage and data loss.

Benefits of technology

It achieves real-time updates and high-precision vehicle mileage statistics, avoids mileage loss caused by abnormal device restarts, reduces the impact of the system on real-time performance, and reduces hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114116296B_ABST
    Figure CN114116296B_ABST
Patent Text Reader

Abstract

A method for counting vehicle mileage based on pulse counting, comprising: obtaining the output signal of a vehicle pulse sensor, and converting the vehicle pulse sensor signal into a digital signal recognizable by an MCU through a hardware comparator circuit; using the input capture function of the MCU to obtain the rising edge event of the vehicle pulse signal, the MCU first reads the pulse count value of the backup domain register, and then adds 1 to the pulse count value of the backup domain register; calculating the check value of the pulse count value, and writing the pulse count value and the check value back to the mileage backup domain register. The vehicle mileage count of the present invention can be updated and saved in real time without adding additional memory, and the mileage count will not be lost when the device restarts abnormally. The vehicle mileage count is highly accurate and reliable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a field, and in particular to a method and system for vehicle mileage statistics based on pulse counting. Background Art

[0002] The national standard "GB / T19056-2012" requires that vehicle driving recorder products must be able to record and store vehicle mileage, and the recording error within a certain mileage range must be less than 0.1KM. Considering factors such as cost, the general practice is to allocate a RAM area inside the MCU for real-time recording of mileage accumulation changes. When the fixed distance (0.1KM) or timing (1S) conditions are met, the changing mileage value is accumulated to the total mileage and saved in the MCU's internal flash or external EEPROM and other NVM (Non-Volatile Memory, non-volatile memory). Whether using internal flash or external EEPROM memory, frequent erasure will have a great impact on the life of the memory, and even reach the limit value and cause damage. Most flash has a lifespan of less than 100,000 times; the number of EEPROM writes is only 1 million times, and the mileage of the entire life cycle of the car must meet more than 999999.9KM. To achieve high-precision mileage recording, it is bound to bring the following problems:

[0003] 1. Due to the limitation of the number of erase and write times of NVM memory, the usual practice is to allocate a piece of memory in the MCU's on-chip RAM (data content is lost when power is off or restarted) to cache vehicle mileage. The mileage is accumulated once after each speed pulse occurs, and then written to the NVM memory once. This mileage storage method has a disadvantage. Most MCU operations are affected by software quality and external factors, and will inevitably encounter abnormal operation or watchdog timeout leading to restart. Once the MCU restart occurs before the trigger to write the mileage to NVM or when writing, the mileage data cached in the MCU's internal RAM will no longer exist, which causes the accumulated mileage that was not written to the NVM memory in time to be lost, resulting in an increase in mileage statistical errors.

[0004] 2. Adding an external dedicated high-speed memory specifically for storing mileage will increase the complexity of the hardware circuit and directly generate additional hardware costs.

[0005] 3. In particular, for flash type NVM memory, before writing mileage data to the flash, the flash storage mileage address must first be erased (usually erased by page), and then the new mileage is written. If a power outage occurs right after the flash is erased, this will cause permanent loss of mileage.

[0006] 4. In particular, for flash type NVM memories, the erase and write times are shorter, and the design needs to consider the additional storage overhead and software development overhead caused by the wear leveling processing of the flash memory.

[0007] 5. In particular, for flash type NVM memory, the higher the vehicle speed, the higher the frequency of the speed pulse. Most MCUs need to turn off the MCU's global interrupt before operating the flash, and then turn on the MCU's global interrupt after the operation is completed. The time to erase the flash plus the time to write the flash is between 5ms and 10ms. Since the global interrupt is turned off when operating the flash, if a pulse edge signal arrives at this time, for the pulse counting based on the capture interrupt function, no input capture interrupt will be generated, which will also cause the problem of increased mileage error. 6. Since the global interrupt is turned off when operating the flash, the real-time performance of the MCU is reduced. Summary of the invention

[0008] In view of the above problems, the present invention is proposed to provide a vehicle mileage statistics method based on pulse counting that overcomes the above problems or at least partially solves the above problems.

[0009] In order to solve the above technical problems, the embodiments of the present application disclose the following technical solutions:

[0010] A method for counting vehicle mileage based on pulse counting, comprising:

[0011] S100. Obtain the output signal of the vehicle pulse sensor and convert the vehicle pulse sensor signal into a digital signal recognizable by the MCU through a hardware comparator circuit;

[0012] S200. The input capture function of the MCU is used to obtain the rising edge event of the vehicle pulse signal. The MCU first reads the pulse count value of the backup domain register, and then adds 1 to the pulse count value of the backup domain register.

[0013] S300. Calculate the check value of the pulse count value, and write the pulse count value and the check value back to the mileage backup domain register.

[0014] Further, in S100, the vehicle pulse sensor output signal is a square wave signal with a peak value of +5V to +12V and a trough value of 0V.

[0015] Furthermore, in S100, the digital signal recognizable by the MCU is a digital square wave signal with a peak value of 3.3V and a valley value of 0.

[0016] Furthermore, the MCU adopts a MIMXRT1051CVBL microcontroller.

[0017] Furthermore, in S200, the input capture function of the MCU is used to obtain the rising edge of the vehicle pulse signal, and the specific method is as follows:

[0018] S201. Set the MCU IO port GPIO_B0_04 to the rising edge event capture function;

[0019] S202 sets the rising edge interrupt enable of MCU IO port GPIO_B0_04;

[0020] S203: When the GPIO_B0_04 port experiences a voltage jump from 0 to 3.3V, execute step S304;

[0021] S204 starts to read the pulse count value of the SNVS_GPR register inside the MCU.

[0022] Furthermore, the method for reading the pulse count value of the SNVS_GPR register inside the MCU in S304 is:

[0023] S2041. Select the first 24 consecutive bytes of the general register of the SNVS module of the MCU as the data storage area, divide the 24 bytes of data into 2 groups of 12 bytes each, and name them as data storage areas A1 and A2, A2 is the redundant backup area of ​​A1, and divide each group of data storage areas into a data area and a check code area; the data area occupies the first 8 bytes for storing the mileage pulse count value, and the check code area occupies the last 4 bytes for checking the first 8 bytes using CRC32;

[0024] When the S2042 system is initialized, the contents of the data storage area A1 are read to obtain the pulse count value V1 and the check code C1.

[0025] S2043. Perform CRC32 calculation on the pulse count value V1 to obtain the check value CC1. When C1 is equal to CC1, the current V1 is taken as the valid pulse count value and recorded as n.

[0026] Further, in S2043, when C1 is not equal to CC1, steps S2044-S2045 are executed:

[0027] S2044 continues to read the data storage area A2, obtain the pulse count value V2 and the check code C2;

[0028] S2045. Perform CRC32 calculation on value V2 to obtain check value CC2. When C2 is not equal to CC2, V2 is taken as the current valid pulse count value and recorded as n.

[0029] Further, in S2045, when C2 is not equal to CC2, step S2046 is executed:

[0030] S2046. Clear the V1 value of data A1 in the data storage area and the V2 value of data A2 to 0 respectively, calculate their check values ​​to obtain CA1 and CA2 respectively, write them into the corresponding check code area, and take the current valid pulse count value as n=0.

[0031] Furthermore, the relationship between the total mileage S of the vehicle, the pulse coefficient K and the total number of pulses N emitted by the sensor is:

[0032] S=N / K

[0033] Among them, S is the total mileage of the vehicle in km, the pulse coefficient K is defined as the number of pulses generated by the vehicle traveling one kilometer, and N is the total number of pulses emitted by the sensor.

[0034] Furthermore, the backup domain register of the MCU is powered by a dedicated battery. When the external power supply of the MCU is normal, the backup domain register of the MCU does not consume power of the dedicated battery; when the external power supply of the MCU is powered off, the content of the backup domain register of the MCU is maintained unchanged.

[0035] The beneficial effects of the above technical solution provided by the embodiment of the present invention include at least:

[0036] The present embodiment discloses a method for counting vehicle mileage based on pulse counting, including: obtaining the output signal of the vehicle pulse sensor, and converting the vehicle pulse sensor signal into a digital signal recognizable by the MCU through a hardware comparator circuit; using the input capture function of the MCU to obtain the rising edge of the vehicle pulse signal, and counting and accumulating the rising edge of the pulse signal; storing the rising edge count of the pulse signal in a general register in the MCU, obtaining the current mileage count of the backup domain register according to the pulse coefficient, and increasing the mileage count by 1; calculating the check value of the pulse count value, and writing the pulse count value and the check value back to the mileage backup domain register. The vehicle mileage count of the present invention can be updated and saved in real time. No additional memory is required. The mileage count will not be lost when the device is restarted abnormally. The vehicle mileage count is highly accurate and reliable. The vehicle mileage count has a fast reading and writing speed and low overhead, and has little impact on the real-time performance of the system.

[0037] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0039] Figure 1This is a flow chart of a method for vehicle mileage statistics based on pulse counting in Example 1 of the present invention. DETAILED DESCRIPTION

[0040] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0041] In order to solve the problems existing in the prior art, an embodiment of the present invention provides a vehicle mileage statistics method based on pulse counting.

[0042] Example 1

[0043] This embodiment discloses a method for calculating vehicle mileage based on pulse counting, such as Figure 1 ,include:

[0044] S100. Obtain the output signal of the vehicle pulse sensor and convert the vehicle pulse sensor signal into a digital signal recognizable by the MCU through a hardware comparator circuit;

[0045] Specifically, the vehicle pulse sensor output signal is a square wave signal with a peak value of +5V to +12V and a valley value of 0V. The digital signal recognizable by the MCU is a digital square wave signal with a peak value of 3.3V and a valley value of 0.

[0046] S200. The input capture function of the MCU is used to obtain the rising edge event of the vehicle pulse signal. The MCU first reads the pulse count value of the backup domain register, and then adds 1 to the pulse count value of the backup domain register.

[0047] Specifically, the MCU of this embodiment adopts a MIMXRT1051CVBL microcontroller. In S200 of this embodiment, the input capture function of the MCU is used to obtain the rising edge of the vehicle pulse signal. The specific method is:

[0048] S201. Set the MCU IO port GPIO_B0_04 to the rising edge event capture function;

[0049] S202 sets the rising edge interrupt enable of MCU IO port GPIO_B0_04;

[0050] S203: When the GPIO_B0_04 port experiences a voltage jump from 0 to 3.3V, execute step S304;

[0051] S204 starts to read the pulse count value of the SNVS_GPR register inside the MCU.

[0052] Specifically, the method for reading the pulse count value of the SNVS_GPR register inside the MCU in S204 is:

[0053] S2041. Select the first 24 consecutive bytes of the general register of the SNVS module of the MCU as the data storage area, divide the 24 bytes of data into 2 groups of 12 bytes each, and name them as data storage areas A1 and A2, A2 is the redundant backup area of ​​A1, and divide each group of data storage areas into a data area and a check code area; the data area occupies the first 8 bytes for storing the mileage pulse count value, and the check code area occupies the last 4 bytes for checking the first 8 bytes using CRC32;

[0054] Specifically, the data area occupies the first 8 bytes to store the mileage pulse count value, and the maximum number of pulses that can be recorded is Nmax = 2 64 -1, select pulse coefficient K = 3600, the relationship between the total mileage S of the vehicle, pulse coefficient K and the total number of pulses N emitted by the sensor is: S = N / K; the recordable mileage accuracy can reach 1Km / K = 1000 / 3600 = 0.27m, and the total effective recordable mileage (Nmax / K = (264-1) / 3600Km) > 10000000Km, which can obviously meet the mileage record of the entire life cycle of the car.

[0055] When the S2042 system is initialized, the contents of the data storage area A1 are read to obtain the pulse count value V1 and the check code C1.

[0056] S2043. Perform CRC32 calculation on the pulse count value V1 to obtain the check value CC1. When C1 is equal to CC1, the current V1 is taken as the valid pulse count value and recorded as n.

[0057] In S2043 of some preferred embodiments, when C1 is not equal to CC1, steps S2044-S2045 are executed:

[0058] S2044 continues to read the data storage area A2, obtain the pulse count value V2 and the check code C2;

[0059] S2045. Perform CRC32 calculation on value V2 to obtain check value CC2. When C2 is not equal to CC2, V2 is taken as the current valid pulse count value and recorded as n.

[0060] In S2045 of some preferred embodiments, when C2 is not equal to CC2, step S2046 is executed:

[0061] S2046. Clear the V1 value of data A1 in the data storage area and the V2 value of data A2 to 0 respectively, calculate their check values ​​to obtain CA1 and CA2 respectively, write them into the corresponding check code area, and take the current valid pulse count value as n=0.

[0062] S300. Calculate the check value of the pulse count value, and write the pulse count value and the check value back to the mileage backup domain register.

[0063] The present embodiment provides a method for counting vehicle mileage based on pulse counting, including: obtaining the output signal of the vehicle pulse sensor, and converting the vehicle pulse sensor signal into a digital signal recognizable by the MCU through a hardware comparator circuit; using the input capture function of the MCU to obtain the rising edge of the vehicle pulse signal, and counting and accumulating the rising edge of the pulse signal; storing the rising edge count of the pulse signal in a general register in the MCU, obtaining the current mileage count of the backup domain register according to the pulse coefficient, and increasing the mileage count by 1; calculating the check value of the pulse count value, and writing the pulse count value and the check value back to the mileage backup domain register. The vehicle mileage count of the present invention can be updated and saved in real time without adding additional memory, and the mileage count will not be lost when the device restarts abnormally. The vehicle mileage count is highly accurate and reliable.

[0064] It should be understood that the specific order or hierarchy of steps in the disclosed process is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of protection of the present disclosure. The attached method claims present the elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.

[0065] In the above detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that the embodiments of the claimed subject matter require more features than are clearly stated in each claim. On the contrary, as reflected in the appended claims, the invention is in a state of having less than all the features of the disclosed individual embodiments. Therefore, the appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.

[0066] Those skilled in the art will also appreciate that the various illustrative logic blocks, modules, circuits, and algorithmic steps described in conjunction with the embodiments herein can all be implemented as electronic hardware, computer software, or a combination thereof. In order to clearly illustrate the interchangeability between hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above around their functions. Whether such functions are implemented as hardware or software depends on specific applications and the design constraints imposed on the entire system. A skilled person can implement the described functions in an alternative manner for each specific application, but such implementation decisions should not be interpreted as departing from the scope of protection of the present disclosure.

[0067] The steps of the method or algorithm described in conjunction with the embodiments herein may be directly embodied as hardware, a software module executed by a processor, or a combination thereof. The software module may be located in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a mobile disk, a CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is connected to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium may also be an integral part of the processor. The processor and the storage medium may be located in an ASIC. The ASIC may be located in a user terminal. Of course, the processor and the storage medium may also be present in a user terminal as discrete components.

[0068] For software implementation, the techniques described in this application can be implemented with modules (e.g., procedures, functions, etc.) that perform the functions described in this application. These software codes can be stored in a memory unit and executed by a processor. The memory unit can be implemented within the processor or outside the processor. In the latter case, it is coupled to the processor in a communication manner via various means, which are well known in the art.

[0069] The above description includes examples of one or more embodiments. Of course, it is impossible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but it should be recognized by those skilled in the art that the various embodiments may be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications and variations that fall within the scope of protection of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, the word is covered in a manner similar to the term "including", just as "including," is explained as a transitional word in the claims. In addition, any term "or" used in the specification of the claims is intended to mean "non-exclusive or".

Claims

1. A method for vehicle mileage statistics based on pulse counting, It is characterized in that include: S100. Obtain the output signal of the vehicle pulse sensor and convert the vehicle pulse sensor signal into a digital signal recognizable by the MCU through a hardware comparator circuit; S200. The input capture function of the MCU is used to obtain the rising edge event of the vehicle pulse signal. The MCU first reads the pulse count value of the backup domain register, and then adds 1 to the pulse count value of the backup domain register. S300. Calculate the check value of the pulse count value, and write the pulse count value and the check value back to the mileage backup domain register; In S200, the input capture function of the MCU is used to obtain the rising edge of the vehicle pulse signal. The specific method is as follows: S201. Set the MCU IO port GPIO_B0_04 to the rising edge event capture function; S202 sets the rising edge interrupt enable of MCU IO port GPIO_B0_04; S203: When the GPIO_B0_04 port experiences a voltage jump from 0 to 3.3V, execute step S204; S204 starts to read the pulse count value of the SNVS_GPR register inside the MCU; the method for reading the pulse count value of the SNVS_GPR register inside the MCU in S204 is: S2041. Select the first 24 consecutive bytes of the general register of the SNVS module of the MCU as the data storage area, divide the 24 bytes of data into 2 groups of 12 bytes each, and name them as data storage areas A1 and A2, A2 is the redundant backup area of ​​A1, and divide each group of data storage areas into a data area and a check code area; the data area occupies the first 8 bytes for storing the mileage pulse count value, and the check code area occupies the last 4 bytes for checking the first 8 bytes using CRC32; S2042 When the system is initialized, the content of the data storage area A1 is read to obtain the pulse count value V1 and the check code C1; S2043. Perform CRC32 calculation on the pulse count value V1 to obtain the check value CC1. When C1 is equal to CC1, the current V1 is taken as the valid pulse count value and recorded as n.

2. A vehicle mileage statistics method based on pulse counting as claimed in claim 1, It is characterized in that In S100, the vehicle pulse sensor output signal is a square wave signal with a peak value of +5V to +12V and a trough value of 0V.

3. A vehicle mileage statistics method based on pulse counting as claimed in claim 1, It is characterized in that In S100, the digital signal that the MCU can recognize is a digital square wave signal with a peak value of 3.3V and a valley value of 0.

4. A vehicle mileage statistics method based on pulse counting as claimed in claim 1, It is characterized in that The MCU uses the MIMXRT1051CVBL microcontroller.

5. A vehicle mileage statistics method based on pulse counting as claimed in claim 1, It is characterized in that In S2043, when C1 is not equal to CC1, steps S2044-S2045 are executed: S2044 continues to read the data storage area A2, obtain the pulse count value V2 and the check code C2; S2045. Perform CRC32 calculation on value V2 to obtain check value CC2. When C2 is not equal to CC2, V2 is taken as the current valid pulse count value and recorded as n.

6. A vehicle mileage statistics method based on pulse counting as claimed in claim 5, It is characterized in that In S2045, when C2 is not equal to CC2, step S2046 is executed: S2046. Clear the V1 value of data A1 in the data storage area and the V2 value of data A2 to 0 respectively, calculate their check values ​​to obtain CA1 and CA2 respectively, write them into the corresponding check code area, and take the current valid pulse count value as n=0.

7. A vehicle mileage statistics method based on pulse counting as claimed in claim 1, It is characterized in that The relationship between the vehicle's total mileage S, the pulse coefficient K, and the total number of pulses N emitted by the sensor is: S=N / K Among them, S is the total mileage of the vehicle in km, the pulse coefficient K is defined as the number of pulses generated by the vehicle traveling one kilometer, and N is the total number of pulses emitted by the sensor.

8. A vehicle mileage statistics method based on pulse counting as claimed in claim 1, It is characterized in that The backup domain register of the MCU is powered by a dedicated battery. When the external power supply of the MCU is normal, the backup domain register of the MCU does not consume the power of the dedicated battery. When the external power supply of the MCU is turned off, the contents of the backup domain registers used to maintain the MCU do not change.