Dear experts,
Requirement is to have UART1 and UART0 to be working simultaneosuly. Understand that this is a basic question, but struggling to get this up. I have gone through the following posts; did not help:
https://e2e.ti.com/support/wireless_connectivity/f/968/t/355721
https://e2e.ti.com/support/wireless_connectivity/f/968/t/400467
https://e2e.ti.com/support/wireless_connectivity/f/968/t/424581
My set-up:- wlan_station example code is taken as-is. UART0 will be used as-is (Jumpers no changes with J6 and J7 in place) to print to terminal and UART1 will be connected to another board (myboard) to receive packets.
Some of the differences from the above posts are:
a. PIN_01 and PIN_02 are used for I2C interface in my example and hence cannot be used for UART1. I am using PIN_07 and PIN_08.
b. Uart Tx and Rx are handled in a separate task; there are two tasks:- (a) Wlan task and (b) Uart Task. For testing purposes, first I have not connected myboard and only CC3200 Launchpad board is used for testing with this software modifications for UART1.
Questions are:
a. I keep on receiving junk characters, eventhough nothing is connected to the CC3200LP. Can you please check? code snippet and log below
b. After using the PinMux utility for all the requirements, generated the pin_mux_config.c and using it as pinmux.c. Hope no other header or source files to be updated in the build environment?
Code changes below:
uart_if.h
#define DEVICE UARTA1_BASE
#define DEVICE_PERIPH PRCM_UARTA1
uart_if.c
void
InitTerm()
{
#ifndef NOTERM
//configure the uart0 for terminal
MAP_UARTConfigSetExpClk(CONSOLE,MAP_PRCMPeripheralClockGet(CONSOLE_PERIPH),
UART_BAUD_RATE, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
//configure the uart1 for DEVICE
MAP_UARTConfigSetExpClk(DEVICE,MAP_PRCMPeripheralClockGet(DEVICE_PERIPH),
UART_BAUD_RATE, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
UART_CONFIG_PAR_NONE));
#endif
__Errorlog = 0;
}
pinmux.c:
void
PinMuxConfig(void)
{
//
// Enable Peripheral Clocks
//
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
MAP_PRCMPeripheralClkEnable(PRCM_UARTA1, PRCM_RUN_MODE_CLK);
//
// Configure PIN_55 for UART0 UART0_TX
//
MAP_PinTypeUART(PIN_55, PIN_MODE_3);
//
// Configure PIN_57 for UART0 UART0_RX
//
MAP_PinTypeUART(PIN_57, PIN_MODE_3);
//
// Configure PIN_07 for UART1 UART1_TX
//
MAP_PinTypeUART(PIN_07, PIN_MODE_5);
//
// Configure PIN_08 for UART1 UART1_RX
//
MAP_PinTypeUART(PIN_08, PIN_MODE_5);
//
// Configure PIN_64 for GPIOOutput
//
MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
//
// Configure PIN_01 for GPIOOutput
//
MAP_PinTypeGPIO(PIN_01, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x4, GPIO_DIR_MODE_OUT);
//
// Configure PIN_02 for GPIOOutput
//
MAP_PinTypeGPIO(PIN_02, PIN_MODE_0, false);
MAP_GPIODirModeSet(GPIOA1_BASE, 0x8, GPIO_DIR_MODE_OUT);
}
main.c:
a. In Void main()
// create a separate thread for reading UART
lRetVal = osi_TaskCreate(basic_Interpreter,(signed char *)"uart", OSI_STACK_SIZE, NULL, 1, NULL);
if(lRetVal < 0)
{
ERR_PRINT(lRetVal);
LOOP_FOREVER();
}
b.
#define UartReadChar() MAP_UARTCharGet(DEVICE)
#define UartAddChar(c) MAP_UARTCharPut(DEVICE,c)
c.
void basic_Interpreter(void *pvParameters);
void basic_Interpreter(void *pvParameters)
{
while(1)
{
if(MAP_UARTCharsAvail(DEVICE) == true)
{
UART_PRINT("\n\rRxChar: %c",UartReadChar());
}
}
}
Teraterm output (partially as the same continues):
ÿ
*************************************************
CC3200 WLAN STATION Application
*************************************************
Host Driver Version: 1.0.0.10
Build Version 2.4.7.2.31.1.3.4.1.1.5.3.34
RxChar:
RxChar:
RxChar: þ
RxChar:
RxChar:
RxChar:
RxChar:
RxChar:
RxChar:
RxChar:
RxChar:
RxChar: ô
RxChar:
RxChar:
RxChar:
RxChar:
RxChar:
RxChar: ø
RxChar:
RxChar:
RxChar:
RxChar:
RxChar: ÿ
RxChar:
RxChar:
RxChar:
RxChar: ð
RxChar:
RxChar:
RxChar: ü
RxChar:
RxChar:
RxChar: À
RxChar:
RxChar:
RxChar:
RxChar:
RxChar: þ
RxChar:
Regards
Sandeep.