Other Parts Discussed in Thread: CC3220SF
Tool/software: TI C/C++ Compiler
Playing for the first time with the TI C compiler, I'm trying to set up the UART like in some examples.
I also read the documentation about UART functions but I still have a problem.
When I call Uart_open() it returns NULL - hence it fails. The code is VERY simple and I'm running it on the CC3220SF-LAUNCHXL board.
int main(void) { static UART_Handle uartHandle; PRCMCC3200MCUInit(); Power_init(); GPIO_init(); UART_Params uartParams; UART_init(); 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; uartHandle = UART_open(Board_UART0, &uartParams); if (uartHandle == NULL) { GPIO_write(Board_GPIO_LED_RED, 1); for (;;) {} } }
Here the configuration of the board:
typedef enum CC3220SF_LAUNCHXL_UARTName { CC3220SF_LAUNCHXL_UART0 = 0, CC3220SF_LAUNCHXL_UART1, CC3220SF_LAUNCHXL_UARTCOUNT } CC3220SF_LAUNCHXL_UARTName; #define Board_UART0 CC3220SF_LAUNCHXL_UART0 #include <ti/drivers/UART.h> #include <ti/drivers/uart/UARTCC32XX.h> UARTCC32XX_Object uartCC3220SObjects[CC3220SF_LAUNCHXL_UARTCOUNT]; unsigned char uartCC3220SRingBuffer[CC3220SF_LAUNCHXL_UARTCOUNT][32]; const UARTCC32XX_HWAttrsV1 uartCC3220SHWAttrs[CC3220SF_LAUNCHXL_UARTCOUNT] = { { .baseAddr = UARTA0_BASE, .intNum = INT_UARTA0, .intPriority = (~0), .flowControl = UARTCC32XX_FLOWCTRL_NONE, .ringBufPtr = uartCC3220SRingBuffer[CC3220SF_LAUNCHXL_UART0], .ringBufSize = sizeof(uartCC3220SRingBuffer[CC3220SF_LAUNCHXL_UART0]), .rxPin = UARTCC32XX_PIN_57_UART0_RX, .txPin = UARTCC32XX_PIN_55_UART0_TX, .ctsPin = UARTCC32XX_PIN_UNASSIGNED, .rtsPin = UARTCC32XX_PIN_UNASSIGNED }, { .baseAddr = UARTA1_BASE, .intNum = INT_UARTA1, .intPriority = (~0), .flowControl = UARTCC32XX_FLOWCTRL_NONE, .ringBufPtr = uartCC3220SRingBuffer[CC3220SF_LAUNCHXL_UART1], .ringBufSize = sizeof(uartCC3220SRingBuffer[CC3220SF_LAUNCHXL_UART1]), .rxPin = UARTCC32XX_PIN_08_UART1_RX, .txPin = UARTCC32XX_PIN_07_UART1_TX, .ctsPin = UARTCC32XX_PIN_UNASSIGNED, .rtsPin = UARTCC32XX_PIN_UNASSIGNED } }; const UART_Config UART_config[CC3220SF_LAUNCHXL_UARTCOUNT] = { { .fxnTablePtr = &UARTCC32XX_fxnTable, .object = &uartCC3220SObjects[CC3220SF_LAUNCHXL_UART0], .hwAttrs = &uartCC3220SHWAttrs[CC3220SF_LAUNCHXL_UART0] }, { .fxnTablePtr = &UARTCC32XX_fxnTable, .object = &uartCC3220SObjects[CC3220SF_LAUNCHXL_UART1], .hwAttrs = &uartCC3220SHWAttrs[CC3220SF_LAUNCHXL_UART1] } }; const uint_least8_t UART_count = CC3220SF_LAUNCHXL_UARTCOUNT;
Please, would you help me to understand why it fails?