查看: 3421|回复: 0

[求助] ESP32 485对接接收会自动分包问题

[复制链接]

该用户从未签到

发表于 2021-9-30 10:49:15 | 显示全部楼层 |阅读模式
分享到:
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);

回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /5 下一条



手机版|小黑屋|与非网

GMT+8, 2024-12-19 19:51 , Processed in 0.126524 second(s), 15 queries , MemCache On.

ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

苏公网安备 32059002001037号

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.