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.
Hi Techinspired,
To use UART1, you need to do the following steps in your code:
With that in place, you will be able to use UART1 with DMA to transfers as much data as you would want.
Alternatively, if you are fine with not having UART0 connected to your computer, is to simply move the J6/7 jumpers from 'FLASH' to 'BP'. This routes the UART0 signals to the launchpad headers instead of the onboard USB->UART chip. The UART0 signals will then be available at pins 55 and 57.
One other quicker method of using UART1 is to copy the uart_if.c and uart_if.h files, define an EXT_UART symbol as UARTA1_BASE, and then replace every instance of CONSOLE with EXT_UART. You would also have to adjust a few other things such as changing all of the function names to be different from the originals, but this would allow you to use all of the UART helper functions you get in uart_if.c with UART1.
Let me know if you need more help, or if you have a question on what I explained.
Regards,
Michael
Hi Michael,
Thanks a lot for your elaborated reply! You always try to cover every minute detail of query.
I tried suggestion given by you, and gone through the sample examples like uart_demo,uart_dma,udma etc. Right now I'm using only UARTA0 and I need to connect an external device to cc3200 through UART :
1) So my PinMuxConfig() function look like this:
void PinMuxConfig(void) { // // Enable Peripheral Clocks // MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, 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); }
2)
Michael Reymond said:Setup the UART1 interface with a UARTConfigSetExpClk() call with your setup-specific values.
In my case
#define CONSOLE UARTA0_BASE
#define CONSOLE_PERIPH PRCM_UARTA0
MAP_UARTConfigSetExpClk(CONSOLE,MAP_PRCMPeripheralClockGet(CONSOLE_PERIPH), UART_BAUD_RATE, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE));
3) As of now ,I don't want DMA transfer, I only want to receive some string in UART interrupt Handler, so I wrote code like this:
//***************************************************************************** #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> #include <stdint.h> // Driverlib includes #include "rom.h" #include "rom_map.h" #include "hw_memmap.h" #include "hw_common_reg.h" #include "hw_uart.h" #include "hw_types.h" #include "hw_ints.h" #include "uart.h" #include "udma.h" #include "interrupt.h" #include "utils.h" #include "prcm.h" #include "pin.h" // Common interface includes #include "uart_if.h" #include "udma_if.h" #include "pinmux.h" //***************************************************************************** // MACROS //***************************************************************************** #define APPLICATION_VERSION "1.1.1" #define APP_NAME "UART DMA" //***************************************************************************** // GLOBAL VARIABLES -- Start //***************************************************************************** volatile int g_iCounter = 0; #if defined(ccs) extern void (* const g_pfnVectors[])(void); #endif #if defined(ewarm) extern uVectorEntry __vector_table; #endif //***************************************************************************** // GLOBAL VARIABLES -- End //***************************************************************************** //static unsigned char ucTextBuff[50]; //volatile static tBoolean bRxDone; unsigned char ucCharBuffer[50]; uint16_t ui16CharCounter=0; //***************************************************************************** // LOCAL DEFINITION //***************************************************************************** //***************************************************************************** // //! Application startup display on UART //! //! \param none //! //! \return none //! //***************************************************************************** static void DisplayBanner(char * AppName) { Report("\n\n\n\r"); Report("\t\t *************************************************\n\r"); Report("\t\t CC3200 %s Application \n\r", AppName); Report("\t\t *************************************************\n\r"); Report("\n\n\n\r"); } //***************************************************************************** // //! Board Initialization & Configuration //! //! \param None //! //! \return None // //***************************************************************************** static void BoardInit(void) { /* In case of TI-RTOS vector table is initialize by OS itself */ #ifndef USE_TIRTOS // // Set vector table base // #if defined(ccs) MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]); #endif #if defined(ewarm) MAP_IntVTableBaseSet((unsigned long)&__vector_table); #endif #endif // // Enable Processor // MAP_IntMasterEnable(); MAP_IntEnable(FAULT_SYSTICK); PRCMCC3200MCUInit(); } //***************************************************************************** // //! Interrupt handler for UART interupt //! //! \param None //! //! \return None //! //***************************************************************************** static void UARTIntHandler() { unsigned long ulStatus; // unsigned long ulMode; // unsigned long i; // // Read the interrupt status of the UART. // ulStatus = MAP_UARTIntStatus(UARTA0_BASE, 1); // // Clear any pending status, even though there should be none since no UART // interrupts were enabled. // MAP_UARTIntClear(UARTA0_BASE, ulStatus); // // loop while there are characters in the receive FIFO. // i=0; while(UARTCharsAvail(UARTA0_BASE)) { ucCharBuffer[ui16CharCounter]= UARTCharGet(UARTA0_BASE); UARTCharPut(UARTA0_BASE,ucCharBuffer[ui16CharCounter]); ui16CharCounter++; } } //***************************************************************************** // //! Main function handling the UART and DMA configuration. It takes 8 //! characters from terminal without displaying them. The string of 8 //! caracters will be printed on the terminal as soon as 8th character is //! typed in. //! //! \param None //! //! \return None //! //***************************************************************************** void main() { // // Initailizing the board // BoardInit(); // // Clear terminal // ClearTerm(); // // Display Banner // DisplayBanner(APP_NAME); // // Initialize the RX done flash // // bRxDone = false; // // Initialize uDMA // // UDMAInit(); // // Muxing for Enabling UART_TX and UART_RX. // PinMuxConfig(); // // Initialising the Terminal. // MAP_UARTConfigSetExpClk(CONSOLE,MAP_PRCMPeripheralClockGet(CONSOLE_PERIPH), UART_BAUD_RATE, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |UART_CONFIG_PAR_NONE)); MAP_PinTypeUART(PIN_55,PIN_MODE_3); MAP_PinTypeUART(PIN_57,PIN_MODE_3); // // Register interrupt handler for UART // MAP_UARTIntRegister(UARTA0_BASE,UARTIntHandler); // // Enable uart interrupts for uart // MAP_UARTIntEnable(UARTA0_BASE,UART_INT_RX|UART_INT_TX); UARTFIFODisable(UARTA0_BASE); // // Set the message // Message("Type in 8 characters:"); // // Configure the UART Tx and Rx FIFO level to 1/8 i.e 2 characters // UARTFIFOLevelSet(UARTA0_BASE,UART_FIFO_TX1_8,UART_FIFO_RX1_8); // // Enable Rx DMA request from UART // // MAP_UARTDMADisable(UARTA1_BASE,UART_DMA_RX|UART_DMA_RX); while(1) { // // Inifite loop // } } //***************************************************************************** // // Close the Doxygen group. //! @} // //*****************************************************************************
4) I've connected USB to UART chip's TX to pin-55 and RX to pin-57 and jumper J6 and J7 are on BP mode, In my case,COM ports for CC3200LP is COM10 and USB serial port is COM3. SO I open Putty terminal with COM3, But then I get a message: Error Connecting to target in CCS. It seems like, it can't route the UARTA0 signals to Launchpad headers.
5) But when I open Putty with Virtual COM10 with jumper on FLASH mode it works fine ( Works on only UARTA0)
6) In hardware guide of cc3200 they clearly metioned that on pin-3 and pin-4 you can get UARTA0 signal( this is something bit confusing as you also get UARTA0 signal on pin-55 and pin-57) but what should be the jumper setting in each case?
7) Could you please explain, how to connect external USB to UART board / or external device to CC3200 to see output on PUTTY(which should be the COM Port while opening the hyper terminal, whether it should be Launchpad's or USB Serial's COM?
Best Regards,
Techinspired