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.

LAUNCHXL-CC2640R2: UART communication in cc2640r2 launchxl

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: CC2640R2F

Hi,

I am using LAUNCHXL-CC2640R2 launchpad. We are able to trasmit data to the processor while we are using level translater and it converts 3.3 v to 1.8 v since processor uart is working on 1.8v but we are not able to recieve data from processor. but when i am trying from U2UC board i am able to communicate.can you please review my code as follows:


void UART_readCallBack(UART_Handle handle, void *ptr, size_t size )
{

// Copy bytes from RX buffer to TX buffer
for(size_t i = 0; i < 55; i++)
SendData[i] = ((uint8_t*)recv_buf)[i];

UART_read(SbpUartHandle, recv_buf, 50);
}

void UART_Configuration()
{
uint16_t n;
// Initialize the UART driver.
UART_Params_init(&SbpUartParams);
SbpUartParams.writeDataMode = UART_DATA_BINARY;
SbpUartParams.readDataMode = UART_DATA_BINARY;
SbpUartParams.readMode = UART_MODE_CALLBACK;
SbpUartParams.writeMode = UART_MODE_BLOCKING;
SbpUartParams.readCallback = &UART_readCallBack;
SbpUartParams.readEcho = UART_ECHO_ON;
SbpUartParams.baudRate = 115200;

// Open an instance of the UART drivers
SbpUartHandle = UART_open(CC2640R2_LAUNCHXL_UART0, &SbpUartParams);

if (SbpUartHandle == NULL) {
/*UART open failed */
}
UART_write(SbpUartHandle, "UART CONFIG\n\r", 13);
// Loop forever echoing

UART_read(SbpUartHandle, &n, 1);
UART_write(SbpUartHandle, &n, 1);
}

  • Hi Samiksha,

    It's possible that the handle isn't valid; I'd verify that it is indeed not NULL.

    Also, note that the UART driver implementation for CC2640R2F has limitations, see: software-dl.ti.com/.../_u_a_r_t_c_c26_x_x_8h.html

    The ECHO option shouldn't be working - otherwise, it looks like you're doing everything correctly. I'd also take a look at the UART echo example included with TI RTOS and make sure that example works correctly. You can find it <SDK>\examples\rtos\CC2640R2_LAUNCHXL\drivers

    Hope this helps,
    Rebel
  • Hi,

    I think your UART_readCallBack() is wrong. How do you pass the received data to recv_buf? Also recv_buf SbpUartParams.writeMode should be set to UART_MODE_CALLBACK.

    - kel