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.

EVM430-FR6047: UART Connection

Part Number: EVM430-FR6047


Hello,

I would like to use uart to transmit date from the EVM430-FR6047. At first I want to test the communication by looping the RX and TX pins on the board and see how it works. The question I have is  how do I do this. I have found the mps430 pin for uart (16,17,18,19,67,68,82,83) but I don't understand where are they and how to connect them. For instance at the pins in J2 do I just connect the RXD and TXD and I am set, and which of the two pins the each RXD and TXD has? Any indication on where  to look and any example of connection is welcome.

Thank you for your time.

Nomikos Panagiotis

  • Hello Nomikos,

    Are you looking to add UART into the template project or the demo application project?  I can provide a UART example, but these projects are structured differently, so I need to know which project you are using.  Let me know and I will get you some code to work with. 

    In regards to the pins, the easiest is to use P1.2 and P1.3, which is available on J2.  If you want to output to a terminal on the PC, you can just leave these jumpers on and this will go through the backchannel UART on the board and you can view the data via the standard USB port on the board and a terminal application on the PC.  If you dont want to connect through the USB port, you can remove the jumpers on TXD and RXD of J2 and place a wire on the TXD pin.  TX UART data will be put onto this pin.  

  • Hello Eddie,

    I am using the water meter application and I want to use uart to send and receive data and instruction from another board I have. Could you provide me the sample code?

    Thank you for your time 

    Nomikos Panagioitis

  • Hello Nomikos,

    In the water meter demo application code, you can add the following code to enable a UART TX of the DTOF values.  We do not have a UART example that is also receiving commands and performing a function.  This should get you a good start though.  

    In USSLibGUIGUIApp.c

    void USSLibGUIApp_Engine(void)
    {
        USS_message_code code;
        USS_Algorithms_Results_fixed_point algResFixed;
    #ifdef USS_APP_RESONATOR_CALIBRATE_ENABLE
        USS_calibration_hspll_results pllCalibTestResults;
    #endif
    
    // added code
    #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
    //end of added code

    In hmi.c

    #include <lcd_statemachineDC/lcd_statemachine.h>
    #include <resultsDC/results.h>
    
    #if ENABLE_UART_DEBUG   //added code
    #include <stdio.h>
    #endif
    /*** GLOBAL VARIABLES ***/
    __persistent Packet_t gstxPacket = {0};
    
    //added code
    #if ENABLE_UART_DEBUG
    char resultString[20]={0};
    #endif
    //end of added code
            USS_getResultsInFloat( pt_alg_res, &alg_results_float);
            alg_results_float.deltaTOF -= gUssSWConfig.algorithmsConfig->dcOffset;
            alg_results_float.volumeFlowRate *= 10.0;   //10x multiply
            DC_User_Params->plot_dtof = ((double) alg_results_float.deltaTOF);
            DC_User_Params->plot_abs_ups = alg_results_float.totalTOF_UPS;
            DC_User_Params->plot_abs_dns = alg_results_float.totalTOF_DNS;
            DC_User_Params->plot_vol_flow_rate  = (alg_results_float.volumeFlowRate);
    //    }
    
    //added code
    #if ENABLE_UART_DEBUG
            uint8_t txCount;
            int8_t i;
             txCount = sprintf(resultString, "%.3e\n\r", (double)(alg_results_float.deltaTOF));
    
            for(i = 0; i < txCount; i++)
            {
                while(!(UCA1IFG & UCTXIFG));
                UCA1TXBUF = resultString[i];
            }
    #endif
    //end of added code

    Last, you will need to add ENABLE_UART_DEBUG=1 to your predefined symbols.  Right click the project and go to properties, then set as seen below.

     

  • Thank you for your reply. I connected my board with my arduino 101 but unfortunately I do not receive and data that I can read. The data I receive are like this : JJJ8YI[⸮. The baudrate and the other option I believe are set correctly. Could it be a problem from the arduino side or should i try something else?

    Thank you for your time.

    Nomikos Panagiotis

  • It seems like it could be a baudrate issue or something else on the Arduino side.  You are setting your Arduino baud to 115,200bps? 

    You could also test if the data is being displayed properly on a PC terminal.  Place the TX and RX jumpers on J2 and connect your terminal to the MSP Application UART port with the baud rate set to 115.2kbps, 8 data bits, No Parity, 1 stop bit, No flow control. 

  • Thank you very much. It was the baudrate. I used the baudrate of the hal_uart and thought that it applied here as well.

    Again thank you.

    Also just for clarification you say in the comments that you initialize the USCI_A0 but I see that you use the UCA1CTLW0 for the initialization. Did you mean to use the USCI_A1 or I understood something wrong?

  • Hello,

    Yes, looking back at the comments, this looks like an error in the comment as it is UCA1 that it initialized.  

**Attention** This is a public forum