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 open fail

Part Number: LAUNCHXL-CC2640R2

SDK4.40, IAR8.3

C:\ti\simplelink_cc2640r2_sdk_4_40_00_10\examples\rtos\CC2640R2_LAUNCHXL\ble5stack\simple_peripheral

I have minimum change, add macro

BOARD_DISPLAY_USE_LCD=0

BOARD_DISPLAY_USE_UART=0

Display_DISABLE_ALL

then open uart:

void UartInit()
{
    UART_init();
    UART_Params uartParams;
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;//----数值模式
    uartParams.readDataMode = UART_DATA_BINARY;//-----数值模式
    uartParams.readMode = UART_MODE_CALLBACK;//-------串口读取回调模式
    uartParams.readCallback  = uartReadCallBack;//----串口读取回调函数指针
    uartParams.writeMode =  UART_MODE_CALLBACK;//-----需将串口发送也设置为回调模式,否则在串口发送回调函数中使用UART_write()会有死机风险
                                               //-----原因可能是在串口回调函数中不能执行用会导致阻塞的操作
    uartParams.writeCallback = uartWriteCallBack;//---串口发送回调函数指针,不能为NULL
    uartParams.baudRate = 9600;//-------------------波特率
    uart = UART_open(Board_UART0, &uartParams);
    if(uart == NULL){
      IOAction(IO_LED_R,1);
      return;
    }
    IOAction(IO_LED_G,1);
}

whole project zip here:

http://qpic.xuan-chi.com/uPic/simple_peripheral-testuart0.zip

test result: fail. red led lights on.

see attached picture: