Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hello,
I am currently developing a project using UART driver in TI-RTOS for MSP430F5529.
I have 2 problems relating to UART driver:
Question 1:
When I configured UART baudrate using different SMCLK frequency than 8192000 Hz, I got the wrong data sent throught UART
+ I configured the SMCLK clockFreq:
BIOS.cpuFreq.lo = 24000000;
ClockFreqs.SMCLK = 24000000;
ClockFreqs.ACLK = 32768;
+ Then I used this tool to calculate baudrate: http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430BaudRateConverter/index.html
+ Even I tried to use lower SMCLK frequency such as 4000000MHz, I still got the error in data.
+ After all, I only got the right data when I use SMCLK freq = 8192000Hz.
+ My UART configuration is based on the configuration in uartecho example for TI-RTOS.
Question 2:
+ I want to use both UART A0 and A1 in MSP430F5529, so what should I do to configure?
I tried this code but I didn't work:
/* * **************************************************************************** * @def MSP430F5529_UARTName * @brief Enum of UART names on the MSP430F5529 */ typedef enum MSP430F5529_UARTName { MSP430F5529_UART_A0 = 0, MSP430F5529_UART_A1 = 1, MSP430F5529_UART_COUNT //Number of UART objects } MSP430F5529_UARTName; /* * ***************************************************************** * @def uartUSCIAHWAttrs * @brief UART hardware attributes */ const UARTUSCIA_HWAttrs uartUSCIAHWAttrs[MSP430F5529_UART_COUNT] = { { .baseAddr = USCI_A0_BASE, .clockSource = USCI_A_UART_CLOCKSOURCE_SMCLK, .bitOrder = USCI_A_UART_LSB_FIRST, .numBaudrateEntries = sizeof(uartUSCIABaudrates)/sizeof(UARTUSCIA_BaudrateConfig), .baudrateLUT = uartUSCIABaudrates }, { .baseAddr = USCI_A1_BASE, .clockSource = USCI_A_UART_CLOCKSOURCE_SMCLK, .bitOrder = USCI_A_UART_LSB_FIRST, .numBaudrateEntries = sizeof(uartUSCIABaudrates)/sizeof(UARTUSCIA_BaudrateConfig), .baudrateLUT = uartUSCIABaudrates } }; /* * ***************************************************************** * @def UART_config * @brief UART configuration list */ const UART_Config UART_config[] = { { .fxnTablePtr = &UARTUSCIA_fxnTable, .object = &uartUSCIAObjects[0], .hwAttrs = &uartUSCIAHWAttrs[0] }, { .fxnTablePtr = &UARTUSCIA_fxnTable, .object = &uartUSCIAObjects[1], .hwAttrs = &uartUSCIAHWAttrs[1] }, {NULL, NULL, NULL} }; void IOSEKPeripheral_openUART(UART_Mode uartMode, MSP430F5529_UARTName uartName) { if(uartMode == UART_MODE_BLOCKING) { //Create a UART with data processing off. UART_Params_init(&uartParams); { uartParams.readMode = UART_MODE_BLOCKING; uartParams.writeMode = UART_MODE_BLOCKING; uartParams.readTimeout = UART_WAIT_FOREVER; uartParams.writeTimeout = UART_WAIT_FOREVER; uartParams.readCallback = NULL; uartParams.writeCallback = NULL; uartParams.readReturnMode = UART_RETURN_FULL; uartParams.readDataMode = UART_DATA_BINARY; uartParams.writeDataMode = UART_DATA_BINARY; uartParams.readEcho = UART_ECHO_OFF; uartParams.baudRate = 115200; uartParams.dataLength = UART_LEN_8; uartParams.stopBits = UART_STOP_ONE; uartParams.parityType = UART_PAR_NONE; } } }