Tool/software: Code Composer Studio
Please explain how to use the UART_readPolling function.
I modified the echo example of the UART_read blocking to UART_readPolling, but it can't receive any data then.
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.
Tool/software: Code Composer Studio
Please explain how to use the UART_readPolling function.
I modified the echo example of the UART_read blocking to UART_readPolling, but it can't receive any data then.
Hi,
It seems this functionality is presently not supported.
dev.ti.com/.../_u_a_r_t_c_c26_x_x_8h.html
Regards,
Hi,
I am not sure when this will come about. However, you can use the register level driverlib APIs to write a polling UART driver.
See code below.
// UART pinmapping #define EXAMPLE_PIN_UART_RXD IOID_2 #define EXAMPLE_PIN_UART_TXD IOID_3 #define EXAMPLE_PIN_UART_CTS IOID_UNUSED #define EXAMPLE_PIN_UART_RTS IOID_UNUSED int UARTinit(void){ PRCMPowerDomainOn(PRCM_DOMAIN_SERIAL); while(!(PRCMPowerDomainStatus(PRCM_DOMAIN_SERIAL) == PRCM_DOMAIN_POWER_ON)) { } // // Enable the UART clock // PRCMPeripheralRunEnable(PRCM_PERIPH_UART0); // // Apply clock settings and wait for them to take effect // PRCMLoadSet(); while(!PRCMLoadGet()) { } // // Disable UART function // UARTDisable(UART0_BASE); // // Disable all UART module interrupts // UARTIntDisable(UART0_BASE, UART_INT_OE | UART_INT_BE | UART_INT_PE | UART_INT_FE | UART_INT_RT | UART_INT_TX | UART_INT_RX | UART_INT_CTS); // // Map UART signals to the correct GPIO pins and configure them as // hardware controlled. // IOCPinTypeUart(UART0_BASE,EXAMPLE_PIN_UART_RXD,EXAMPLE_PIN_UART_TXD, EXAMPLE_PIN_UART_CTS,EXAMPLE_PIN_UART_RTS); // // Configure the UART for 115,200, 8-N-1 operation. // This function uses SysCtrlClockGet() to get the system clock // frequency. This could be also be a variable or hard coded value // instead of a function call. // UARTConfigSetExpClk(UART0_BASE, GET_MCU_CLOCK, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); // // Enable UART // UARTEnable(UART0_BASE); }
You can use the following APIs for the communication:
cThisChar = UARTCharGet(UART0_BASE);
UARTCharPut(UART0_BASE, cThisChar);
Thanks.