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.

CC2642R: UART2使用问题

Part Number: CC2642R


使用UART2出现如下问题,有什么相应的解决方法吗

    UART2_Params params;
    UART2_Params_init(&params);
    params.baudRate = 115200;
    params.readMode = UART2_Mode_BLOCKING;
    params.writeMode = UART2_Mode_BLOCKING;

    // Open the UART
    UART2_Handle uart;
    uart = UART2_open(0, &params);

    // Enable receiver, inhibit low power mode
    UART2_rxEnable(uart);

    // Read from the UART.
    size_t  bytesRead;
    uint8_t buffer[4];
    int32_t status;
    status = UART2_read(uart, buffer, 4, &bytesRead);  //  status为-9  
                                                                /*!
                                                                 * @brief  The UART is currently in use.
                                                                 */
                                                               // #define UART2_STATUS_EINUSE (-9)

  • 您好,

    UART2_STATUS_EINUSE通常是

    1.其他任务或线程正在使用UART2通道并未正确释放资源

    2.串口通信中断或者错误导致UART通道没有正常关闭

    针对1,您可以检查任务调用

    针对2,您可以尝试重新初始化UART2配置