愤怒的小菜_a19389 发表于 2021-9-30 10:49:15

ESP32 485对接接收会自动分包问题

ESP32的串口使用队列接收256字节数据正常,但是将串口配置成485接收数据超过120字节后会自动分包,这是底层限制了485接收的数据长度还是配置上出现问题?
485配置如下:uart_config_t uart_config = {
      .baud_rate = baudrate,
      .data_bits = UART_DATA_8_BITS,
      .parity = uartparity,
      .stop_bits = UART_STOP_BITS_1,
      .flow_ctrl = UART_HW_FLOWCTRL_DISABLE,
      //.rx_flow_ctrl_thresh = 127
      .rx_flow_ctrl_thresh = 255
    };
    uart_param_config(EX_UART_NUM0, &uart_config);
    uart_set_pin(EX_UART_NUM0, HAL_RS485_TX_0, HAL_RS485_RX_0, HAL_RS485_DE_0, UART_PIN_NO_CHANGE);
    uart_driver_install(EX_UART_NUM0, BUF1_SIZE * 2, BUF1_SIZE * 2, 20, &uart_queue, 0);

    uart_set_mode(EX_UART_NUM0, UART_MODE_RS485_HALF_DUPLEX);
    //Set uart pattern detect function.
    uart_enable_pattern_det_intr(EX_UART_NUM0, '+', PATTERN_CHR_NUM1, 10000, 10, 10);
    //Reset the pattern queue length to record at most 20 pattern positions.
    uart_pattern_queue_reset(EX_UART_NUM0, 20);

页: [1]
查看完整版本: ESP32 485对接接收会自动分包问题