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.

RTOS/LAUNCHXL-CC2650: CC2650 UART TX callback failed

Part Number: LAUNCHXL-CC2650
Other Parts Discussed in Thread: CC2650

Tool/software: TI-RTOS

I want the CC2650 get into the Uart_Tx_callback();when finish  transmit one byte, it success to get into the Uart_Rx_callback(); But fail to get into the Uart_Tx_callback(); so what's wrong?

uint8_t rxBuf[5];
uint8_t txBuf[5]={0x55};
void Uart_TX_callback(UART_Handle uart_handler, void *buf, size_t count)
{
  LEDG_TOGGLE();
}
Uart_RX_callback(UART_Handle uart_handler, void *buf, size_t count)
{
  LEDR_TOGGLE();
}
void taskUartFxn(void)
{
  UART_Params Uart_params;
  UART_Params_init(&Uart_params);
  
  Uart_params.readMode = UART_MODE_CALLBACK;
  Uart_params.writeMode = UART_MODE_CALLBACK;
  Uart_params.writeDataMode = UART_DATA_BINARY;
  Uart_params.readDataMode = UART_DATA_BINARY;
  Uart_params.readReturnMode = UART_RETURN_FULL;
  Uart_params.readCallback = (UART_Callback)Uart_RX_callback;
  Uart_params.writeCallback = (UART_Callback)Uart_TX_callback;
  Uart_params.readEcho = UART_ECHO_OFF;
  Uart_params.baudRate = 57600;
  Uart_params.dataLength = UART_LEN_8;
  Uart_params.stopBits = UART_STOP_ONE;
  
  Uart_handle = UART_open(Board_UART, &Uart_params);
  if(Uart_handle == NULL)
  {
    while(1);
  }
  UART_control(Uart_handle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL))
  if(Uart_handle == NULL)
  {
    while(1)
  }
 while(1)
 {
     UART_write(Uart_handle,txBuf,1);
     UART_read(Uart_handle,rxBuf,1);
 }
is there a code example ? 
thanks!
  • Hi,

    Can you try writing 16 bytes and see if you get the TX interrupt?

    Best wishes
  • thank you!

    i change the code:

    uint8_t rxBuf[16];
    uint8_t txBuf[16]={0x55};
    while(1)
     {
         UART_write(Uart_handle,txBuf,16);
         UART_read(Uart_handle,rxBuf,16);
     }
    but it still can't get into the Uart_TX_callback.can you give me one example?
  • I solved the problem.
    i add a delay();before the UART_write(Uart_handle,txBuf,16); then it get into the Uart_TX_callback, the delay time must greater than or equal to one bytes time, so it will get into the Uart_TX_callback when it finish transmit a set of date. but i want get into the Uart_TX_callback immediately  after transmit one byte, so How to achieve this function?

  • i connect the TX pin to Rx.

    The red line is the Rx callback LEDR_TOGGLE(); the blue is the TX pin, and the green is the Tx callback LEDG_TOGGLE(); 

    so it not gets into the Uart_TX_callback after finish the transmit,there is a delay,about 180us.

    and it also has a delay (27us) to get into the Uart_RX_callback after finish the transmit.

    i try to change the IFLS.RXSEL and the IFLS.TXSEL, and the IMSC.TXIM、IMSC.RXIM,there is no improvement.

    so, does the CC2650 UART can achieve this function? 

  • Hi,

    You would have to disable the FIFOs to get an interrupt for every byte by commenting out the following code in the driver:

    /* Enable UART FIFOs */
    //HWREG(UART0_BASE + UART_O_LCRH) |= UART_LCRH_FEN;

    Best wishes