-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Checklist
- Checked the issue tracker for similar issues to ensure this is not a duplicate.
- Provided a clear description of your suggestion.
- Included any relevant context or examples.
Issue or Suggestion Description
Hi,
I am trying to connect ESP32-P4 with ESP32 for simultaneous A2DP streaming and WiFI use.
I am encountering an issue where after a few seconds to a few minutes of streaming the communication between host and coprocessor locks up with a warning printed on host:
H_SDIO_DRV: invalid ret or len_from_slave: 0 0
With default loglevel there is really not much more worth of noting.
It looks like this issue is happening only in a coexistence scenario - with only WiFi or only Bluetooth enabled I cannot reproduce this issue.
My setup:
- ESP-IDF 5.5.1
- Espressif-IDE 3.6.0
- Ubuntu 25.10
Libraries:
- ESP-Hosted: 2.6.4
- ESP-Wifi-Remote: 1.2.0
Host is ESP32P4NRW32, co-processor is ESP32-WROOM-32E-N16R2 module (however I got the same issue on ESP32-WROOM-32E-N4 base model).
Custom PCB, SDIO transport.
I managed to create minimal example:
Host:
- Get A2DP ESP32 example from:
https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/bluedroid/classic_bt/a2dp_sink
- Add esp-hosted and esp-wifi-remote dependencies
- Configure co-processor to ESP32
- Configure SDIO transport and its GPIO pins, enable bluedroid support
- Configure Wifi Remote to reduce memory footprint as defaults doesn't play nice with BT+Wifi scenario:
CONFIG_WIFI_RMT_STATIC_RX_BUFFER_NUM=2
CONFIG_WIFI_RMT_DYNAMIC_RX_BUFFER_NUM=2
# CONFIG_WIFI_RMT_STATIC_TX_BUFFER is not set
CONFIG_WIFI_RMT_DYNAMIC_TX_BUFFER=y
CONFIG_WIFI_RMT_TX_BUFFER_TYPE=1
CONFIG_WIFI_RMT_DYNAMIC_TX_BUFFER_NUM=2
CONFIG_WIFI_RMT_STATIC_RX_MGMT_BUFFER=y
# CONFIG_WIFI_RMT_DYNAMIC_RX_MGMT_BUFFER is not set
CONFIG_WIFI_RMT_DYNAMIC_RX_MGMT_BUF=0
CONFIG_WIFI_RMT_RX_MGMT_BUF_NUM_DEF=5
# CONFIG_WIFI_RMT_CSI_ENABLED is not set
CONFIG_WIFI_RMT_AMPDU_TX_ENABLED=y
CONFIG_WIFI_RMT_TX_BA_WIN=2
CONFIG_WIFI_RMT_AMPDU_RX_ENABLED=y
CONFIG_WIFI_RMT_RX_BA_WIN=2
- In main.cpp replace controller initialization routine with ESP-Hosted init, remote BT Controller init and remote Wifi init routines. I came up with:
// ------ ESP HOSTED
esp_hosted_connect_to_slave();
esp_hosted_init();
// ------ ESP HOSTED
// ------ BLUETOOTH
/* initialize TRANSPORT first */
if ((err = esp_hosted_bt_controller_init() != ESP_OK)) {
ESP_LOGE(BT_AV_TAG, "%s esp_hosted_bt_controller_init() failed: %s", __func__, esp_err_to_name(err));
return;
}
// enable bt controller
if ((err = esp_hosted_bt_controller_enable() != ESP_OK)) {
ESP_LOGE(BT_AV_TAG, "%s esp_hosted_bt_controller_enable() failed: %s", __func__, esp_err_to_name(err));
return;
}
hosted_hci_bluedroid_open();
/* get HCI driver operations */
esp_bluedroid_hci_driver_operations_t operations = {
.send = hosted_hci_bluedroid_send,
.check_send_available = hosted_hci_bluedroid_check_send_available,
.register_host_callback = hosted_hci_bluedroid_register_host_callback,
};
if ((err = esp_bluedroid_attach_hci_driver(&operations)) != ESP_OK)
{
ESP_LOGE(BT_AV_TAG, "%s esp_bluedroid_attach_hci_driver failed: %s", __func__, esp_err_to_name(err));
return;
}
// ------ BLUETOOTH
// ------ SIMPLE WIFI TEST
esp_netif_init();
esp_event_loop_create_default();
esp_netif_create_default_wifi_sta();
wifi_init_config_t wifi_initiation = WIFI_INIT_CONFIG_DEFAULT();
esp_wifi_init(&wifi_initiation);
wifi_config_t wifi_configuration = {
.sta = {
.ssid = "SSID",
.password= "PASS"
}
};
esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_configuration);
esp_wifi_start();
esp_wifi_set_mode(WIFI_MODE_STA);
do
{
err = esp_wifi_connect();
vTaskDelay(100);
} while (err != ESP_OK);
// ------ SIMPLE WIFI TEST
Co-processor:
- Clone and compile firmware from:
idf.py create-project-from-example "espressif/esp_hosted=2.6.4:slave"
- The only change is to change SDIO TX/RX queue length to 10 in menuconfig to conserve DRAM.
Test procedure:
- Compile and flash firmwares
- Flood P4 with ping:
sudo ping IP -i 0.001 - Play audio via BT. For testing I was using Android phone
- After few seconds to few minutes BT and Wifi should cease to work, and on host there should be a warning message:
H_SDIO_DRV: invalid ret or len_from_slave: 0 0
Flooding with ping is optional, but I noticed that increased activity makes the program lock up faster.
I am attaching:
- modified main.c from a2dp example
- sdkconfig from host and coprocessor
- execution logs from host and coprocessor
coprocessor.log
host.log
main.c
sdkconfig_coprocessor.txt
sdkconfig_host.txt
Any help would be appreciated :)
Best regards,
Norbert