Skip to content

Conversation

@Jason2866
Copy link
Contributor

@Jason2866 Jason2866 commented Oct 11, 2025

enhance wifi performance by using recommended settings from espressif/esp-hosted-mcu#109 (comment)

@me-no-dev

Added configuration options for Wi-Fi and LWIP buffers.
@me-no-dev me-no-dev merged commit 59038b5 into espressif:master Oct 13, 2025
10 checks passed
@Jason2866 Jason2866 deleted the patch-1 branch October 13, 2025 14:18
@lyusupov
Copy link

lyusupov commented Oct 13, 2025

@Jason2866

enhance wifi performance by using recommended settings from....

The thread you've mentioned is specific to SP32-P4-Function-EV-Board product that uses ESP32-C6 as a slave Wi-Fi and BLE co-processor

However, ESP32-C5 is also in use by ESP32-P4 boards to provide Wi-Fi and BLE features
ESP32-C5 has

  1. less static RAM memory
  2. PSRAM that is included in some ESP32-C5 modules is still not supported by ESP-HOSTED project

Limited RAM of ESP32-C5 is known to cause issues. One known example is XiaoZhi Voice Assistant https://github.com/78/xiaozhi-esp32
Default XiaoZhi ESP32-P4 Wi-Fi network buffers setting causes a boot loop with ESP32-C5 slave.

The buffers has to be reduced as follows to fix the boot loop
https://github.com/78/xiaozhi-esp32/tree/main/main/boards/wireless-tag-wtp4c5mp07s#esp32p4-configuration

                "CONFIG_WIFI_RMT_STATIC_RX_BUFFER_NUM=10",
                "CONFIG_WIFI_RMT_DYNAMIC_RX_BUFFER_NUM=24",
                "CONFIG_WIFI_RMT_STATIC_TX_BUFFER_NUM=10"

My suggestion is to revert this PR until the Arduino Core will distinguish ESP32-C5 slave from ESP32-C6 one and adjust Wi-Fi buffers correspondingly !

@me-no-dev
Copy link
Member

@lyusupov unless we can control those at runtime, we will not have a way to change them based on the slave chip, so we either go with the lower values to cover both chips, or we keep what is default

@lyusupov
Copy link

lyusupov commented Oct 14, 2025

@me-no-dev

we either go with the lower values to cover both chips, or we keep what is default

This ESP-HOSTED commit that was referenced in this PR (see above) contains this

image


This commit contains the following values for ESP32-C5 slave :
espressif/esp-hosted-mcu@129fb4a


image


For ESP32-C61 slave:

image

Note

Regardless of what particular approach will be chosen - it makes sense to revert this commit 7685397 before it will break next Release of the Arduino Core.

@me-no-dev
Copy link
Member

@Jason2866 any comments?

@Jason2866
Copy link
Contributor Author

Jason2866 commented Oct 14, 2025

@me-no-dev Fine with changes which works for all slave MCUs

@me-no-dev
Copy link
Member

@lyusupov @Jason2866 here it is: #324

@lyusupov
Copy link

lyusupov commented Oct 15, 2025

@lyusupov @Jason2866 here it is: #324

@me-no-dev

Current Arduino Core and Libraries still use ESP-HOSTED version 2.0.12 which is 3+ months old

image

This is location of 2.0.12 in the Espressif registry

https://components.espressif.com/components/espressif/esp_hosted/versions/2.0.12/readme?language=en

When the Arduino Core 3.3.2 for ESP32-P4 with ESP-HOSTED component 2.0.12 successfully boots up on ESP32-C5 slave, it produces the log

I (432) main_task: Started on CPU0
I (432) main_task: Calling app_main()
I (432) fg_mcu_slave: *********************************************************************
I (439) fg_mcu_slave:                 ESP-Hosted-MCU Slave FW version :: 2.0.12                        
I (448) fg_mcu_slave:                 Transport used :: SDIO only                     
I (456) fg_mcu_slave: *********************************************************************
I (464) fg_mcu_slave: Supported features are:
I (468) fg_mcu_slave: - WLAN over SDIO
I (471) h_bt: - BT/BLE
I (473) h_bt:    - HCI Over SDIO
I (476) h_bt:    - BLE only
I (479) fg_mcu_slave: capabilities: 0xd
I (482) fg_mcu_slave: Supported extended features are:
I (487) h_bt: - BT/BLE (extended)
I (490) fg_mcu_slave: extended capabilities: 0x0
I (510) h_bt: ESP Bluetooth MAC addr: d0:cf:13:e0:9d:26
I (510) BLE_INIT: Using main XTAL as clock source
I (510) BLE_INIT: ble controller commit:[35fe65f]
W (515) BLE_INIT: BLE modem sleep is enabled
I (517) BLE_INIT: Bluetooth MAC: d0:cf:13:e0:9d:26
I (521) phy_init: phy_version 102,171bf417,Jun 12 2025,15:57:12
I (1125) phy: libbtbb version: 09fb4d6, Jun 12 2025, 15:57:24
I (1126) SDIO_SLAVE: Using SDIO interface
I (1126) SDIO_SLAVE: sdio_init: sending mode: SDIO_SLAVE_SEND_STREAM
I (1129) SDIO_SLAVE: sdio_init: ESP32 SDIO TxQ[20] timing[0]

I (1624) fg_mcu_slave: Start Data Path
I (1626) fg_mcu_slave: Initial set up done
I (1626) slave_ctrl: event ESPInit
mem_dump free:78900 min-free:78848 lfb-dma:61440 lfb-def:61440 lfb-8bit:61440
I (1641) fg_mcu_slave: Slave init_config received from host
I (1641) fg_mcu_slave: Host capabilities: 44
E (1641) fg_mcu_slave: Chip id returned[13] doesn't match with chip id sent[23]
I (1647) fg_mcu_slave: ESP<-Host high data throttle threshold [80%]
I (1653) fg_mcu_slave: ESP<-Host low data throttle threshold [60%]
I (2497) slave_ctrl: Resp_MSGId for req[0x116] is [0x216], uid 1
I (2497) slave_ctrl: Received Req [0x116]
I (2497) pp: pp rom version: 78a72e9d5
I (2499) net80211: net80211 rom version: 78a72e9d5
I (2505) wifi:wifi driver task: 4084fb4c, prio:23, stack:6656, core=0
I (2518) wifi:wifi firmware version: f3dbad7
I (2518) wifi:wifi certification version: v7.0
I (2518) wifi:config NVS flash: enabled
I (2521) wifi:config nano formatting: disabled
I (2525) wifi:mac_version:HAL_MAC_ESP32AX_752MP_ECO2,ut_version:N, band mode:0x3
I (2533) wifi:Init data frame dynamic rx buffer num: 32
I (2537) wifi:Init static rx mgmt buffer num: 5
I (2542) wifi:Init management short buffer num: 32
I (2546) wifi:Init dynamic tx buffer num: 32
I (2550) wifi:Init static tx FG buffer num: 2
I (2554) wifi:Init static rx buffer size: 1700 (rxctrl:64, csi:512)
I (2560) wifi:Init static rx buffer num: 4
I (2564) wifi:Init dynamic rx buffer num: 32
I (2569) wifi_init: rx ba win: 6
I (2571) wifi_init: accept mbox: 6
I (2574) wifi_init: tcpip mbox: 32
I (2577) wifi_init: udp mbox: 6
I (2580) wifi_init: tcp mbox: 6
I (2583) wifi_init: tcp tx win: 5760
I (2586) wifi_init: tcp rx win: 5760
I (2589) wifi_init: tcp mss: 1440
I (2592) wifi_init: WiFi IRAM OP enabled
I (2596) wifi_init: WiFi RX IRAM OP enabled
I (2600) wifi_init: WiFi SLP IRAM OP enabled
I (2607) slave_ctrl: Resp_MSGId for req[0x104] is [0x204], uid 2
I (2610) slave_ctrl: Received Req [0x104]
I (2615) slave_ctrl: Resp_MSGId for req[0x12a] is [0x22a], uid 3
I (2619) slave_ctrl: Received Req [0x12a]
E (2623) wifi:can not get wifi protocol under WiFi band mode WIFI_BAND_MODE_AUTO, please use esp_wifi_get_protocols instead
E (2634) slave_ctrl: req_wifi_get_protocol:1212 failed [esp_wifi_get_protocol(req_payload->ifx, &protocol_bitmap)] = [262]
I (2646) slave_ctrl: Resp_MSGId for req[0x118] is [0x218], uid 4
I (2650) slave_ctrl: Received Req [0x118]
W (2656) wifi:WDEV_RXCCK_DELAY:960
W (2657) wifi:WDEV_RXOFDM_DELAY:258
W (2660) wifi:WDEV_RX_11G_OFDM_DELAY:259
W (2664) wifi:WDEV_TXCCK_DELAY:630
W (2667) wifi:WDEV_TXOFDM_DELAY:94
W (2670) wifi:ACK_TAB0   :0x   90a0b, QAM16:0x9 (24Mbps), QPSK:0xa (12Mbps), BPSK:0xb (6Mbps)
W (2679) wifi:CTS_TAB0   :0x   90a0b, QAM16:0x9 (24Mbps), QPSK:0xa (12Mbps), BPSK:0xb (6Mbps)
W (2687) wifi:WDEVBEAMFORMCONF:0x61d7120, HE_BF_RPT_RA_SET_OPT:1
W (2692) wifi:WDEVVHTBEAMFORMCONF: 0x61d7120, WDEV_VHT_BEAMFORMEE_ENA: 1, WDEV_VHT_NG_SEL: 0
W (2701) wifi:(agc)0x600a7128:0xd21f0c20, min.avgNF:0xce->0xd2(dB), RCalCount:0x1f0, min.RRssi:0xc20(-62.00)
W (2710) wifi:MODEM_SYSCON_WIFI_BB_CFG_REG(0x600a9c18):0x10003802
W (2716) wifi:(phy)rate:0x0(  LP-1Mbps), pwr:20, txing:20
W (2721) wifi:(phy)rate:0x1(  LP-2Mbps), pwr:20, txing:20
W (2726) wifi:(phy)rate:0x2(LP-5.5Mbps), pwr:20, txing:20
W (2731) wifi:(phy)rate:0x3( LP-11Mbps), pwr:20, txing:20
W (2736) wifi:(phy)rate:0x5(  SP-2Mbps), pwr:20, txing:20
W (2742) wifi:(phy)rate:0x6(SP-5.5Mbps), pwr:20, txing:20
W (2747) wifi:(phy)rate:0x7( SP-11Mbps), pwr:20, txing:20
W (2752) wifi:(phy)rate:0x8(    48Mbps), pwr:17, txing:17
W (2757) wifi:(phy)rate:0x9(    24Mbps), pwr:19, txing:19
W (2762) wifi:(phy)rate:0xa(    12Mbps), pwr:19, txing:19
W (2767) wifi:(phy)rate:0xb(     6Mbps), pwr:19, txing:19
W (2772) wifi:(phy)rate:0xc(    54Mbps), pwr:17, txing:17
W (2777) wifi:(phy)rate:0xd(    36Mbps), pwr:19, txing:19
W (2783) wifi:(phy)rate:0xe(    18Mbps), pwr:19, txing:19
W (2788) wifi:(phy)rate:0xf(     9Mbps), pwr:19, txing:19
W (2793) wifi:(phy)rate:0x10, mcs:0x0, pwr(bw20:19, bw40:18), txing:19, HE pwr(bw20:19), txing:19
W (2801) wifi:(phy)rate:0x11, mcs:0x1, pwr(bw20:19, bw40:18), txing:19, HE pwr(bw20:19), txing:19
W (2810) wifi:(phy)rate:0x12, mcs:0x2, pwr(bw20:18, bw40:17), txing:18, HE pwr(bw20:18), txing:18
W (2819) wifi:(phy)rate:0x13, mcs:0x3, pwr(bw20:18, bw40:17), txing:18, HE pwr(bw20:18), txing:18
W (2827) wifi:(phy)rate:0x14, mcs:0x4, pwr(bw20:17, bw40:16), txing:17, HE pwr(bw20:17), txing:17
W (2836) wifi:(phy)rate:0x15, mcs:0x5, pwr(bw20:17, bw40:16), txing:17, HE pwr(bw20:17), txing:17
W (2844) wifi:(phy)rate:0x16, mcs:0x6, pwr(bw20:17, bw40:16), txing:17, HE pwr(bw20:17), txing:17
W (2853) wifi:(phy)rate:0x17, mcs:0x7, pwr(bw20:17, bw40:16), txing:17, HE pwr(bw20:17), txing:17
W (2862) wifi:(phy)rate:0x18, mcs:0x8, pwr(bw20:19, bw40:16), txing:19, HE pwr(bw20:16), txing:16
W (2870) wifi:(phy)rate:0x19, mcs:0x9, pwr(bw20:18, bw40:16), txing:18, HE pwr(bw20:15), txing:15
W (2879) wifi:(hal)co_hosted_bss:0, max_indicator:0, bitmask:0xff, mBSSIDsEnable:0
I (2886) wifi:11ax coex: WDEVAX_PTI0(0x55777555), WDEVAX_PTI1(0x00003377).

I (2893) wifi:mode : sta (d0:cf:13:e0:9d:24)
I (2897) wifi:enable tsf
W (2899) wifi:(BB)enable busy check(0x18), disable idle check(0xaa)
I (2907) slave_ctrl: Sending Wi-Fi event [43]
I (2909) slave_ctrl: Sending Wi-Fi event [2]
I (2914) slave_ctrl: Resp_MSGId for req[0x101] is [0x201], uid 5
I (2919) slave_ctrl: Received Req [0x101]
I (2923) slave_ctrl: mac [d0:cf:13:e0:9d:24]
I (2927) slave_ctrl: Resp_MSGId for req[0x103] is [0x203], uid 6
I (2932) slave_ctrl: Received Req [0x103]
I (2936) slave_ctrl: Resp_MSGId for req[0x10e] is [0x20e], uid 7
I (2942) slave_ctrl: Received Req [0x10e]
I (2946) wifi:Set ps type: 1, coexist: 0

I (2950) slave_ctrl: Resp_MSGId for req[0x11c] is [0x21c], uid 8
I (2955) slave_ctrl: Received Req [0x11c]
I (2959) slave_ctrl: STA set config: SSID:XEPAKEC
I (2965) slave_ctrl: Resp_MSGId for req[0x11a] is [0x21a], uid 9
I (2969) slave_ctrl: Received Req [0x11a]
I (2973) slave_ctrl: ************ connect ****************
I (2982) slave_ctrl: Resp_MSGId for req[0x126] is [0x226], uid 10
I (2984) slave_ctrl: Received Req [0x126]
W (2988) wifi:Haven't to connect to a suitable AP now!
E (2992) slave_ctrl: req_wifi_sta_get_ap_info:1480 failed [esp_wifi_sta_get_ap_info(&p_a_ap_info)] = [12303]
I (9741) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
I (9743) wifi:(connect)dot11_authmode:0x3, pairwise_cipher:0x3, group_cipher:0x3
I (9745) wifi:state: init -> auth (0xb0)
I (9750) slave_ctrl: Sending Wi-Fi event [43]
I (9754) wifi:state: auth -> assoc (0x0)
I (9761) wifi:(assoc)RESP, Extended Capabilities length:8, operating_mode_notification:1
I (9764) wifi:(assoc)RESP, Extended Capabilities, MBSSID:0, TWT Responder:0, OBSS Narrow Bandwidth RU In OFDMA Tolerance:0
I (9776) wifi:state: assoc -> run (0x10)
I (9779) wifi:(trc)phytype:CBW20-SGI, snr:49, maxRate:144, highestRateIdx:0
W (9785) wifi:(trc)band:2G, phymode:3, highestRateIdx:0, lowestRateIdx:11, dataSchedTableSize:14
I (9794) wifi:(trc)band:2G, rate(S-MCS7, rateIdx:0), ampdu(rate:S-MCS7, schedIdx(0, stop:8)), snr:49, ampduState:wait operational
I (9805) wifi:ifidx:0, rssi:-49, nf:-98, phytype(0x3, CBW20-SGI), phymode(0x3, 11bgn), max_rate:144, he:0, vht:0, ht:1
I (9816) wifi:(ht)max.RxAMPDULenExponent:3(65535 bytes), MMSS:6(8 us)
I (9831) wifi:connected with XEPAKEC, aid = 3, channel 11, BW20(NONE, 00), bssid = 14:e6:e4:e7:5e:42
I (9831) wifi:security: WPA2-PSK, phy:bgn, rssi:-49, cipher(pairwise:0x3, group:0x3), pmf:0, 
I (9840) wifi:pm start, type: 1, twt_start:0

I (9843) wifi:pm start, type:1, aid:0x3, trans-BSSID:14:e6:e4:e7:5e:42, BSSID[5]:0x42, mbssid(max-indicator:0, index:0), he:0
I (9854) wifi:set rx beacon pti, rx_bcn_pti: 10, bcn_timeout: 25000, mt_pti: 10, mt_time: 10000
I (9863) wifi:[ADDBA]TX addba request, tid:0, dialogtoken:1, bufsize:64, A-MSDU:0(not supported), policy:1(IMR), ssn:0(0x0)
I (9874) wifi:[ADDBA]TX addba request, tid:7, dialogtoken:2, bufsize:64, A-MSDU:0(not supported), policy:1(IMR), ssn:0(0x20)
I (9885) wifi:[ADDBA]TX addba request, tid:5, dialogtoken:3, bufsize:64, A-MSDU:0(not supported), policy:1(IMR), ssn:0(0x0)
I (9896) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (9902) wifi:[ADDBA]RX addba response, status:0, tid:0/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
I (9910) wifi:[ADDBA]RX addba response, status:0, tid:7/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
I (9919) wifi:[ADDBA]RX addba response, status:0, tid:5/tb:1(0xa1), bufsize:64, batimeout:0, txa_wnd:64
I (9928) slave_ctrl: Sta mode connected


You can see there what particular Wi-Fi buffers were successfully allocated by ESP-HOSTED 2.0.12 on the C5 slave

image

From my experience with XiaoZhi assistant, when the C5 SLAVE allocates less memory than P4 expects to get - ASSERT() on the P4 HOST will happen followed by executing a panic() procedure....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants