This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR50431: USS library - ToF calculation using correlation

Part Number: MSP430FR50431
Other Parts Discussed in Thread: TIDM-02003

Hello,

during our work on a water flowmeter using MSP430FR50431 we've been trying to improve the overall performance, during which we have discovered that modifying the USS_ALG_CORR_VAL_THRSH_CHK_FACT parameter can fix some of our performance problems, however we're stuck how exactly this parameter and correlation-based technique in general works.

I did some searching and found Design Guide TIDM-02003, in which the mathematics behind correlation calculation are described, but some further commentary would be very helpful. I will be referring to equations mentioned on page 7 and for this example let's use proposed situation, therefore 4MHz sampling frequency, 40us capture duration and k = (-1; 0; 1).

First of all, 6) is understandable, there are 160 samples in UPS and 160 samples in DNS buffer.

7) Do i understand it correctly that output of this equation are 3 resulting sums, if we follow the example that k = (-1; 0; 1)?

8) Is maximum of correlation understood as a maximum of these 3 results from equation 7, or is it a maximum of some intermediate calculation? Is result of this functions simply -1, 0 or 1?

9) Does interpolation in this case result in a value between -1 and 1 as a position of highest value (X-axis) or is it the highest value of the interpolation function itself (Y-axis)?

10) Following the assumption that k^ = (-1;1), m = 1 and d = (-1;1), the result should probably fall in the (-1;1) interval as well. What does this value represent exactly, is it a fraction? If so, of what? Using assumptions above I calculated  a result k = 0 and d = -0,0018 from some of our sample data.

One additional question: Where is the USS_ALG_CORR_VAL_THRSH_CHK_FACT parameter applied? Is it related to equations mentioned above?

Thank you for your help.

Best regards

Antonin Stepan

  • Hi Antonin,

    7) You are correct, the correlation is calculated for each k value. So if k is the set (-1, 0, 1) then yes there are 3 correlation values.

    8) The maximum of correlation is the maximum of the 3 results from equation 7. You are correct that the result of this is simply -1, 0, or 1. The value found here is k^

    9) This part uses interpolation to basically reconstruct the received signal, then it finds the maximum of this reconstructed signal. Then the d value is the x axis location of the interpolation's max value.

    10) The value given by equation 10 is the difference between the x axis location of the correlation maximum and the interpolation maximum. Yes I believe this can be a fraction. This difference is difference in time of flight.

    That parameter is applied to ussAlgConfig. It may be helpful to take a look at the USS Lib API Guide to learn more about this value. This value appears to change the correlation value that the device interprets as valid. So if the algorithm performs these computations and arrives at a value below USS_ALG_CORR_VAL_THRSH_CHK_FACT, then it will be interpreted as invalid and not used in measurements.

    I will add: a lot of the algorithm's functionality is hidden and is intended to be hidden. You can only dive so deep until you reach a point where the behavior of the algorithm is confidential.

  • Hello Dylan,

    thanks for the answer, I can at least somewhat picture how the algorithm works.

    However, anything related to the USS_ALG_CORR_VAL_THRSH_CHK_FACT parameter simply doesn't exist in the documentation. I'm asking about this parameter, because it previously helped us make some of our products work.

    To put it into context, we have already produced several hundreds of our products with MCU mentioned above and USS library, but we had to hand-tune probably 25% of them. To be more specific, we started randomly changing various parameters, until we modified USS_ALG_CORR_VAL_THRSH_CHK_FACT parameter by several order of magnitude, then our products finally started working. This is, however, not a final solution, because it doesn't work universally on all of our units and also because we have no idea, why it even worked in the first place.

     

    If the algorithm is considered confidental, then I'll mark this topic as solved.

    Have a nice day,

    Antonin

**Attention** This is a public forum