SLAAES9 March   2025 MSP430FR5043 , MSP430FR6005 , MSP430FR6007 , MSP430FR6043 , MSP430FR6045 , MSP430FR6047

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Flow Meter Measurement Theory
    1. 2.1 TOF Measurement Algorithm Implementation
      1. 2.1.1 AbsTOF Calculation Method – Lobe
      2. 2.1.2 AbsTOF Calculation Method – Hilbert Wide
      3. 2.1.3 dTOF Calculation Method - Cross-Correlation
        1. 2.1.3.1 Get a High-Precision dTOF Result
        2. 2.1.3.2 Optimization in Cross-Correlation Method
    2. 2.2 Differences between ADC Approach and TDC Approach
  6. 3MSP430 MCUs for USS Application
    1. 3.1 USS Module
    2. 3.2 Differences Between USS and USS_A Module
    3. 3.3 Software Implementation on MSP430 MCUs
  7. 4Hardware Design Flow
    1. 4.1 Schematics
      1. 4.1.1 Water Meter Schematic – MSP430FR6047 and MSP430FR6007
      2. 4.1.2 Water Meter Schematic – MSP430FR6043 and MSP430FR5043
      3. 4.1.3 Gas Meter Schematic – MSP430FR6043 and MSP430FR5043
    2. 4.2 PCB Layout Guide
  8. 5Software Design Guide
    1. 5.1 USS Demo Projects and Related Resources
    2. 5.2 Demo Project Instruction
      1. 5.2.1 Files in Demo Project
      2. 5.2.2 Properties Setting in Demo Project
  9. 6Summary
  10. 7References

dTOF Calculation Method - Cross-Correlation

Cross-correlation is a widely used technique in signal processing to measure the similarity and time-delay relationship between two signals. The core idea is to slide one signal (called the reference signal) against another signal (called the input signal) and compute the dot product to find the best match at different delays.

For discrete signals x[n] and y[n], the cross-correlation function Rxy[k] can be expressed as:

Equation 7. R x y k   =   n = - + x n y n + k

where, k is the time delay of signal y relative to signal x. The output result Rxy[k] provides information about the degree of similarity between the two signals at the delay k.

The output cross-correlation sequence Rxy[k] reveals the correlation at different delays, and usually, the delay value k that maximizes the cross-correlation is sought as the time delay between the two signals. So, the goal is to find the delay k value, which gets the largest Rxy[k] value. In the dTOF calculation, use the UPS and DNS receive signal as the two inputs of the cross-correlation algorithm. In this case, the delay k represents the time difference between the two receive signals which can be considered as the dTOF value. Figure 2-4 shows an example that demonstrates how to calculate the cross-correlation from two discrete signals (k = 0).

 Cross-Correlation
                    Calculation Figure 2-4 Cross-Correlation Calculation

Figure 2-5 shows an example demonstrates how to calculate the cross-correlation from two discrete signals with one cycle slide left on the blue signal (k = -1).

 Cross-Correlation Calculation
                    with One Cycle Slide Left on Blue Signal Figure 2-5 Cross-Correlation Calculation with One Cycle Slide Left on Blue Signal

Figure 2-6 shows an example demonstrates how to calculate the cross-correlation from two discrete signals with five cycle slide left on the blue signal (k = -5). Under this k = -5 value, since the two signals are overlapped, the maximum cross-correlation result is achieved.

 Cross-Correlation Calculation
                    with Five Cycle Slide Left on Blue Signal Figure 2-6 Cross-Correlation Calculation with Five Cycle Slide Left on Blue Signal