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/MSP-EXP430F5529LP: Problems reading RX UART data by interrupt

Part Number: MSP-EXP430F5529LP
Other Parts Discussed in Thread: BOOSTXL-PGA460, PGA460, MSP430WARE, MSP430F5529

Tool/software: Code Composer Studio

Hello,

I am working in a project in an enterprise and I have the TI launchPad Kit with MSP430 MCU and an analog evaluation module - BOOSTXL-PGA460.

I communicate with the PGA460 with a program made in code compose studio.

To develop a program fastly I used a program in Software MSP430ware in the  driver library and adapt it to my case.

The microcontroller in use is the MSP430F5529.

Here is the code I used for my program:

//******************************************************************************
//! This example shows how to configure the UART module as the loopback to
//! verify that received data is sent data.
//!
//!               MSP430F5438A
//!             -----------------
//!       RST -|     P3.4/UCA0TXD|----|
//!            |                 |    |
//!            |                 |    |
//!            |     P3.5/UCA0RXD|----|
//!            |                 |
//!
//!
//! This example uses the following peripherals and I/O signals.  You must
//! review these and change as needed for your own board:
//! - UART peripheral
//! - GPIO Port peripheral (for UART pins)
//! - UCA0TXD
//! - UCA0RXD
//!
//! This example uses the following interrupt handlers.  To use this example
//! in your own application you must add these interrupt handlers to your
//! vector table.
//! - USCI_A0_VECTOR.
//******************************************************************************
#include "driverlib.h"

//*****************************************************************************
//
//Select Baud rate
//
//*****************************************************************************
#define BAUD_RATE                               9600 //JS--

//#define BAUD_RATE                               2400 //JS++ // nota: se eu alterar esta variável
// o débito binário observado no osciloscópio é sempre 9600 bps - para já vou deixar como está
//*****************************************************************************
//
//Initialize received data
//
//*****************************************************************************
uint8_t receivedData = 0x00;
//*****************************************************************************
//
//Initialize trasnmit data
//
//*****************************************************************************
uint8_t transmitData = 0x00;

uint8_t check = 0;

uint8_t i1 = 0 ; //JS++
uint8_t i2 = 0 ; //JS++
uint8_t i3 = 0 ; //JS++

void main (void)
{
    //Stop WDT
    WDT_A_hold(WDT_A_BASE);



      GPIO_setAsOutputPin (GPIO_PORT_P2, GPIO_PIN2); //\ PD como saída

      GPIO_setAsOutputPin (GPIO_PORT_P7, GPIO_PIN4); //porto SEL como saída

      GPIO_setOutputLowOnPin (GPIO_PORT_P2, GPIO_PIN2 ); //coloca pino a zero

      GPIO_setOutputLowOnPin (GPIO_PORT_P7, GPIO_PIN4 ); //coloca pino a zero

      // Fim JS++


      //JS--
      GPIO_setAsPeripheralModuleFunctionInputPin(
          GPIO_PORT_P3,
          GPIO_PIN3 + GPIO_PIN4
          );

      //Fim JS++


      //Fim JS++


      // Pull-up resistor in P3.4  //JS++
      GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P3, GPIO_PIN4); //JS++



    USCI_A_UART_initParam param = {0};
    param.selectClockSource = USCI_A_UART_CLOCKSOURCE_SMCLK;
    param.clockPrescalar = 109;
    param.firstModReg = 0;
    param.secondModReg = 2;
    param.parity = USCI_A_UART_NO_PARITY;
    param.msborLsbFirst = USCI_A_UART_LSB_FIRST;
//    param.numberofStopBits = USCI_A_UART_ONE_STOP_BIT; //JS--
    param.numberofStopBits = USCI_A_UART_TWO_STOP_BITS; //JS--

    param.uartMode = USCI_A_UART_MODE;
    param.overSampling = USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION;

    if (STATUS_FAIL == USCI_A_UART_init(USCI_A0_BASE, &param)){
        return;
    }

    //Enable UART module for operation
    USCI_A_UART_enable(USCI_A0_BASE);

    //Enable Receive Interrupt
      USCI_A_UART_clearInterrupt(USCI_A0_BASE,
        USCI_A_UART_RECEIVE_INTERRUPT);
    USCI_A_UART_enableInterrupt(USCI_A0_BASE,
        USCI_A_UART_RECEIVE_INTERRUPT);

    __enable_interrupt(); //JS--



    transmitData = 0x55;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

    transmitData = 0x0A;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

    transmitData = 0x68;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

    transmitData = 0x42;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

    transmitData = 0x4B;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

for(i2=0; i2<20;i2++)
{
//            for(i3=0;i3<255;i3++)
//            {
   for (i1=0; i1<255;i1++); //JS++
//            }
}

transmitData = 0x55;
// Load data onto buffer
USCI_A_UART_transmitData(USCI_A0_BASE,
        transmitData);

transmitData = 0x09;
// Load data onto buffer
USCI_A_UART_transmitData(USCI_A0_BASE,
        transmitData);

transmitData = 0x68;
// Load data onto buffer
USCI_A_UART_transmitData(USCI_A0_BASE,
        transmitData);

transmitData = 0x8E;
// Load data onto buffer
USCI_A_UART_transmitData(USCI_A0_BASE,
        transmitData);

USCI_A_UART_clearInterrupt(USCI_A0_BASE,
          USCI_A_UART_RECEIVE_INTERRUPT_FLAG);




    while (1)
    {

    transmitData = 0x55;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

    transmitData = 0x09;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

    transmitData = 0x68;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

    transmitData = 0x8E;
    // Load data onto buffer
    USCI_A_UART_transmitData(USCI_A0_BASE,
            transmitData);

    for(i2=0; i2<20;i2++)
    {
//                for(i3=0;i3<255;i3++)
//                {
           for (i1=0; i1<255;i1++); //JS++
//                }
    }


    }
}






#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



{
    i3=0;

    switch (__even_in_range(UCA0IV,4)){
        //Vector 2 - RXIFG
        case 2:
            receivedData = USCI_A_UART_receiveData(USCI_A0_BASE);
//            if(!(receivedData == transmitData))                   // Check value //JS--
//            {                                 //JS--
//              while(1);                       //JS--
//            }                                 //JS--
            check =1;
            break;
        default: break;
    }
}




// -------End of my program

I put a breakpoint inside the __interrupt void USCI_A0_ISR(void) rotine (in the instruction i3=0), in debug mode, and the program never stops here.

I send the signal that I see in RXD and TXD (on the PGA460) respectively:

The last signal is the signal sent by the UART of the PGA to the MSP430, composed of 3 bytes that I never detect in my microcontroller. Why?

Please Help me,

Jose Simoes