* Config UART */
uart_config_t uart_config = {
.baud_rate = config->baud_rate,
.data_bits = config->data_bits,
.parity = config->parity,
.stop_bits = config->stop_bits,
.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS ,
.rx_flow_ctrl_thresh = 122 //UART_FIFO_LEN -8
};
MODEM_CHECK(uart_param_config(esp_dte->uart_port, &uart_config) == ESP_OK, "config modem uart parameter failed", err_uart_config);
if (config->flow_control == MODEM_FLOW_CONTROL_HW) {
printf("[MODEM UART FLOW_CONTROL]:uart_set_pin,rts pin:%d,cts pin:%d\n",config->uart_pins_rts,config->uart_pins_cts);
res = uart_set_pin(esp_dte->uart_port, config->uart_pins_txd, config->uart_pins_rxd,
config->uart_pins_rts, config->uart_pins_cts);
} else {
res = uart_set_pin(esp_dte->uart_port, config->uart_pins_txd, config->uart_pins_rxd,
UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
}
MODEM_CHECK(res == ESP_OK, "config modem uart gpio failed", err_uart_config);
-----------------------------------------------------------------------------------------------------
使用以上代码初始化了 4G 模块的串口,4G模块也已启用 RTS /CTS 硬件流控,并验证了4G模块的RTS/CTS是有效的;ppp拨号也成功建立了连接:
[HOS MODEM] esp_modem_dte_send_cmd,port:1,cmd:ATD*99***1#
[HOS MODEM] AT read:
[HOS MODEM] AT read:CONNECT
pppos netif created! addr=0x3f80bb3c
Modem PPP Started
Modem Connect to PPP Server
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IP : 10.50.115.93
Netmask : 255.255.255.255
Gateway : 10.64.64.64
Name Server1: 183.230.126.225
Name Server2: 183.230.126.224
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[HOS IP ROUTE] add item :0,ip: 180.153.49.147, netmask:255.255.255.255, gw:10.64.64.64
[HOS IP ROUTE] add item :1,ip: 180.153.49.128, netmask:255.255.255.255, gw:10.64.64.64
应用程序运行在 Core1 上,CPU负荷比较高,大约在 95% 以上
用示波器看 RTS 引脚,可以看到 RTS 有变化,
但仍然频繁出现 :
W (374153) esp-modem: HW FIFO Overflow
W (374173) esp-modem: HW FIFO Overflow
W (374953) esp-modem: HW FIFO Overflow
W (374983) esp-modem: HW FIFO Overflow
W (377023) esp-modem: HW FIFO Overflow
W (377043) esp-modem: HW FIFO Overflow
W (380103) esp-modem: HW FIFO Overflow
W (386633) esp-modem: HW FIFO Overflow
W (394133) esp-modem: HW FIFO Overflow
W (400463) esp-modem: HW FIFO Overflow
dhcps: send_nak>>udp_sendto result 0
W (426463) esp-modem: HW FIFO Overflow
dhcps: send_nak>>udp_sendto result 0
dhcps: send_nak>>udp_sendto result 0
请问这个是说明原因呢?
启用了 硬件的流控 RTS,CTS, 任然出现 esp-modem: HW FIFO Overflow,会是什么问题呢?
Re: 启用了 硬件的流控 RTS,CTS, 任然出现 esp-modem: HW FIFO Overflow,会是什么问题呢?
我也遇到这个问题了。主要问题在于中断处理不够快,FIFO的数据无法快速转换到Ring Buffer里。
可以通过设置menuconfig菜单,(Top) → Component config → Driver configurations → UART configuration 。
选中Place UART ISR function into IRAM。
然后记得根据你更新包的大小适度调到Ring Buffer的值,建议用4096.
可以通过设置menuconfig菜单,(Top) → Component config → Driver configurations → UART configuration 。
选中Place UART ISR function into IRAM。
然后记得根据你更新包的大小适度调到Ring Buffer的值,建议用4096.
Who is online
Users browsing this forum: No registered users and 35 guests