The TI E2E™ design support forums will undergo maintenance from Sept. 28 to Oct. 2. If you need design support during this time, contact your TI representative or open a new support request with our customer support center.

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-FR6043: Add a second UART to the USS_Water_Demo?

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

Hi, Can anyone guide or point me to documentation on how to add a second UART to the USS_Water_Demo?

In comms.c/h I've added:

//! \var The UART port definition for the UART driver.
//!
const tUARTPort Comm_uartPort =
{
.pbReceiveCallback = Comm_uartReceiveHandler,
.pbErrorCallback = 0,
.peripheralParameters.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK,
.peripheralParameters.clockPrescalar = UART__PRESCALER,
.peripheralParameters.firstModReg = UART__FIRST_STAGE_MOD,
.peripheralParameters.secondModReg = UART__SECOND_STAGE_MOD,
.peripheralParameters.parity = EUSCI_A_UART_NO_PARITY,
.peripheralParameters.msborLsbFirst = EUSCI_A_UART_LSB_FIRST,
.peripheralParameters.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT,
.peripheralParameters.uartMode = EUSCI_A_UART_MODE,
.peripheralParameters.overSampling = UART__SAMPLING_MODE
};


const tUARTPort Comm_uart2Port =
{
.pbReceiveCallback = Comm_uartReceiveHandler,
.pbErrorCallback = 0,
.peripheralParameters.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK,
.peripheralParameters.clockPrescalar = UART__PRESCALER,
.peripheralParameters.firstModReg = UART__FIRST_STAGE_MOD,
.peripheralParameters.secondModReg = UART__SECOND_STAGE_MOD,
.peripheralParameters.parity = EUSCI_A_UART_NO_PARITY,
.peripheralParameters.msborLsbFirst = EUSCI_A_UART_LSB_FIRST,
.peripheralParameters.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT,
.peripheralParameters.uartMode = EUSCI_A_UART_MODE,
.peripheralParameters.overSampling = UART__SAMPLING_MODE
};

How do I connect Comm_uart2Port to the second port?

Thanks.

  • Hi Edgar,

    Not sure.  Let me dig into this for you.

  • Hi Edgar,

    Ok, on the EVM430-FR6047 you will want to use the EUSCI_A1 (P1.2) JTAG_TXD and (P1.3) JTAG_RXD.  You can tap into these pins on J34.

    To be prevent a conflict of resources with EUSCI_A0, make sure the GUI communications is configured to use I2C (I think this the default) as shown below.

    Then somewhere early in your code enable the UART  by calling UART_openPort(&Comm_uart2Port);

    Then to transmit data, use the driverlib call UART_transmitBuffer(&buffer, length); 

    Don't forget, you will also have to configure P1.2 and P1.3 not as GPIO, but as their secondary function UCA1.

    Hint:

        P1SEL0 |= (GPIO_PIN2 | GPIO_PIN3);
        P1SEL1 &= (GPIO_PIN2 | GPIO_PIN3);

    Dennis

  • Thank you, given it a try, I'll get back to you with the results.

  • Hi Dennis,

    It didn't work - when the I2C mode is selected, initiating the UART in the same module stops the comms all together.

    Switched the COMM_SERIAL_INTERFACE (COMM_UART); (comm_config.h)

    I figure that if I do this I'll be able to initiate my second port without disrupting the comms config. 

    Compiled and loaded code and 

    The connected to USS Design Center:

    Is there anything else I have to do to enable the UART as the COMM_SERIAL_INTERFACE ?

  • I assume you are trying to use the UART to send your own custom data to a terminal application on your PC or another MCU, not re-route the data that ordinarily goes to the GUI - correct?

  • Correct,

    In that way, when I initialize my second UART there will be no conflict with the operation mode of the EUSCI.

  • Ok, let me get mine working here on my desk and I'll update you shortly.

  • Hi Edgar,

    Apparently we are over thinking this.  It turns out there are essentially two different UART drivers included in the example.

    1. One for EUSCI_A0, which allows the target to communicate with the GUI.  These drivers are uart.c, uart.h located under the DesignCenter/comm/drivers path

    2. The other for EUSCI_A1, which is the one you want and allows the target to send and receive whatever you want to the PC.  These drivers are hal_uart.c, hal_uart.h and are located under the hal/fr6047EVM path.

    So to use EUSCI_A1, find the param structure near the top of file hal_uart.c and make any modifications for the clock and baud rate.  The default is 57600 so if you are ok with that, no changes needed.

    Next, before you use the UART, call function hal_uart_Init().  In this function the GPIO configuration for P1.2 and P1.3 are taken care of for you and the UART is configured with the params.

    Then, when you are ready to send data from the target to the PC use function hal_uart_TxByte().  That's it!

    Unfortunately, this function only sends one byte, so not so useful.  But you can either create a loop and call this function for each byte in the data stream you are sending, OR you can improve on this by adding some additional code in the EUSCI_A1 interrupt to handle transmitting the bytes automatically.  Take a look at DesignCenter/comm/drivers/uart.c to see how it is done there as an example.

    Oh, and I did set this up and test it, so it does work ;)

    I hope this helps.

    Additional info:

    USS EVM_6047 communications.pdf

  • Awesome, implementing, I'll get back to you.

  • Been having internet issues, all morning so couldn't reply, IT WORKED.

    Hope I can ask you a few more questions related to CCS, I declare local variables, write code, compiles and when I run debug, the variables window shows nothing?

    Pic is worth 1K Words, TX line on JTAG header. Thanks once again.

  • Hi Edgar,

    Excellent!  Glad we got the UART working.

    When you say the variables window shows nothing, do you mean the values in the variables are not changing?  You have to pause the debug in order to see the variables.  Can you provide a screen capture?

**Attention** This is a public forum