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.

MSP430FR6047: MCU018

Part Number: MSP430FR6047
Other Parts Discussed in Thread: EVM430-FR6047

Tool/software:

Hi,

On EVM-MSP430FR6047 when I set Signal sampling frequency = 4 MHz,

                                                            Over sampling rate = 20

then it works fine and also communicates using USS design center tool. Fine enough.

But when I set 

Signal sampling frequency = 8 MHz,

Over sampling rate = 10.

It stops communicating using USS design center tool. You click on ADC capture but no communication, also no waveform capture is happening.

Also you cannot update the configuration values. Why?

Even after power off board will not communicate. Then again flash the firmware and it starts working.

Thanks,

Anup Kumar.

  • Hi Kumar,

    Let me check internally with expert and feedback to you. Thanks.

    B.R.

    Sal

  • Hi,

    I can set to 8MHz signal sampling frequency with OSR 10 on my EVM430-FR6047 board without issue. Are there any modifications on both the hardware or software side? And you are programmed with default MSP430FR6047EVM_USS_Water_Demo project right?

    Best regards,

    Cash Hao

  • I also don't have any issues while setting sampling frequency to 8MHz & OSR 10. Issues starts after setting this.

    There are no modifications on hardware and software. 

    Yes it is programmed with default Demo project.

    One thing I want to make clear that this issue occurs only when no ultrasonic sensor is connected to board.  

    When ultrasonic sensor is connected to board you do whatever configurations change it will work fine. But when you remove the ultrasonic sensor and if you have configured sampling frequency 8MHz & OSR 10 then issue arises. 

    Issues are:-

    1) ADC capture stops working.

    2) Signal capture stops working.

    3) You cannot update the configuration parameters.

    You need to flash the firmware again.

    Thanks.

    Anup Kumar

  • Hi Hao,

    I guess I have found the root cause here. when sampling frequency is 8MHz OSR =10, then 

    1.) object->deltaTOF.estimate.numSamplesPerCycle = (int16_t)(params->numSamplesPerCycle * 4096.0f);

    In this step number samples = 8 * 4096 = 32768 , but you have type casted this to int16_t so it will be -32768

    So when the sensor is connected it works fine because of highlighted part. but when no sensor is connected it will reset.

    if(object->absTOF_DNS_results->signalDetected)
    {
    if(object->windowingMode == USS_windowing_mode_dynamic) {
    winStartIndex = 0;
    }
    else {
    // Calculate window start index
    if(object->windowingMode == USS_windowing_mode_estimate) {
    absTOFFromStartCapture = (int16_t)(((object->absTOF_DNS_results->iq40TotalTOF - object->iq40ADCStartCaptureInstant - object->iq40ADCAdditionalCaptureDelay) << 4) / object->iq44ADCSamplePeriod); //(54us-49us-0)/0.25us=20
    winStartIndex = (((int32_t)absTOFFromStartCapture << 12) - ((int32_t)(object->numSamplesPerCycle) * (int32_t)(object->winStartIndexBackOffNumCycles))) >> 12; //20-4*2=12
    }
    else if(object->windowingMode == USS_windowing_mode_static) {
    // USS_Alg_dToF_Window_Type_static
    winStartIndex = ((int32_t)(object->numSamplesPerCycle) * (int32_t)(object->winStartIndexBackOffNumCycles)) >> 12;
    }
    else
    {
    winStartIndex = 0;
    }
    if (winStartIndex < 0) {
    winStartIndex = 0;
    }
    }

    // Calculate window ramp length
    winRampLength = _Q12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles); //4*4
    if (winRampLength < 0) {
    winRampLength = 0;
    }

    // Calculate window length and make an even integer
    winLength = winRampLength + _Q12rmpy(object->numSamplesPerCycle, object->winNumCycles) + winRampLength; //16+4*28+16=144
    // Ensure it does not exceed the total arrayLength taking "winStartIndex" into account
    if (winLength > (object->arrayLength - winStartIndex)) {
    winLength = object->arrayLength - winStartIndex;
    }
    winLength = winLength & ~1;
    }
    else {
    // Set default window parameters
    winStartIndex = 0;
    winRampLength = _Q12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles);
    winLength = object->arrayLength;
    }

    I think now it will be more clear to you. please resolve this.

    Thanks,

    Anup Kumar. 

  • Hi Hao,

    I think the catch is here,

    Instead of :-   winRampLength = _Q12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles);

    It should be :- winRampLength = _IQ12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles);

    Thanks,

    Anup Kumar.

  • Emm, interesting point. 

    Thanks for pointing that out.

  • Hi Hao,

    I am waiting for solution from your side. I have to further proceed with my development.

    Please suggest the solution as soon as possible.

    Thanks,

    Anup Kumar.

  • Hi,

    Oh, so changing to _IQ12rmpy does not solve the issue?

    Best regards,

    Cash Hao

  • Hi Hao,

    This issue is solved by making following changes: -

    1) object->deltaTOF.estimate.numSamplesPerCycle = (int16_t) (params->numSamplesPerCycle * 4096.0f);  chnging int16_t to int32_t.

    2.) Instead of:-   winRampLength = _Q12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles);

        It should be:-  winRampLength = _IQ12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles);

    But i want to ask will you provide the updated USS library version on TI web site along with errata sheet?

    Also, who will confirm that the changes I have made has no other impact at all.

    Thanks,

    Anup Kumar

  • Hi,

    Well, there will not be an update on the USS library. 

    And I also tried to change the sampling rate to 8MHz without connecting transducers. I still do not observe any issue from my side. I can still receive message from MCU.

    Best regards,

    Cash Hao

  • Hi Hao,

    As per the USS library & also as I have shown in my previous reply, it will only work if 

    1) object->deltaTOF.estimate.numSamplesPerCycle = (int16_t) (params->numSamplesPerCycle * 4096.0f);  chnging int16_t to int32_t.

    2.) Instead of:-   winRampLength = _Q12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles);

        It should be:-  winRampLength = _IQ12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles);

    or under the red highlighted part you include if statement highlighted in yellow part.

    if(object->absTOF_DNS_results->signalDetected)
    {
    if(object->windowingMode == USS_windowing_mode_dynamic) {
    winStartIndex = 0;
    }
    else {
    // Calculate window start index
    if(object->windowingMode == USS_windowing_mode_estimate) {
    absTOFFromStartCapture = (int16_t)(((object->absTOF_DNS_results->iq40TotalTOF - object->iq40ADCStartCaptureInstant - object->iq40ADCAdditionalCaptureDelay) << 4) / object->iq44ADCSamplePeriod); //(54us-49us-0)/0.25us=20
    winStartIndex = (((int32_t)absTOFFromStartCapture << 12) - ((int32_t)(object->numSamplesPerCycle) * (int32_t)(object->winStartIndexBackOffNumCycles))) >> 12; //20-4*2=12
    }
    else if(object->windowingMode == USS_windowing_mode_static) {
    // USS_Alg_dToF_Window_Type_static
    winStartIndex = ((int32_t)(object->numSamplesPerCycle) * (int32_t)(object->winStartIndexBackOffNumCycles)) >> 12;
    }
    else
    {
    winStartIndex = 0;
    }
    if (winStartIndex < 0) {
    winStartIndex = 0;
    }
    }

    // Calculate window ramp length
    winRampLength = _Q12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles); //4*4
    if (winRampLength < 0) {
    winRampLength = 0;
    }

    // Calculate window length and make an even integer
    winLength = winRampLength + _Q12rmpy(object->numSamplesPerCycle, object->winNumCycles) + winRampLength; //16+4*28+16=144
    // Ensure it does not exceed the total arrayLength taking "winStartIndex" into account
    if (winLength > (object->arrayLength - winStartIndex)) {
    winLength = object->arrayLength - winStartIndex;
    }
    winLength = winLength & ~1;
    }
    else {
    // Set default window parameters
    winStartIndex = 0;
    winRampLength = _Q12rmpy(object->numSamplesPerCycle, object->winTrapzRampOverNumCycles);
    winLength = object->arrayLength;
    }

    May be in your library code you have changed in that part otherwise it will not work that I am pretty sure.

    Thanks

    Anup Kumar.

  • Hi,

    I just realize that this is part of the library source code. I do not suggest you to share the code online. And as a part of agreement, TI will not support on the source code. 

    Best regards,

    Cash Hao

  • Hi Hao,

    First of all, I apologize for the this I will take care of this from now onwards to not to share code online. My last question is: -

    What I have reported regarding the 8MHz sampling frequency, is that an issue in code or not?

    Thanks 

    Anu Kumar.

  • Hi,

    I still do not think that is an issue in the code. Because I could not reproduce your issue on my side with the default project. 

    Best regards,

    Cash Hao

  • Hi Hao,

    What if in the code if you have typecasted a variable to int16 type & value of that variable is greater than int16 type. Also, this is not an issue.?

    And when you use a function whose input variables are int16 type and when you supply int32 type variable to that, is that not an issue?

    Thanks,

    Anup Kumar.

  • Hi,

    You statement will cause issue. But I do not see the risk in code. numSamplesPerCycle is usually 4 and 4*4096 = 16384 which is inside int16 type. Also the same for winRampLength, there is no way it could be below 0. 

    Best regards,

    Cash Hao

  • Hi Hao,

    great to hear this from you. Now when  numSamplesPerCycle =8 in case when you have selected the 8 MHz sampling frequency & OSR =10.

    then, numSamplesPerCycle is 8 and 8*4096 = 32768. which is violating int16 limit. So, in that case numSamplesPerCycle = -32768.

    So, now your winRampLength will be calculated on the basis of numSamplesPerCycle = -32768. which is wrong.

    Hope now you got the point.

    Thanks,

    Anup Kumar

  • Hi,

    That could be an issue. But you can set the sampling frequency slightly lower than 8MHz, something like 7.2MHz. It could avoid the issue. 

    Best regards,

    Cash Hao

  • Hi Hao,

    Glad to hear this. But I want 8 Mhz sampling frequency. The reason is that at 4 MHz I am observing 25 to 30 ps standard deviation in Delta time of flight.

    When I set 8 MHz ampling frequency then this standard deviation in delta time of flight is around 15 ps.

    Thanks

    Anup Kumar.

  • Hi,

    Setting down to 7.2MHz will still get you a similar result as 8MHz from my view. 

    Best regards,

    Cash Hao

**Attention** This is a public forum