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: USSSWLIB_template_example: USS_message_code_error

Part Number: MSP430FR6047

Hello

     I download the project "USSSWLIB_template_exampl(USSLib_01_40_00_06)" to my board(not evm_fr6047),

     when the program"code = USS_configureUltrasonicMeasurement(&gUssSWConfig);" executes,the code's value is:"USS_message_code_SAPH_time_startPGAandINBiasCount_error".

     I have not modify the project at all,  I searched the USSLib-ApiGuide about this error,I didn't find the cause of the error,the configure is correct.

     what's the matter,Could you help me ?,

                        Regards Bruce

  • Hi Bruce,

    This error is returned if startPGAandINBiasCount is invalid. If USS_measurement_ULP_bias_delay_no_delay is used, then startPGAandINBiasCount must be greater than or equal to 2. If USS_measurement_ULP_bias_delay_X_usec is used (where X is a number of usec), then startPGAandINBiasCount must be 0. Please try checking those value to see which of these cases is causing the error.

    Regards,
    Nathan
  • Hi,Nathan,Thanks for your reply.

    int main(void)
    {
        volatile USS_message_code code;
    
        code = USS_initAlgorithms(&gUssSWConfig);
        code = USS_configureUltrasonicMeasurement(&gUssSWConfig);
        code = USS_calibrateSignalGain(&gUssSWConfig);
        code = USS_estimateDCoffset(&gUssSWConfig,
            USS_dcOffEst_Calc_Mode_trigger_UPS_DNS_capture_controlled_by_ASQ);
    
        while (1)
        {
    
            code = USS_startUltrasonicMeasurement(
                    &gUssSWConfig, USS_capture_power_mode_low_power_mode_0);
            code = USS_runAlgorithms(&gUssSWConfig, &algorithms_Results);
            USS_generateLPMDelay(&gUssSWConfig,
                                 USS_low_power_mode_option_low_power_mode_3,
                                 USS_LOW_POWER_RESTART_CAP_COUNT);
        }
    
    }
    
    __persistent USS_Measurement_Configuration ussMeasurementConfig =
    {
            .ch0DriveStrength = USS_CH0_DRIVE_STRENGHT,
            .ch1DriveStrength = USS_CH1_DRIVE_STRENGHT,
            .pauseState = USS_PAUSE_STATE,
            .pulsePolarity = USS_PULSE_POLARITY,
            .pulseHighPhasePeriod= USS_PULSE_HIGH_PHASE_PERIOD,
            .pulseLowPhasePeriod = USS_PULSE_LOW_PHASE_PERIOD,
            .numOfExcitationPulses = USS_NUM_OF_EXCITATION_PULSES,
            .numOfStopPulses = USS_NUM_OF_STOP_PULSES,
            .sequenceSelection = USS_SEQUENCE_SELECTION,
            .eofSequenceState = USS_EOF_SEQUENCE_SELECTION,
            .startPPGCount = USS_START_PPG_COUNT,
            .turnOnADCCount = (uint_least16_t) USS_TURN_ON_ADC_COUNT,
            .startPGAandINBiasCount = USS_PGA_IN_BIAS_COUNT,
            .startADCsamplingCount = USS_ADC_SAMP_COUNT,
            .restartCaptureCount = (uint_least16_t)USS_RESTART_CAP_COUNT,
            .captureTimeOutCount = USS_TIME_OUT_COUNT,
            .ulpBiasDelay = USS_ULP_BIAS_DELAY,
            .biasImpedance = USS_BIAS_IMPEDANCE,
            .muxChargePumpMode = USS_MUX_CHARGE_PUMP_MODE,
            .restartLowPowerCaptureCount = (uint_least16_t)USS_LOW_POWER_RESTART_CAP_COUNT,
    
    };

    #define USS_PGA_IN_BIAS_COUNT    ((USS_PLL_FREQ*USS_PGA_IN_BIAS_COUNT_SEC)/16)
    #define USS_PGA_IN_BIAS_COUNT_SEC                     0e-6
    #define USS_ULP_BIAS_DELAY                            USS_measurement_ULP_bias_delay_200_usec

    I found those value,there seems to be no problem.

    
    

  • Hi Bruce,

    Because you didn't change the software at all, I am wondering if the issue is caused by differences between your hardware and the MSP430FR6047 EVM. It is possible that those values are getting changed as the program runs. To rule that out, please try setting a breakpoint at the line at which you are seeing the error and view the variable values to see if they are actually what is expected.

    Regards,
    Nathan
  • Thanks a lot,Nathan,
    I will try it. Could you tell me your E-Mail, I'll send my PCB and SCH to you,Would you please check the schematic for me?

    Regards,

    Bruce

  • Hi Bruce,

    I sent you an email about the PCB and schematics. Also, please do let me know the results of checking the variable values at the breakpoint as I mentioned.

    Regards,
    Nathan
  • HI,Nathan,

            I sent you an email with my pcb and sch. The GUI_demo can run on by board,so I think there is something wrong in the basic demo. 

            Regards,

            Bruce

  • Hi Bruce,

    We you able to check the variable values at the breakpoint? I am checking to see if there are any known issues with running the template project. Are you using CCS or IAR?

    Regards,
    Nathan
  • Hi,Nathan,

           I am using IAR to debug the project. Which varialbe value you want to know,I try to find them.

           I got a EVM,but it can't run normally. I debug the project  USSLib_GUI_Demo,and I don't change it at all.

    uint16_t hal_adc_voltagesupply_readmV(void)
    {
        int32_t adc_corrected;
        uint16_t adc_mv;
    
        // turn on VCC_SENSE_EN
        GPIO_setOutputLowOnPin(GPIO_PORT_P2, GPIO_PIN2);
        GPIO_setAsOutputPin(GPIO_PORT_P2, GPIO_PIN2);
    
        //Enable ADC12 module; takes 100ns to stabilize
        ADC12_B_enable(ADC12_B_BASE);
    
        //Turn on Reference Voltage
        Ref_A_enableReferenceVoltage(REF_A_BASE);
    
        while (Ref_A_isVariableReferenceVoltageOutputReady(REF_A_BASE) != REF_A_READY)
            ;
    
        __disable_interrupt();
        volt_supply_rdy = false;
    
        ADC12_B_clearInterrupt(ADC12_B_BASE,
                               0,
                               ADC12_B_IFG8
                               );
    
        //Enable memory buffer 0 interrupt
        ADC12_B_enableInterrupt(ADC12_B_BASE,
                                ADC12_B_IE8,
                                0,
                                0);
        /*
         * Base address of ADC12B Module
         * Start the conversion into memory buffer 8
         * Use the single-channel, single-conversion mode
         */
        ADC12_B_startConversion(ADC12_B_BASE,
                                ADC12_B_START_AT_ADC12MEM8,
                                ADC12_B_SINGLECHANNEL);
    
        while (volt_supply_rdy == false)
        {
            __bis_SR_register(LPM0_bits + GIE);    // LPM0, ADC10_ISR will force exit
            __no_operation();                      // For debug only          !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! run to here ,something wrong happened,WTD worked and the software reset. 
            __disable_interrupt();
        }
        __enable_interrupt();
        ADC12_B_disableInterrupt(ADC12_B_BASE,
                                    ADC12_B_IE8,
                                    0,
                                    0);
    I don't know why.

    Regards,
    Bruce
  • Hi,

    Could you please explain what you mean when you say that it can't run normally? What are you seeing? Are you using the USS GUI?

    Regards,
    Nathan
  • Hi,

    Has this issue been resolved? If so, please mark it as answered. If no response soon, this thread will be closed due to inactivity.

    Regards,
    Nathan
  • Hi,Nathan

      yes,I used GUI USS.

    while (volt_supply_rdy == false)
        {
            __bis_SR_register(LPM0_bits + GIE);    // LPM0, ADC10_ISR will force exit
            __no_operation(); //***stop here!!!****//           
            __disable_interrupt();
        }

          the software stoped at "__no_operation();",and the WTD worked ,software reset. So the EVM can't measure the TOF.

         I comment out these code,the EVM can measure the TOF but the battery voltage cannot be measured.

         Regards,

         Bruce

  • Hi Bruce,

    Assuming i am understanding this correctly, That is what the code should be doing. As you said, there is a software reset, so TOF won't be measured. Is this something that you changed, or was this code already there as-is? Have you made any changes to the code?

    Regards,
    Nathan
  • Hi,

    Has this issue been resolved? If so, please mark it as answered. If no response soon, this thread will be closed due to inactivity.

    Regards,
    Nathan
  • Hi,Nathan
    Thank you very much,I found the reason already,the configuration of USS is not correct.
    Regards
    Bruce

**Attention** This is a public forum