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: Communication Protocol Spec,EVM430-FR6043

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

"Communication Protocol Spec" in the "Ultrasonic Sensing Design Center User Guide".

How to configure the hardware of EVM430-FR6043 using eZ-FET UART?

The baud rate is 9600, and there is no response to send "04 B0 00 00 B4".

Regards,

YAN

  • Hello,

    I am going to loop in the Ultrasonic Sensing team to further assist you but I'd like to ask some preliminary questions in the meantime:

    1) What are you trying to do with configuring the hardware? Much of the configurations can be done using the USS Design Center GUI which uses I2C communication with the device.

    2) What changes have you made to the initial demo to test your UART communication?

    Best regards,

    Matt
  • The configuration using uart is as follows:


    Configuration: COM21 MSP Application UART


    I want to use the FR6043 configured by the USS Design Center GUI to output traffic and add a second MCU to display and communicate. Just like the Panasonic ultrasonic gas meter solution.
    So I need to collect DTOF data, traffic data.

  • Hello Guo,

    We are planning to include UART communication in the next release in the template project.  Please note that the template project is different from the Demo example which uses the GUI.  The template project is available in the USSSW Lib download below.  

    http://www.ti.com/tool/msp-ultrasonic-design-center 

    If you would like to try to implement UART which outputs DTOF to a terminal yourself on the template project, please see the quick and dirty method attached.MSP430FR604x_UART.pdf

    8463.main.c
    /* --COPYRIGHT--,BSD
     * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
     *
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     * --/COPYRIGHT--*/
    #include <msp430.h>
    #if ENABLE_UART_DEBUG
    #include <stdio.h>
    #endif
    #include "ussSwLib.h"
    #include "USS_Config/USS_userConfig.h"
    
    
    
    /*******************************************************************************
     * Enables Signal gain calibration. It is recommmended to enable this feature
     * once USS_START_CAPTURE_SEC has been configured and UPS and DNS captures have
     * a valid signal
     ******************************************************************************/
    #define APPLICATION_ENABLE_SIGNAL_GAIN_CALIBRATION               false
    
    /*******************************************************************************
     * For Single tone application using USS_Alg_AbsToF_Calculation_Option_lobeWide
     * Algorithm it  might be required to scale down binary it the algorithm when
     * the capturing a valid signal but USS_runAlgorithms is returning the following
     * error message
     * USS_message_code_algorithm_error_no_signal_detected_ups_dns_channel
     * Please refer to the library User's Guide for further detail
     ******************************************************************************/
    #define APPLICATION_ENABLE_BINARY_PATTERN_SIZE_SCALING      false
    #if (APPLICATION_ENABLE_BINARY_PATTERN_SIZE_SCALING == true)
    #define APPLICATION_BINARY_PATTERN_SCALE_FACTOR             4
    #endif
    
    /*******************************************************************************
     *  Channel Swap configuration
     ******************************************************************************/
    #define APPLICATION_ENABLE_CHANNEL_SWAP                     false
    #if (APPLICATION_ENABLE_CHANNEL_SWAP == true)
    #define APPLICATION_CHANNEL_SWAP_INTERVAL                   1
    #endif
    
    /*******************************************************************************
     * Abstof and DToF Offset calculation configuration
     ******************************************************************************/
    #define APPLICATION_ENABLE_ABSTOF_DTOF_OFFSET_CALIBRATION               false
    #if (APPLICATION_ENABLE_ABSTOF_DTOF_OFFSET_CALIBRATION == true)
    #define APPLICATION_ABSTOF_DTOF_OFFSET_UPDATE_INTERVAL      255
    #define APPLICATION_ABSTOF_DTOF_OFFSET_LPM_CAPTURE          true
    #define APPLICATION_ABSTOF_DTOF_OFFSET_CALC_UPS_ABSTOF      true
    #define APPLICATION_ABSTOF_DTOF_OFFSET_CALC_DNS_ABSTOF      false
    #define APPLICATION_ABSTOF_DTOF_OFFSET_CALC_DTOF            false
    #define APPLICATION_ABSTOF_REFERENCE                        (32.00e-6f)
    #endif
    
    
    USS_Algorithms_Results algorithms_Results;
    
    static void checkCode(USS_message_code code, USS_message_code expectedCode);
    static void handlePllUnlockEvent(void);
    static void disableApplicationInterrupts(void);
    static void enableApplicationInterrupts(void);
    
    #if ENABLE_UART_DEBUG
    char dtofString[20]={0};
    #endif
    
    int main(void)
    {
    #if (APPLICATION_ENABLE_CHANNEL_SWAP == true)
        uint16_t appSwapInterval = APPLICATION_CHANNEL_SWAP_INTERVAL;
    #endif
    
    #if (APPLICATION_ENABLE_ABSTOF_DTOF_OFFSET_CALIBRATION == true)
        USS_dTof_absTof_offset_results abstoFDtofTestResults;
        USS_dTof_absTof_offset_test_config abstoFDtofTestConfig =
        {
             .numOfTestIterations        = APPLICATION_ABSTOF_DTOF_OFFSET_UPDATE_INTERVAL,
             .isUseLPMCapture            = APPLICATION_ABSTOF_DTOF_OFFSET_LPM_CAPTURE,
             .isCalculateUpsAbsTofOffset = APPLICATION_ABSTOF_DTOF_OFFSET_CALC_UPS_ABSTOF,
             .isCalculateDnsAbsTofOffset = APPLICATION_ABSTOF_DTOF_OFFSET_CALC_DNS_ABSTOF,
             .isCalculateDToFOffset      = APPLICATION_ABSTOF_DTOF_OFFSET_CALC_DTOF,
        };
    #endif
    
        volatile USS_message_code code;
        USS_Algorithms_Results algResults;
        USS_calibration_hspll_results testResults;
    
    
        // Register PLL unlock event
        USS_registerHSPLLInterruptCallback(USS_HSPLL_Interrupt_PLLUNLOCK,
                                           &handlePllUnlockEvent);
    
        code = USS_configureUltrasonicMeasurement(&gUssSWConfig);
        checkCode(code, USS_message_code_no_error);
    
    #if((USS_ALG_ABS_TOF_COMPUTATION_MODE == USS_ALG_ABS_TOF_COMPUTATION_MODE_LOBE_WIDE) || \
        (USS_ALG_ABS_TOF_COMPUTATION_MODE == USS_ALG_ABS_TOF_COMPUTATION_MODE_HILBERT_WIDE))
        // Reference binary pattern are only needed by
        // USS_Alg_AbsToF_Calculation_Option_lobeWide and
        // USS_Alg_AbsToF_Calculation_Option_hilbertWide AbsToF computation options
        if((USS_Alg_AbsToF_Calculation_Option_lobeWide ==
                gUssSWConfig.algorithmsConfig->absToFOption)
           || (USS_Alg_AbsToF_Calculation_Option_hilbertWide ==
                   gUssSWConfig.algorithmsConfig->absToFOption))
        {
    #if defined(__MSP430_HAS_SAPH_A__)
            if(USS_measurement_pulse_generation_mode_multi_tone ==
                    gUssSWConfig.measurementConfig->pulseConfig->pulseGenMode)
            {
                code = USS_generateMultiToneBinaryPattern(&gUssSWConfig);
                checkCode(code, USS_message_code_no_error);
            }
    #endif
            if(USS_measurement_pulse_generation_mode_multi_tone !=
                    gUssSWConfig.measurementConfig->pulseConfig->pulseGenMode)
            {
                code = USS_generateMonoDualToneBinaryPattern(&gUssSWConfig);
                checkCode(code, USS_message_code_no_error);
            }
        }
    
    #if (APPLICATION_ENABLE_BINARY_PATTERN_SIZE_SCALING == true)
        gUssSWConfig.algorithmsConfig->binaryPatternLength =
                (gUssSWConfig.captureConfig->sampleSize / APPLICATION_BINARY_PATTERN_SCALE_FACTOR);
    #endif
    
    #endif
    
    
        // Application must ensure no application level interrupts occur while
        // verifying HSPLL Frequency
        disableApplicationInterrupts();
    
        code = USS_verifyHSPLLFrequency(&gUssSWConfig, &testResults);
    
        // Application can re-enable interrupts after HSPLL verification
        enableApplicationInterrupts();
    
        checkCode(code, USS_message_code_no_error);
    
        gUssSWConfig.algorithmsConfig->clockRelativeError = _IQ27div((int32_t)(testResults.actualTestCount -
                testResults.expectedResult),testResults.expectedResult);
    
        code = USS_initAlgorithms(&gUssSWConfig);
        checkCode(code, USS_message_code_no_error);
    
    #if (APPLICATION_ENABLE_SIGNAL_GAIN_CALIBRATION == true)
        code = USS_calibrateSignalGain(&gUssSWConfig);
        checkCode(code, USS_message_code_no_error);
    #endif
    
    #if (APPLICATION_ENABLE_ABSTOF_DTOF_OFFSET_CALIBRATION == true)
        code = USS_calculateOffsets(&gUssSWConfig, &abstoFDtofTestResults,
                                    &abstoFDtofTestConfig);
        checkCode(code, USS_message_code_no_error);
    
        code = USS_updateAdditionalCaptureDelay(&gUssSWConfig,
              ((abstoFDtofTestResults.upsAbsToFOffset + abstoFDtofTestResults.dnsAbsToFOffset) /2.0f) -
              APPLICATION_ABSTOF_REFERENCE);
        checkCode(code, USS_message_code_no_error);
    
        code = USS_updateDtoFOffset(&gUssSWConfig, (-1.0f *abstoFDtofTestResults.dToFOffset));
        checkCode(code, USS_message_code_no_error);
    
    #endif
    
    
        while(1)
        {
    
            code = USS_startLowPowerUltrasonicCapture(&gUssSWConfig);
            checkCode(code, USS_message_code_no_error);
    
    
            code = USS_runAlgorithms(&gUssSWConfig,&algResults);
            checkCode(code, USS_message_code_valid_results);
    
    
    #if (APPLICATION_ENABLE_CHANNEL_SWAP == true)
            if(appSwapInterval == 0)
            {
                code = USS_swapCaptureChannels(&gUssSWConfig);
                code = USS_swapAlgorithmsCaptureBuffers(&gUssSWConfig);
    
                appSwapInterval = APPLICATION_CHANNEL_SWAP_INTERVAL;
            }else{
                appSwapInterval--;
            }
    #endif
    
    #if ENABLE_UART_DEBUG
            uint8_t txCount;
            int8_t i;
            txCount = sprintf(dtofString, "%.3e\n\r", (double)(algResults.deltaTOF));
    
            for(i = 0; i < txCount; i++)
            {
                while(!(UCA1IFG & UCTXIFG));
                UCA1TXBUF = dtofString[i];
            }
    #endif
    
            // Generate a 1 sec LPM3 delay
            USS_generateLPMDelay(&gUssSWConfig,
                                 USS_low_power_mode_option_low_power_mode_3,
                                 32768);
        }
    }
    
    
    void handlePllUnlockEvent(void)
    {
        // If USS PLL unlock event is detected rest USS Module and reconfigure
        // measurement
        USS_resetUSSModule(&gUssSWConfig, true);
    }
    
    
    // This is a place holder for the application to disable interrupts which might
    // be triggered during HSPLL verification
    void disableApplicationInterrupts(void){
    
    }
    
    // This is a place holder for the application to enable interrupts once
    // HSPLL verification has completed
    void enableApplicationInterrupts(void){
    
    }
    
    void checkCode(USS_message_code code, USS_message_code expectedCode)
    {
        if(code != expectedCode)
        {
            // Trap code
            while(1);
        }
    }
    

    system_pre_init.c
    /* --COPYRIGHT--,BSD
     * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
     *
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     * --/COPYRIGHT--*/
    /*******************************************************************************
     *
     *  system_pre_init.c - system_pre_init.c
     *
     ******************************************************************************/
    
    /*
     * The function _system_pre_init it called by the start-up code before
     * "main" is called, and before data segment initialization is
     * performed.
     *
     * This is a template file, modify to perform any initialization that
     * should take place early.
     *
     * The return value of this function controls if data segment
     * initialization should take place. If 0 is returned, it is bypassed.
     *
     * For the MSP430 microcontroller family, please consider disabling
     * the watchdog timer here, as it could time-out during the data
     * segment initialization.
     */
    
    #include <intrinsics.h>
    #include <stdint.h>
    #include "msp430.h"
    
    #ifdef __TI_COMPILER_VERSION__
    int _system_pre_init(void)
    #elif __IAR_SYSTEMS_ICC__
    int __low_level_init(void)
    #elif __GNUC__
    extern int system_pre_init(void) __attribute__((constructor));
    int system_pre_init(void)
    #else
    #error Compiler not supported!
    #endif
    {
        /* Insert your low-level initializations here */
    
        /* Disable Watchdog timer to prevent reset during */
        /* int32_t variable initialization sequences. */
        // Stop WDT
        WDTCTL = WDTPW + WDTHOLD;
    
        /*
         * Configure CS module
         * MCLK  = 16 MHz from DCOCLK
         * SMCLK = 8MHz from DCOCLK
         * ACLK  = LFXTCLK expected to have a 32.768 KHz
         */
    	// Unlock CS registers
    	CSCTL0_H = CSKEY >> 8;
        // Set DCO to 16MHz
    #if (USS_PULSE_MODE == 2)
        CSCTL1 = DCORSEL | DCOFSEL_4;
        // Configure wait states to be able to use 16 MHz MCLK
        FRCTL0 = (FRCTLPW | NWAITS_2);
        // Configure clock dividers all dividers
        CSCTL3 = (DIVA__1 | DIVS__2 | DIVM__1);
    #else
        // Set DCO to 8MHz
        CSCTL1 = DCORSEL | DCOFSEL_3;
        // Configure clock dividers all dividers
        CSCTL3 = (DIVA__1 | DIVS__1 | DIVM__1);
    #endif
        // Set SMCLK = MCLK = DCO, ACLK = LFXTCLK
        CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__DCOCLK;
    	CSCTL4 |= (LFXTDRIVE_3);
    	CSCTL4 &= ~(LFXTOFF);
    	CSCTL0_H = 0;
    
    	// GPIO Configuration
    	PAOUT = 0;
    	PADIR = 0xFFFF;
    
    	PBOUT = 0;
    	PBDIR = 0xFFFF;
    
    	PCOUT = 0;
    	PCDIR = 0xFFFF;
    
    	PDOUT = 0;
    	PDDIR = 0xFFFF;
    
        PEOUT = 0;
        PEDIR = 0xFFFF;
    
    #if ENABLE_UART_DEBUG
        P1SEL0 |= (BIT2 | BIT3);
        P1SEL1 &= ~(BIT2 | BIT3);
    
        // Configure USCI_A0 for UART mode
        UCA1CTLW0 = UCSWRST;                    // Put eUSCI in reset
        UCA1CTLW0 |= UCSSEL__SMCLK;             // CLK = SMCLK
        UCA1BRW = 4;
        UCA1MCTLW = 0x5551;
                                               // UCBRSx value = 0xD6 (See UG)
        UCA1CTLW0 &= ~UCSWRST;                 // release from reset
    #endif
    
        /*
         * Configure LFXT GPIO pins and start
         */
    	PJSEL0 |= BIT4 | BIT5;
    
    	// Disable the GPIO power-on default high-impedance mode to activate
    	// previously configured port settings
    	PM5CTL0 &= ~LOCKLPM5;
    
    
        /*==================================*/
        /* Choose if segment initialization */
        /* should be done or not.           */
        /* Return: 0 to omit initialization */
        /* 1 to run initialization          */
        /*==================================*/
        return(1);
    }
    

**Attention** This is a public forum