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.

CCS/MSP430FR4133: serial communication using msp430fr4133

Part Number: MSP430FR4133
Other Parts Discussed in Thread: LMT86

Tool/software: Code Composer Studio

I try to create little programmable thermostat with msp430fr4133 and LMT86. I have a java application with 2 buttons one for get ( refresh displayed temp ) and set ( set temperature to msp ).

I send from java a command and dont receive in microcontroller.  

Java Send function: 

void writeData(String temperature){
try{
byte a;
for (char ch : temperature.toCharArray()) {
a = (byte)ch;
output.write(a);
output.flush();
}
} catch (Exception e){
logText = "Failed to write data: " + e.toString();
System.out.println(logText);
}
}

In msp have UART INTERRUPT ROUTINE and dont work. At every step this routine are skyped.

void initClockTo16MHz()
{
FRCTL0 = FRCTLPW | NWAITS_1;

__bis_SR_register(SCG0);
CSCTL3 |= SELREF__REFOCLK;
CSCTL0 = 0;
CSCTL1 &= ~(DCORSEL_7);
CSCTL1 |= DCORSEL_5;
CSCTL2 = FLLD_0 + 487;

__delay_cycles(3);
__bic_SR_register(SCG0);
while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1));

CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK;
}

void Init_PIN(){
// UART pins
GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_UCA0TXD, GPIO_PIN_UCA0TXD, GPIO_FUNCTION_UCA0TXD);
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_UCA0RXD, GPIO_PIN_UCA0RXD, GPIO_FUNCTION_UCA0RXD);

// ADC pins
GPIO_setAsInputPin(GPIO_PORT_P8, GPIO_PIN0);
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P8,GPIO_PIN0,GPIO_PRIMARY_MODULE_FUNCTION);

PM5CTL0 &= ~LOCKLPM5;
}

void Init_UART(){
UCA0CTLW0 |= UCSWRST;

UCA0CTLW0 |= UCSSEL__SMCLK;
UCA0BRW = 104;
UCA0MCTLW |= UCOS16 | UCBRF_2 | 0xD600;

UCA0CTLW0 &= ~UCSWRST;
UCA0IE |= UCRXIE;
}

void configurateADC(){
ADC_init(ADC_BASE,ADC_SAMPLEHOLDSOURCE_SC,ADC_CLOCKSOURCE_ADCOSC,ADC_CLOCKDIVIDER_1);
ADC_enable(ADC_BASE);
ADC_setupSamplingTimer(ADC_BASE,ADC_CYCLEHOLD_256_CYCLES ,ADC_MULTIPLESAMPLESDISABLE);
ADC_setResolution(ADC_BASE,ADC_RESOLUTION_10BIT);
ADC_configureMemory(ADC_BASE, ADC_INPUT_A8,ADC_VREFPOS_AVCC,ADC_VREFNEG_AVSS);
__delay_cycles(5000);
}

int main(void)
{

WDT_A_hold(WDT_A_BASE);

Init_PIN();
initClockTo16MHz();
Init_UART();

configurateADC();

while(1) {
ADC_startConversion(ADC_BASE, ADC_SINGLECHANNEL);
adcInt = ADC_getResults(ADC_BASE);

if(readCommand[0] == 's' && readCommand[1] == 'e' && readCommand[2] == 't'){
//pars command and get temperature
// command structure: set:12
// when 12 is celsius degree

memset(readCommand, 0, sizeof(readCommand));
free(temperature);

} else if(readCommand[0] == 'g' && readCommand[1] == 'e' && readCommand[2] == 't') {
//send temperature to serial

sendTemp();
memset(readCommand, 0, sizeof(readCommand));
}
free(temperature);
}
}

//*********************************************************************************************************************
// \/ UART INTERRUPT ROUTINE \/
//*********************************************************************************************************************

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)

#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCA0IV,USCI_UART_UCTXCPTIFG))
{
case USCI_NONE: break;
case USCI_UART_UCRXIFG:
while(!(UCA0IFG&UCTXIFG));
strcat(readCommand, (char *)UCA0RXBUF);
__no_operation();
break;
case USCI_UART_UCTXIFG: break;
case USCI_UART_UCSTTIFG: break;
case USCI_UART_UCTXCPTIFG: break;
default: break;
}
}

This are all fuctions used. CS 16Mhz, BoundRate 9600 bits/s

  • Hi Marcel,

    Please refer to MSP430FR4133 uart communication code examples.

    msp430fr413x_euscia0_uart_01.c
    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2014, Texas Instruments Incorporated
     * All rights reserved.
     *
     * 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.
     *
     *******************************************************************************
     * 
     *                       MSP430 CODE EXAMPLE DISCLAIMER
     *
     * MSP430 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
     * for an API functional library-approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //   MSP430FR413x Demo - eUSCI_A0 UART echo at 9600 baud using BRCLK = 8MHz
    //
    //  Description: This demo echoes back characters received via a PC serial port.
    //  SMCLK/ DCO is used as a clock source and the device is put in LPM3
    //  The auto-clock enable feature is used by the eUSCI and SMCLK is turned off
    //  when the UART is idle and turned on when a receive edge is detected.
    //  Note that level shifter hardware is needed to shift between RS232 and MSP
    //  voltage levels.
    //
    //  The example code shows proper initialization of registers
    //  and interrupts to receive and transmit data.
    //  To test code in LPM3, disconnect the debugger.
    //
    //  ACLK = REFO = 32768Hz, MCLK = DCODIV = SMCLK = 8MHz.
    //
    //                MSP430FR4133
    //             -----------------
    //         /|\|                 |
    //          | |                 |
    //          --|RST              |
    //            |                 |
    //            |                 |
    //            |     P1.0/UCA0TXD|----> PC (echo)
    //            |     P1.1/UCA0RXD|<---- PC
    //            |                 |
    //
    //   Darren Lu
    //   Texas Instruments Inc.
    //   June 2014
    //   Built with IAR Embedded Workbench v6.10 & Code Composer Studio v6.0
    //******************************************************************************
    
    #include <msp430.h>
    
    void Init_GPIO();
    
    int main(void)
    {
      WDTCTL = WDTPW | WDTHOLD;                // Stop watchdog timer
    
      // Configure GPIO
      Init_GPIO();
      PM5CTL0 &= ~LOCKLPM5;                    // Disable the GPIO power-on default high-impedance mode
                                               // to activate 1previously configured port settings
    
      __bis_SR_register(SCG0);                 // disable FLL
      CSCTL3 |= SELREF__REFOCLK;               // Set REFO as FLL reference source
      CSCTL0 = 0;                              // clear DCO and MOD registers
      CSCTL1 &= ~(DCORSEL_7);                  // Clear DCO frequency select bits first
      CSCTL1 |= DCORSEL_3;                     // Set DCO = 8MHz
      CSCTL2 = FLLD_0 + 243;                   // DCODIV = 8MHz
      __delay_cycles(3);
      __bic_SR_register(SCG0);                 // enable FLL
      while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked
    
      CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz
                                               // default DCODIV as MCLK and SMCLK source
    
      // Configure UART pins
      P1SEL0 |= BIT0 | BIT1;                    // set 2-UART pin as second function
    
      // Configure UART
      UCA0CTLW0 |= UCSWRST;
      UCA0CTLW0 |= UCSSEL__SMCLK;
      
      // Baud Rate calculation
      // 8000000/(16*9600) = 52.083
      // Fractional portion = 0.083
      // User's Guide Table 14-4: UCBRSx = 0x49
      // UCBRFx = int ( (52.083-52)*16) = 1
      UCA0BR0 = 52;                             // 8000000/16/9600
      UCA0BR1 = 0x00;
      UCA0MCTLW = 0x4900 | UCOS16 | UCBRF_1;
    
      UCA0CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
      UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt
    
      __bis_SR_register(LPM3_bits|GIE);         // Enter LPM3, interrupts enabled
      __no_operation();                         // For debugger
    }
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
      switch(__even_in_range(UCA0IV,USCI_UART_UCTXCPTIFG))
      {
        case USCI_NONE: break;
        case USCI_UART_UCRXIFG:
          while(!(UCA0IFG&UCTXIFG));
          UCA0TXBUF = UCA0RXBUF;
          __no_operation();
          break;
        case USCI_UART_UCTXIFG: break;
        case USCI_UART_UCSTTIFG: break;
        case USCI_UART_UCTXCPTIFG: break;
        default: break;
      }
    }
    
    void Init_GPIO()
    {
        P1DIR = 0xFF; P2DIR = 0xFF; P3DIR = 0xFF; P4DIR = 0xFF;
        P5DIR = 0xFF; P6DIR = 0xFF; P7DIR = 0xFF; P8DIR = 0xFF;
        P1REN = 0xFF; P2REN = 0xFF; P3REN = 0xFF; P4REN = 0xFF;
        P5REN = 0xFF; P6REN = 0xFF; P7REN = 0xFF; P8REN = 0xFF;
        P1OUT = 0x00; P2OUT = 0x00; P3OUT = 0x00; P4OUT = 0x00;
        P5OUT = 0x00; P6OUT = 0x00; P7OUT = 0x00; P8OUT = 0x00;
    }
    

    msp430fr413x_euscia0_uart_03.c
    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2014, Texas Instruments Incorporated
     * All rights reserved.
     *
     * 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.
     *
     *******************************************************************************
     * 
     *                       MSP430 CODE EXAMPLE DISCLAIMER
     *
     * MSP430 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
     * for an API functional library-approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //   MSP430FR413x Demo - USCI_A0 External Loopback test @ 115200 baud
    //
    //  Description: This demo connects TX to RX of the MSP430 UART
    //  The example code shows proper initialization of registers
    //  and interrupts to receive and transmit data. If data is incorrect P4.0 LED is
    //  turned ON.
    //  ACLK = n/a, MCLK = SMCLK = BRCLK = DCODIV ~1MHz.
    //
    //                MSP430FR4133
    //             -----------------
    //         /|\|                 |
    //          | |                 |
    //          --|RST              |
    //            |                 |
    //            |                 |
    //            |     P1.0/UCA0TXD|----
    //            |                 |   |
    //            |     P1.1/UCA0RXD|----
    //            |                 |
    //            |            P4.0 |--> LED
    //            |                 |
    
    //   Darren Lu
    //   Texas Instruments Inc.
    //   June 2014
    //   Built with IAR Embedded Workbench v6.10 & Code Composer Studio v6.0
    //******************************************************************************
    #include <msp430.h>
    
    unsigned char RXData = 0;
    unsigned char TXData = 1;
    
    int main(void)
    {
        WDTCTL = WDTPW | WDTHOLD;                 // Stop watchdog timer
    
        PM5CTL0 &= ~LOCKLPM5;                     // Disable the GPIO power-on default high-impedance mode
                                                  // to activate previously configured port settings
        P4DIR |= BIT0;
        P4OUT &= ~BIT0;                           // P4.0 out low
    
        // Configure UART pins
        P1SEL0 |= BIT0 | BIT1;                    // set 2-UART pin as second function
    
        // Configure UART
        UCA0CTLW0 |= UCSWRST;                     // Put eUSCI in reset
        UCA0CTLW0 |= UCSSEL__SMCLK;               
        // Baud Rate calculation
        UCA0BR0 = 8;                              // 1000000/115200 = 8.68
        UCA0MCTLW = 0xD600;                       // 1000000/115200 - INT(1000000/115200)=0.68
                                                  // UCBRSx value = 0xD6 (See UG)
        UCA0BR1 = 0;
        UCA0CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
        UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt
    
        while (1)
        {
            while(!(UCA0IFG & UCTXIFG));
            UCA0TXBUF = TXData;                   // Load data onto buffer
    
            __bis_SR_register(LPM0_bits|GIE);     // Enter LPM0
            __no_operation();                     // For debugger
        }
    }
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
        switch(__even_in_range(UCA0IV,USCI_UART_UCTXCPTIFG))
        {
            case USCI_NONE: break;
            case USCI_UART_UCRXIFG:
                  UCA0IFG &=~ UCRXIFG;            // Clear interrupt
                  RXData = UCA0RXBUF;             // Clear buffer
                  if(RXData != TXData)            // Check value
                  {
                      P4OUT |= BIT0;              // If incorrect turn on P4.0
                      while(1);                   // trap CPU
                  }
                  TXData++;                             // increment data byte
                  __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0 on reti
                  break;
            case USCI_UART_UCTXIFG: break;
            case USCI_UART_UCSTTIFG: break;
            case USCI_UART_UCTXCPTIFG: break;
        }
    }
    

    msp430fr413x_eusci_uart_standard_transceiver.c
    //******************************************************************************
    //   MSP430FR413x Demo - eUSCI_A0, UART Echo received character
    //                     (ACLK 9600/SMCLK 9600/SMCLK 115200)
    //
    //   Description: The device will wait in LPM0/LPM3 (based on clock source)
    //   until a UART character is received.
    //   Then the device will echo the received character.
    //   The UART can operate using ACLK at 9600, SMCLK at 115200 or SMCLK at 9600.
    //   To configure the UART mode, change the following line:
    //
    //      #define UART_MODE       SMCLK_115200
    //      to any of:
    //      #define UART_MODE       SMCLK_115200
    //      #define UART_MODE       SMCLK_9600
    //      #define UART_MODE       MODCLK_9600
    //
    //   UART RX ISR is used to handle communication.
    //   ACLK = 32.768kHz, MCLK = SMCLK = DCO 16MHz.
    //
    //
    //
    //                   MSP430FR4133
    //                 -----------------
    //            /|\ |             P1.1|<-- Receive Data (UCA0RXD)
    //             |  |                 |
    //             ---|RST          P1.0|--> Transmit Data (UCA0TXD)
    //                |                 |
    //                |                 |
    //                |                 |
    //   Error LED  <-|P1.2             |
    //                |                 |
    //                |                 |
    //
    //   Nima Eskandari and Ryan Meredith
    //   Texas Instruments Inc.
    //   November 2017
    //   Built with CCS V7.3
    //******************************************************************************
    
    #include <msp430.h>
    
    //******************************************************************************
    // UART Initialization *********************************************************
    //******************************************************************************
    
    #define LED_OUT     P1OUT
    #define LED_DIR     P1DIR
    #define LED_PIN     BIT2
    
    #define SMCLK_115200     0
    #define SMCLK_9600       1
    
    #define UART_MODE       SMCLK_115200//SMCLK_9600//
    
    void initUART()
    {
        // Configure USCI_A0 for UART mode
        UCA0CTLW0 |= UCSWRST;                      // Put eUSCI in reset
    #if UART_MODE == SMCLK_115200
    
        UCA0CTLW0 |= UCSSEL__SMCLK;               // CLK = SMCLK
        // Baud Rate Setting
        // Use Table 21-5
        UCA0BRW = 8;
        UCA0MCTLW |= UCOS16 | UCBRF_10 | 0xF700;   //0xF700 is UCBRSx = 0xF7
    
    #elif UART_MODE == SMCLK_9600
    
        UCA0CTLW0 |= UCSSEL__SMCLK;               // CLK = SMCLK
        // Baud Rate Setting
        // Use Table 21-5
        UCA0BRW = 104;
        UCA0MCTLW |= UCOS16 | UCBRF_2 | 0xD600;   //0xD600 is UCBRSx = 0xD6
    #else
        # error "Please specify baud rate to 115200 or 9600"
    #endif
    
        UCA0CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
        UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt
    }
    
    //******************************************************************************
    // Device Initialization *******************************************************
    //******************************************************************************
    
    void initGPIO()
    {
        LED_DIR |= LED_PIN;
        LED_OUT &= ~LED_PIN;
    
        // USCI_A0 UART operation
        P1SEL0 |= BIT0 | BIT1;
    
        // Disable the GPIO power-on default high-impedance mode to activate
        // previously configured port settings
        PM5CTL0 &= ~LOCKLPM5;
    }
    
    void initClockTo16MHz()
    {
        // Configure one FRAM waitstate as required by the device datasheet for MCLK
        // operation beyond 8MHz _before_ configuring the clock system.
        FRCTL0 = FRCTLPW | NWAITS_1;
    
        __bis_SR_register(SCG0);    // disable FLL
        CSCTL3 |= SELREF__REFOCLK;  // Set REFO as FLL reference source
        CSCTL0 = 0;                 // clear DCO and MOD registers
        CSCTL1 &= ~(DCORSEL_7);     // Clear DCO frequency select bits first
        CSCTL1 |= DCORSEL_5;        // Set DCO = 16MHz
        CSCTL2 = FLLD_0 + 487;      // set to fDCOCLKDIV = (FLLN + 1)*(fFLLREFCLK/n)
                                    //                   = (487 + 1)*(32.768 kHz/1)
                                    //                   = 16 MHz
        __delay_cycles(3);
        __bic_SR_register(SCG0);                        // enable FLL
        while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1));      // FLL locked
    
        CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK;
    }
    
    //******************************************************************************
    // Main ************************************************************************
    // Enters LPM0 if SMCLK is used and waits for UART interrupts. If ACLK is used *
    // then the device will enter LPM3 mode instead. The UART RX interrupt handles *
    // the received character and echoes it.                                       *
    //******************************************************************************
    
    int main(void)
    {
      WDTCTL = WDTPW | WDTHOLD;                 // Stop Watchdog
    
      initGPIO();
      initClockTo16MHz();
      initUART();
    
    #if UART_MODE == SMCLK_9600
        __bis_SR_register(LPM0_bits + GIE);       // Since ACLK is source, enter LPM0, interrupts enabled
    #else
        __bis_SR_register(LPM0_bits + GIE);       // Since SMCLK is source, enter LPM0, interrupts enabled
    #endif
      __no_operation();                         // For debugger
    }
    
    //******************************************************************************
    // UART Interrupt ***********************************************************
    //******************************************************************************
    
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
      switch(__even_in_range(UCA0IV, USCI_UART_UCTXCPTIFG))
      {
        case USCI_NONE: break;
        case USCI_UART_UCRXIFG:
          while(!(UCA0IFG&UCTXIFG));
          UCA0TXBUF = UCA0RXBUF;
          __no_operation();
          break;
        case USCI_UART_UCTXIFG: break;
        case USCI_UART_UCSTTIFG: break;
        case USCI_UART_UCTXCPTIFG: break;
      }
    }
    

    Ling

  • I don't see an "__enable_interrupt();" anywhere. This is probably what you're running into now.

    ----------------------------------

    > strcat(readCommand, (char *)UCA0RXBUF);

    UCA0RXBUF isn't an array, it's a (scalar) unsigned. This is what you will run into next. You probably want something like:

    > readCommand[i++] = UCA0RXBUF;  // Capture next input byte

    with appropriate guards on "i".

    ----------------------------------

    Unsolicited:

    > free(temperature);

    I don't see where you malloc "temperature". Also (in the case of "set") you free() it twice. This is something you will run into eventually.

  • Thank you so much for help. I forgot "__enable_interrupt()" statement and my version for save the message not was correct.

**Attention** This is a public forum