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.

TI-RTOS and UART0 interrupt HWI in TM4C129 ...

Hi
I'm starting a project in TI-RTOS and have the following problem:

Start the UART0 with the following functions:

...
#define Board_UART0                 VA_TM4C129ENCPDT_UART0
...
#include <ti/drivers/uart/UARTTiva.h>

/* UART objects */
UARTTiva_Object uartTivaObjects[VA_TM4C129ENCPDT_UARTCOUNT];

/* UART configuration structure */
const UARTTiva_HWAttrs uartTivaHWAttrs[VA_TM4C129ENCPDT_UARTCOUNT] = {
    {UART0_BASE, INT_UART0},  /*TM4C1294XL_UART0 */
    {UART2_BASE, INT_UART2}  /* TM4C1294XL_UART2 */
};

const UART_Config UART_config[] = {
    {&UARTTiva_fxnTable, &uartTivaObjects[0], &uartTivaHWAttrs[0]},
    {&UARTTiva_fxnTable, &uartTivaObjects[1], &uartTivaHWAttrs[1]},
    {NULL, NULL, NULL}
};
#endif 

/*
 *  ======== VA_TM4C129ENCPDT_initUART ========
 */
void VA_TM4C129ENCPDT_initUART(void)
{
    /* Enable and configure the peripherals used by the UART0 */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    /* Enable and configure the peripherals used by the UART2 */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART2);
    GPIOPinConfigure(GPIO_PA6_U2RX);
    GPIOPinConfigure(GPIO_PA7_U2TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);
    /* Initialize the UART driver */
#if TI_DRIVERS_UART_DMA
    VA_TM4C129ENCPDT_initDMA();
#endif
    UART_init();
}


// Open port Uart  Debug
void Uart_init_Debug (void)
{
	UART_Params uartParams;
	const char echoPrompt[] = "UART DEBUG OK\r\n";

    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.baudRate = 115200;
    uart0 = UART_open(Board_UART0, &uartParams);

    if (uart0 == NULL) {
        System_abort("Error opening the UART");
    }

    UART_write(uart0, echoPrompt, sizeof(echoPrompt));

}

All right however when I create a HWI with the UART0 interrupt the program stop here:

I think it has to do with the setting "UART_open" but I do not see how I can fix the problem. The same is true the UART2 is for the "interrupt number = 49".

I am a beginner in TI-RTOS, Sorry.

Regards

  • Hi,
    Looks like you're creating the Hwi manually with the interrupt number. You don't have to do that. The UART_open call internally creates a Hwi for that UART. After UART_open you don't have to do anything else. You can begin writing and reading from the UART.

    Let me know if this helps.
    Moses
  • Hi Moses,
    Thank you for your response.
    Yes that was the problem. He is an example of TI.
    I do not know if it's the best way, but now manually configure the uart with these commands:

    void function xpto (void)
    {
    /* Enable and configure the peripherals used by the UART0 */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    UARTConfigSetExpClk(UART0_BASE, g_ui32SysClock, 38400,
    (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
    UART_CONFIG_PAR_EVEN));
    }

    And then start the interrupt by HWI ...
    So already works well. The example of TI (uartecho) sets up really soon so the manual interrupt.
    Let me know if there is another way to set the uart by TI-RTOS.

    Regards

  • Hi Moses, 

    I still learning how to put things together with the TI-RTOS.

    You mentioned: "The UART_open call internally creates a Hwi for that UART. After UART_open you don't have to do anything else."

    How do you access the UART data? Do you need to link the buffers?
    I mean, where the received data will be stored? 
    Do you need to add a semaphore and a Swi for decoding received data?

    Thanks

  • Hi Thiago,
    We generally discourage posting a new question to an old closed thread because the person who answered before may no longer be available, and also it will allow whomever is currently assigned to monitor the forum to respond to you more quickly. For these reasons, I suggest you start a new thread with your question and reference this thread.

    Thank you
  • Hello Kenia,

    I am very sorry for this inconvenience.

    I will start a new thread.

    Thank you for your advice.