Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32-C6: Using an L2CAP MTU < 255 with BLE causes a runtime error #2984

Open
lure23 opened this issue Jan 16, 2025 · 3 comments
Open

ESP32-C6: Using an L2CAP MTU < 255 with BLE causes a runtime error #2984

lure23 opened this issue Jan 16, 2025 · 3 comments
Labels
bug Something isn't working package:esp-wifi Issues related to the esp-wifi package

Comments

@lure23
Copy link
Contributor

lure23 commented Jan 16, 2025

Bug description

In the trouble examples, MTU values of 128 and 251 are being used. When such examples are being run on ESP32-C6 hardware, the following error occurs:

INFO - [host] setting txq to 24, fragmenting at 255
INFO - [host] configuring host buffers (8 packets of size 251)


====================== PANIC ======================
panicked at /home/ubuntu/trouble.fork/examples/apps/src/ble_bas_peripheral.rs:104:13:
[ble_task] error: BleHost(Hci(Invalid HCI Command Parameters))

@bjoernQ asked me to report this here.

According to him, also ESP32-C2 and ESP32-H2 might be affected (I have only ESP32-C6 to test with).

To Reproduce

  1. clone trouble
  2. cd examples/esp32
  3. edit Cargo.toml in that folder; disable the workaround:
[features]
...
esp32c2 = ["esp-hal/esp32c2", "esp-backtrace/esp32c2", "esp-hal-embassy/esp32c2", "esp-println/esp32c2", "esp-wifi/esp32c2"]
esp32c3 = ["esp-hal/esp32c3", "esp-backtrace/esp32c3", "esp-hal-embassy/esp32c3", "esp-println/esp32c3", "esp-wifi/esp32c3"]
esp32c6 = ["esp-hal/esp32c6", "esp-backtrace/esp32c6", "esp-hal-embassy/esp32c6", "esp-println/esp32c6", "esp-wifi/esp32c6"]
esp32h2 = ["esp-hal/esp32h2", "esp-backtrace/esp32h2", "esp-hal-embassy/esp32h2", "esp-println/esp32h2", "esp-wifi/esp32h2"]

 4. run with:

$ cargo esp32c6 --bin ble_bas_peripheral

Expected behavior

Starts advertising:

...
INFO - [adv] advertising

Actual behaviour

There's a panic at initialization of the BLE stack.

Environment

  • Target device: ESP32-C6, -C2, -H2

    Chip type:         esp32c6 (revision v0.0)
    Crystal frequency: 40 MHz
    Flash size:        4MB
    Features:          WiFi 6, BT 5
    
  • Crate name and version: esp-hal rev. 7288d0367e0a820db4ca25a22496a35beff1bb61

@lure23 lure23 added bug Something isn't working status:needs-attention This should be prioritized labels Jan 16, 2025
@bjoernQ
Copy link
Contributor

bjoernQ commented Jan 16, 2025

Thanks!

We need to make parts of BLE_CONFIG (e.g.

pub(crate) fn create_ble_config() -> esp_bt_controller_config_t {
and
pub(crate) static BLE_CONFIG: esp_bt_controller_config_t = esp_bt_controller_config_t {
) user configurable

Unfortunately, it's different for different chips

@lure23
Copy link
Contributor Author

lure23 commented Jan 17, 2025

New data:

  • ESP32-C3 works only with MTU >= 251 (not 128..250)

@bugadani bugadani added package:esp-wifi Issues related to the esp-wifi package and removed status:needs-attention This should be prioritized labels Jan 20, 2025
@lure23
Copy link
Contributor Author

lure23 commented Feb 9, 2025

According to this on Matrix, also ESP32-S3 is affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:esp-wifi Issues related to the esp-wifi package
Projects
Status: Todo
Development

No branches or pull requests

3 participants