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.

CC2652P: Failed to achieve UART receiver in call-back mode - CC2652P

Part Number: CC2652P
Other Parts Discussed in Thread: SYSCONFIG, Z-STACK

Hello Everyone
Greetings of the day..!!

Project Used: zr_sw_ota_client (CCS version)

Stack Version:

SoC: CC2652P

I have configured the UART receiver in call-back mode when I run the code call-back function is not executing.

If anyone facing the same issue or knows the solution please help me with this.

here is my UART configuration:

#define UART_DATA_EVENT 0x0100

static UART_Handle uartHandle;

static UART_Params uartParams;


uartParams.readMode = UART_MODE_CALLBACK;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readCallback = &customUartCb;
uartParams.baudRate = 115200;
uartHandle = UART_open(PPL_CNT_UART, &uartParams);

if (uartHandle == NULL)
printf("Uart handle is null\n");

Call back definition: 

void customUartCb(UART_Handle uartHandle, void *buff, size_t size)
  appServiceTaskEvents |= UART_DATA_EVENT;
   printf("uart call back is triggred\n");

  • Hello Lokesh,

    What are your SysConfig UART settings, are you using a LAUNCHXL-CC1352P-2 project, and did you disable the CUI?


  • Hello Ryan Brown1

    Thanks for replying 

    I am using the  LAUNCHXL-CC1352P-2 project and the CUI_DISABLE preprocessor flag is disabled, Please refer the attached image of my uart configuration.UART Configuration

  • Hi Lokesh,

    It appears that you are using the "Custom Board" option in SysConfig.  Pins 28 and 29 are DIO_18 and DIO_19 used as the RTS and CTS pins, respectively, on the LAUNCHXL-CC1352P-2.  If you are using a custom board then please check your UART RX/TX lines with an oscilloscope or logic analyzer to make sure that the signals are being properly received/transmitted.


  • Hi Ryan Brown1

    UART with blocking mode is working fine, UART with callback mechanism is not working.
    If UART signals are not being properly transmitted then I hope UART in blocking shouldn't work right?

  • Thanks for providing that additional information.  In this scenario it would appear that the hardware is properly connected and the pins are initialized correctly.  How are you using UART_read in your application?  Have you tried modifying the uartecho example as a test or considered evaluating the UART2 Driver (uart2callback) instead?  This would help confirm whether Z-Stack is involved.


  • No I am not modified the uartecho example, here is my uart configuration

    UART Configuration:

      customUartParams.baudRate = 115200;
      customUartParams.readEcho= UART_ECHO_OFF;
      customUartHandle = UART_open(custom_uart, &customUartParams);
      if(customUartHandle != NULL)
          printf("UART init ok \n");

    As per my understanding and the configuration when there is data available on the UART RX line the call back (customUartRead) should get fired but it does not happen, control is never reaching the call back.

    Every time I run the code UART initialization is successful.

    Call back function definition:

    static uint8_t buffer[1]={0};
    static void customUartRead (UART_Handle customUartHandle, void *buff, size_t count)
        printf("number bytes read: %d\n",UART_read(customUartHandle, &buffer, 1));
        printf("data read: %d\n", buffer[0]);

    Please let me the reason why the call back is not firing or any mistake in configuring the UART.

  • Your initialization appears to be fine, I believe your confusion is that UART_read has been placed in the customUartRead as if the function should come after the UART callback executes.  However, the TI Driver is designed such that UART_read should be called in preparation for customUartRead and again after each use of the callback.  The callback allows you to recognize that the buffer has been filled with received data.  You can review the Z-Stack CUI application examples and uart2callback for reference.


  • Why do you execute "printf" in "customUartCb"? Callback is soft-interrupt-service-routines, it is really interrupt-service-routines, so "printf" and "Semaphore_post" is better not running in it.

  • Then you should execute "UART_read" after "UART_open".

    UART_read in callback mode means setting a buffer to receive data when callback execute. If you have received data in callback, you should execute "UART_read" again for next receiving.

  • Aries Lord
    Greetings of the day..!!

    I want to make sure my call back is getting executed when there is a data in UART RX line, that is the reason for printf statments.

  • Hi Lokesh,

    If your issue is not resolved after following Aries and I's suggestions, please provide further updates with the altered code which you've tried.


  • Hello Ryan Brown1
    Still my issue is not resolved, My uart call back (customUartRead - defined by me) registered is not getting executed, Please suggest what should be the call back function definition.

  • Have you placed UART_read after UART_open?  Did you try uart2callback and/or modify it for the UART driver?