Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

RTOS/MSP432E401Y: XDS110 UART Display using UART1

$
0
0

Part Number:MSP432E401Y

Tool/software: TI-RTOS

My current configuration uses all GPIO pins in port A, but for testing purposes I would still like to receive debug serial output via the xds 110 on the development board.    Therefore I have been trying unsuccessfully to configure UART1 and use pins PB0 and PB1 for display UART RX and TX respectively.   

Here are my UART and Display configurations in the MSP_EXP432E401Y.c file:

/*
 *  =============================== UART ===============================
 */
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTMSP432E4.h>

UARTMSP432E4_Object uartMSP432E4Objects[MSP_EXP432E401Y_UARTCOUNT];
unsigned char uartMSP432E4RingBuffer[MSP_EXP432E401Y_UARTCOUNT][32];

/* UART configuration structure */
const UARTMSP432E4_HWAttrs uartMSP432E4HWAttrs[MSP_EXP432E401Y_UARTCOUNT] = {
    {
        .baseAddr = UART0_BASE,
        .intNum = INT_UART0,
        .intPriority = (~0),
        .flowControl = UARTMSP432E4_FLOWCTRL_NONE,
        .ringBufPtr  = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART0],
        .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART0]),
        .rxPin = /*UARTMSP432E4_PB0_U1RX,*/UARTMSP432E4_PA0_U0RX,
        .txPin = /*UARTMSP432E4_PB1_U1TX,*/UARTMSP432E4_PA1_U0TX,
        .ctsPin = UARTMSP432E4_PIN_UNASSIGNED,
        .rtsPin = UARTMSP432E4_PIN_UNASSIGNED,
        .errorFxn = NULL
    },
    {
        .baseAddr = UART1_BASE,
        .intNum = INT_UART1,
        .intPriority = (~0),
        .flowControl = UARTMSP432E4_FLOWCTRL_NONE,
        .ringBufPtr  = uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART1],
        .ringBufSize = sizeof(uartMSP432E4RingBuffer[MSP_EXP432E401Y_UART1]),
        .rxPin = UARTMSP432E4_PB0_U1RX,//UARTMSP432E4_PA0_U0RX,
        .txPin = UARTMSP432E4_PB1_U1TX,//UARTMSP432E4_PA1_U0TX,
        .ctsPin = UARTMSP432E4_PIN_UNASSIGNED,
        .rtsPin = UARTMSP432E4_PIN_UNASSIGNED,
        .errorFxn = NULL
    }
};

const UART_Config UART_config[MSP_EXP432E401Y_UARTCOUNT] = {
    {
        .fxnTablePtr = &UARTMSP432E4_fxnTable,
        .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART0],
        .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART0]
    },
    {
        .fxnTablePtr = &UARTMSP432E4_fxnTable,
        .object = &uartMSP432E4Objects[MSP_EXP432E401Y_UART1],
        .hwAttrs = &uartMSP432E4HWAttrs[MSP_EXP432E401Y_UART1]
    }
};

const uint_least8_t UART_count = MSP_EXP432E401Y_UARTCOUNT;


/*
 *  ============================= Display =============================
 */
#include <ti/display/Display.h>
#include <ti/display/DisplayUart.h>
#include <ti/display/DisplaySharp.h>
#define MAXPRINTLEN 1024

#ifndef BOARD_DISPLAY_SHARP_SIZE
#define BOARD_DISPLAY_SHARP_SIZE    96
#endif

DisplayUart_Object     displayUartObject;
DisplaySharp_Object    displaySharpObject;

static char displayBuf[MAXPRINTLEN];
//static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];


const DisplayUart_HWAttrs displayUartHWAttrs = {
    .uartIdx = MSP_EXP432E401Y_UART1,
    .baudRate = 115200,
    .mutexTimeout = (unsigned int)(-1),
    .strBuf = displayBuf,
    .strBufLen = MAXPRINTLEN
};

#ifndef BOARD_DISPLAY_USE_UART
#define BOARD_DISPLAY_USE_UART 1
#endif
#ifndef BOARD_DISPLAY_USE_UART_ANSI
#define BOARD_DISPLAY_USE_UART_ANSI 0
#endif
#ifndef BOARD_DISPLAY_USE_LCD
#define BOARD_DISPLAY_USE_LCD 0
#endif

/*
 * This #if/#else is needed to workaround a problem with the
 * IAR compiler. The IAR compiler doesn't like the empty array
 * initialization. (IAR Error[Pe1345])
 */
 #if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
const Display_Config Display_config[] = {
    {
#  if (BOARD_DISPLAY_USE_UART_ANSI)
        .fxnTablePtr = &DisplayUartAnsi_fxnTable,
#  else /* Default to minimal UART with no cursor placement */
        .fxnTablePtr = &DisplayUartMin_fxnTable,
#  endif
        .object = &displayUartObject,
        .hwAttrs = &displayUartHWAttrs
    },
#endif
#if (BOARD_DISPLAY_USE_LCD)
    {
        .fxnTablePtr = &DisplaySharp_fxnTable,
        .object      = &displaySharpObject,
        .hwAttrs     = &displaySharpHWattrs
    },
#endif
};


const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Config);

And here is my UART cfg enum in the MSP432E401Y.h file:

/*!
 *  @def    MSP_EXP432E401Y_UARTName
 *  @brief  Enum of UARTs on the MSP_EXP432E401Y dev board
 */
typedef enum MSP_EXP432E401Y_UARTName {
    MSP_EXP432E401Y_UART0 = 0,
    MSP_EXP432E401Y_UART1,

    MSP_EXP432E401Y_UARTCOUNT
} MSP_EXP432E401Y_UARTName;

I open the display in the main function as follows:

 /* Call driver init functions */
    Board_initGeneral();
    Display_init();

    /* define display for UART console output */
    display = Display_open(Display_Type_UART, NULL);
    if (display == NULL) {
        /* Failed to open display driver */
        while(1);
    }

If I disable my GPIO configurations for Port A pins 0 and 1, and then change my DisplayUart_HWAttrs struct param .uartIdx to MSP_EXP432E401Y_UART0, everything works and I get display output, but changing to MSP_EXP432E401Y_UART1 I no longer receive serial display output. 

Is there a way for me to do what I want?   I couldn't see any info in the documentation references indicating that this is not possible.   

Thanks for any help you can provide.

Patrick


Viewing all articles
Browse latest Browse all 262198

Trending Articles