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.

CC1312R: 无法使用UART的UART_RETURN_NEWLINE功能

Part Number: CC1312R

我在使用CC1312测试UART功能的时候发现无法使用UART_RETURN_NEWLINE功能。

根据我所理解的情况,readDataMode = UART_DATA_TEXT 并且readReturnMode = UART_RETURN_NEWLINE的情况下,block的uart read函数在收到换行符的时候会直接unblock,但实测并没有出现,甚至收到超过read函数size参数的情况下都没有unblock,请问一下是什么原因呢?

该uart已经能正常发送字节。

以下是我使用的测试代码,

   UART_init();
    // Initialize UART parameters
    UART_Params uartParams;
    UART_Params_init(&uartParams);
    uartParams.baudRate = 9600;
//    uartParams.readEcho = UART_ECHO_OFF;
//    uartParams.readMode = UART_MODE_BLOCKING;
//    uartParams.writeMode = UART_MODE_BLOCKING;
//    uartParams.readDataMode = UART_DATA_TEXT;
//    uartParams.writeDataMode = UART_DATA_TEXT;
//    uartParams.readReturnMode = UART_RETURN_NEWLINE;
   
    // Open the UART
    UART_Handle uart;
    uart = UART_open(GNSS_UART, &uartParams);

    UART_control(uart, UART_CMD_RXENABLE, NULL);

    size_t  bytesRead;
    uint8_t buffer[128] = {11, 12, 13};
    int32_t status;

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

    size_t  bytesWritten;
    bytesWritten = UART_write(uart, buffer, 5);

    Display_printf(hDisplaySerial, 0, 0, "wirte %d data", bytesWritten);


    while (1)
    {
       
        bytesRead = UART_read(uart, buffer, 128);
        Display_printf(hDisplaySerial, 0, 0, "read %d data:", bytesRead);
    }