Skip to content

ESP32 send BLE ADV_IND ~3× more frequently than NRF52 #2914

Description

@Merikei

What happens

Firmware: flasher.meshcore.io Companion Bluetooth v1.16.0

Using a passive BLE sniffer:
nRF52 (Seeed Studio SenseCAP T1000-E): Up to 41 events (sets of 1 packet × each advertising channel (3)) for first 30 seconds, up to 7 thereafter.
ESP32 (LilyGo LoRa32 V2.1_1.6): Up to 23 e/s — does not drop in frequency, even when left hours.

Why

// Advertising parameters
#define BLE_ADV_INTERVAL_MIN 32 // 20ms (units: 0.625ms)
#define BLE_ADV_INTERVAL_MAX 244 // 152.5ms (units: 0.625ms)
#define BLE_ADV_FAST_TIMEOUT 30 // seconds

sets the rates for nRF52, but don't see a counterpart in esp32 helpers.

#784 says

Our esp32 SerialBLEInterface implementation is using the defaults of 32/244, so reverting this back ensures a consistent setup for our nrf52 implementation.

# BLEAdvertising.h (used on es32)
#define BLE_ADV_INTERVAL_FAST_DFLT       32  // 20    ms (in 0.625 ms unit)
#define BLE_ADV_INTERVAL_SLOW_DFLT       244 // 152.5 ms (in 0.625 ms unit)
#define BLE_ADV_FAST_TIMEOUT_DFLT        30  // in seconds

This appears to be a reference to the defaults in Bluefruit52Lib/src/BLEAdvertising.h which is a lib used for nRF52 not ESP32 devices so those defaults don't apply to ESP32.

To reproduce

  1. I used nRF52840 dev-board plugged in to USB of a Linux box running nRF Sniffer for Bluetooth LE to flash it and bootstrap the External capture plugins in Wireshark
    (Install instructions for MacOS, Windows, and Ubuntu are documented)

  2. Use flasher.meshcore.io to flash Companion Bluetooth firmware v1.16.0 on compatible devices.

  3. Launch Wireshark and start capture with everything installed, flashed, and MeshCore nodes ready to turn on.
    No MeshCore companion app running.
    I ran several tests, but the quoted rates were having one MeshCore node powered on at once to minimise an undercount form collisions, monitoring a single channel (set with advertising hop sequence textbox, and turning off other nearby misbehaving Bluetooth devices.

  4. Turn on a MeshCore device. Turn off and repeat as necessary

  5. See the non-malformed adverts/s with with btle.advertising_address == yo:ur:00:00:0m:ac && _ws.col.info == "ADV_IND" rules in the I/O Graphs Window

  6. Stop capture when done

Expected behaviour

ESP32 and nRF advertise at the same rate
Would be great to be able to customise the advert frequency at compile-time too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions