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: SERIAL UART A not transmiting

Part Number: EVM430-FR6047


Hi,

Brief: Serial eUSCI_A0 does not transmit any serial data to host PC. 

I have started developing with the EVM and tried to configure and use serial UART on eUSCI_A0. On the EVM it should communicate thru the ezFET once the pins on header J2 are populated (shown below): 

I have configured eUSCI_A0 register as shown:

void serial_init(void)
{

    EUSCI_A_UART_initParam param = {0};
    param.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK; //SMCLK=> (DCO)16MHz/DIVS_4 -------- ACLK=LFXTCLK=37.768 Khz
    param.clockPrescalar = 69; //57600 on 4 MHZ
    param.firstModReg = 0;
    param.secondModReg = 4;
    param.parity = EUSCI_A_UART_NO_PARITY;
    param.msborLsbFirst = EUSCI_A_UART_LSB_FIRST;
    param.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT;
    param.uartMode = EUSCI_A_UART_MODE;
    param.overSampling = EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION;

// Sets P2SEL1.x GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P2, GPIO_PIN0 + GPIO_PIN1, GPIO_SECONDARY_MODULE_FUNCTION);// P2.0 UCA0TXD and P2.1 UCA0RXD if (STATUS_FAIL == EUSCI_A_UART_init(EUSCI_A0_BASE, &param)) { return; } PMM_unlockLPM5(); EUSCI_A_UART_enable(EUSCI_A0_BASE); EUSCI_A_UART_clearInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT); EUSCI_A_UART_clearInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_TRANSMIT_INTERRUPT); EUSCI_A_UART_enableInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_TRANSMIT_INTERRUPT); // Enable interrupt // Enable USCI_A0 RX interrupt EUSCI_A_UART_enableInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT); // Enable interrupt __enable_interrupt(); }


Here is the clock init routine:

void clock_init(void)
{
/*
* Configure CS module
* MCLK = 16 MHz from DCOCLK
* SMCLK = 8MHz from DCOCLK
* ACLK = LFXTCLK 32.768 KHz
*/
// Unlock CS registers
CSCTL0_H = CSKEY >> 8;

// Set DCO to 16MHz
CSCTL1 = DCORSEL | DCOFSEL_4;

// SELA selects ACLK source
// SELS selects SMCLK source
// SELM selects MCLK source
// For EVM HFXCLK = 8MHz, LFXCLK = 32.768 kHz,
// Set ACLK = LFXTCLK, SMCLK = DCO, MCLK = HFXTCLK
CSCTL2 = SELA__LFXTCLK | SELS__DCOCLK | SELM__HFXTCLK;

// DIVA selects ACLK source divider
// DIVS selects SMCLK source divider
// DIVM selects MCLK source divider
CSCTL3 = (DIVA__1 | DIVS__4 | DIVM__1);

CSCTL4 &= (HFXTDRIVE_0);
CSCTL4 &= (HFXTBYPASS_0);
CSCTL4 |= (HFFREQ_1);
CSCTL4 |= (LFXTDRIVE_3);
CSCTL4 |= (LFXTBYPASS_0);

CSCTL4 &= ~(HFXTOFF);
CSCTL4 &= ~(LFXTOFF);

// Lock CS register
CSCTL0_H = 0; //
}

On debug the UCA0 Registers are shown below:

MAIN:

uint8_t RXData = 0, TXData = 0;
uint8_t check = 0;

int main(void) {
   uint32_t i = 0;
   TXData = 0x01;
while(1){ serial_trasmitDataByte(TXData); // TXData = TXData+1; for(i = 0; i < 100000; i++); GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0); } return (0); }


//****************************************************************************** // //This is the USCI_A0 interrupt vector service routine. // //****************************************************************************** #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USCI_A0_VECTOR __interrupt #elif defined(__GNUC__) __attribute__((interrupt(USCI_A0_VECTOR))) #endif void USCI_A0_ISR(void) { switch(__even_in_range(UCA0IV,USCI_UART_UCTXCPTIFG)) { case USCI_NONE: break; case USCI_UART_UCRXIFG: RXData = EUSCI_A_UART_receiveData(EUSCI_A0_BASE); if(!(RXData == TXData)) // Check value { while(1); } check =1; break; case USCI_UART_UCTXIFG: TXData = TXData+1; break; } }

The interruption is running as expected, but I receive no data on the host PC serial communication. Am I missing something??


Also tried using the MSPWARE example (msp430fr60x7_euscia0_uart_03.c) code with no success. Same happens, registers are configured but no data is received

  • Hi Marcos,

    It seems there are difference between the board you used and the Design files on home page of the EVM430-FR6047. Could you confirm where did you get the board and when?

    Referring to the current design schematics of EVM430-FR6047(EVM430-FR6047 Schematics (Rev. B)), the J3 on the schematics should be the J2 on your board. So, the TX and RX pins you used should be UCA1TXD and UCA1RXD. But in your code, you just configured the UCA0 instead of UCA1. 

    if (STATUS_FAIL == EUSCI_A_UART_init(EUSCI_A0_BASE, &param)) {

    You may need to update your code for UCA1. Or you could use the RXD and TXD pins on J5 of your board, which are for UCA0RXD and UCA0TXD.

  • Hi Wei,

    Thanks for the reply and support!

    I got it from Texas' Team in Brazil about a month ago.

    I changed the code to EUSCI_A1_BASE. Now I receive the serial data correctly as RX(Remote) seems to be working. TX is still not working. Data is placed in the UCA1TXBUF, but never received in the software at host.

    Transmit interruption still works. 

    Since the data sent via terminal(host) and received by the MSP is correct, I assume connections and configuration are now correct. Now what is wrong with TX?

    Best Regards

  • What does serial_trasmitDataByte() look like? By the time you reach it, TXIFG isn't set. Does that cause any trouble?
  • Bruce,

    the serial_trasmitDataByte() is basically an encapsulation of a driverlib method:

    #define SERIAL_PERIF_ADDR           EUSCI_A1_BASE
    
    /**
     * @brief
     *      Transmits one byte through previously configured interface
     */
    void serial_trasmitDataByte(uint8_t uc_txData)
    {
        EUSCI_A_UART_transmitData(SERIAL_PERIF_ADDR, uc_txData);
    }
    
    void EUSCI_A_UART_transmitData (uint16_t baseAddress, uint8_t transmitData)
    {
        //If interrupts are not used, poll for flags
        if (!(HWREG16(baseAddress + OFS_UCAxIE) & UCTXIE)){
            //Poll for transmit interrupt flag
            while (!(HWREG16(baseAddress + OFS_UCAxIFG) & UCTXIFG));
        }
    
        HWREG16(baseAddress + OFS_UCAxTXBUF) = transmitData;
    }

    Bruce McKenney47378 said:
    By the time you reach it, TXIFG isn't set. Does that cause any trouble?

    This is true. For the first byte it is not set but it gets set in the sequence. So it should work on the following bytes. 

     

  • In practice, TXIFG will never be set here, since the ISR clears it as fast as it gets set. But, as you say, this function doesn't care about TXIFG (as long as TXIE is set).

    So I guess we're back to the Usual Suspects: Wiring, P1SELx, typos in your changes. What is your program doing when you pause it?
  • Basically I am adding +1 to a variable as transmission interruption occurs or attributing the received data to same variable. Also toggling a led to show each transmission. See below:

    int main(void) {
    uint32_t i = 0;
    
        TXData = 0x01;
        while(1){
            serial_trasmitDataByte(TXData);
            GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0);
            for(i = 0; i < 1000000; i++);
        }
    
        return (0);
    }
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=USCI_A1_VECTOR
    __interrupt
    #elif defined(__GNUC__)
    #endif
    void USCI_A1_ISR(void)
    {
      switch(__even_in_range(UCA1IV,USCI_UART_UCTXCPTIFG))
      {
        case USCI_NONE: break;
        case USCI_UART_UCRXIFG:
          TXData = EUSCI_A_UART_receiveData(EUSCI_A1_BASE);
          break;
        case USCI_UART_UCTXIFG:
            TXData += 1;
            break;
        case USCI_UART_UCSTTIFG: break;
        case USCI_UART_UCTXCPTIFG: break;
      }
    }

    Breakpoints work on RX and TC 

    Here is the configuration of P1SEL1.2 (TX) and P1SEL1.3 (RX). As info from datasheet, they should be set for UART transmission and P1SEL0 should be cleared.
    I don't know which state should the P1DIR registers should be but they are supposed to be configured once the EUSCI_A1 is set. 

    The program runs as normal. Executes serial_trasmitDataByte() then toggles led and transmit interruption routine. 

    Regarding wiring it is basically the eZ-Fet USB debugger that comes with the EVM. Jumpers are placed and data sent from host to remote is successfully received. 

  • As I read the data sheet [SLASEB7B] Table 6-26, the SEL0 bits should be 1 and the SEL1 bits 0. (This is opposite to UCA0/P2.0-1.) I'm not quite sure how your Rx is working.
  • Marcos,

    We also have a UART example in the demo application below.

    software-dl.ti.com/.../index_FDS.html

    In the hal folder, you will find hal_uart.c and hal_uart.h, which provide a UART interface on P1.2(TX) and P1.3(RX) at 57,600 baud.

    If this is communicating with a PC, make sure you have the correct baud rate settings on the PC side as well. Let me know if you are able to get this example working.

**Attention** This is a public forum