Extended Advertising

Borealis
Posts: 2
Joined: Mon Sep 30, 2024 6:57 am

Extended Advertising

Postby Borealis » Mon Sep 30, 2024 7:17 am

Hi folks

I am trying to get the BLE example "examples/bluetooth/nimble/bleprph" running on a ESP32c6. Background is that in my project I need extended advertising (manufacturer data). When I compile and run the example with no configuration changed (extended advertising is on by default), I can't find the device on my phone (using nRF Connect app). Just as an experiment, I disabled extended advertising. Then, the device is visible on my phone.

Bellow is the output from the monitor (I had to add a vTaskDelay(500 / portTICK_PERIOD_MS); as the very first statement in app_main to get over Waiting for the device to reconnect in the monitor. See https://esp32.com/viewtopic.php?t=21505):

Code: Select all

$ idf.py -p /dev/ttyACM0 flash monitor
Executing action: flash
Running ninja in directory /home/esp32/tmp/esp-idf/examples/bluetooth/nimble/bleprph/build
Executing "ninja flash"...
[1/5] cd /home/esp32/tmp/esp-idf/examples/bluetooth/nimble/bleprph/build/esp-idf/esptool_py &...rtition-table.bin /home/esp32/tmp/esp-idf/examples/bluetooth/nimble/bleprph/build/bleprph.bin
bleprph.bin binary size 0x9f790 bytes. Smallest app partition is 0x100000 bytes. 0x60870 bytes (38%) free.
[1/1] cd /home/esp32/tmp/esp-idf/examples/bluetooth/nimble/bleprph/build/bootloader/esp-idf/e...0x0 /home/esp32/tmp/esp-idf/examples/bluetooth/nimble/bleprph/build/bootloader/bootloader.bin
Bootloader binary size 0x5500 bytes. 0x2b00 bytes (34%) free.
[4/5] cd /home/esp32/esp/esp-idf/components/esptool_py && /usr/bin/cmake -D IDF_PATH=/home/es...h/nimble/bleprph/build -P /home/esp32/esp/esp-idf/components/esptool_py/run_serial_tool.cmake
esptool.py --chip esp32c6 -p /dev/ttyACM0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 80m --flash_size 2MB 0x0 bootloader/bootloader.bin 0x10000 bleprph.bin 0x8000 partition_table/partition-table.bin
esptool.py v4.8.dev5
Serial port /dev/ttyACM0
Connecting...
Chip is ESP32-C6 (QFN40) (revision v0.0)
Features: WiFi 6, BT 5, IEEE802.15.4
Crystal is 40MHz
MAC: 40:4c:ca:ff:fe:57:d4:90
BASE MAC: 40:4c:ca:57:d4:90
MAC_EXT: ff:fe
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00005fff...
Flash will be erased from 0x00010000 to 0x000affff...
Flash will be erased from 0x00008000 to 0x00008fff...
SHA digest in image updated
Compressed 21760 bytes to 13120...
Writing at 0x00000000... (100 %)
Wrote 21760 bytes (13120 compressed) at 0x00000000 in 0.4 seconds (effective 435.4 kbit/s)...
Hash of data verified.
Compressed 653200 bytes to 382729...
Writing at 0x000ac0cc... (100 %)
Wrote 653200 bytes (382729 compressed) at 0x00010000 in 5.1 seconds (effective 1020.5 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 103...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (103 compressed) at 0x00008000 in 0.0 seconds (effective 508.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
Executing action: monitor
Running idf_monitor in directory /home/esp32/tmp/esp-idf/examples/bluetooth/nimble/bleprph
Executing "/home/esp32/.espressif/python_env/idf5.3_py3.12_env/bin/python /home/esp32/esp/esp-idf/tools/idf_monitor.py -p /dev/ttyACM0 -b 115200 --toolchain-prefix riscv32-esp-elf- --target esp32c6 --revision 0 --decode-panic backtrace /home/esp32/tmp/esp-idf/examples/bluetooth/nimble/bleprph/build/bleprph.elf -m '/home/esp32/.espressif/python_env/idf5.3_py3.12_env/bin/python' '/home/esp32/esp/esp-idf/tools/idf.py' '-p' '/dev/ttyACM0'"...
--- esp-idf-monitor 1.4.0 on /dev/ttyACM0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
I (112) esp_image: segment 1: paddr=00028858 vaddr=408000mationESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x15 (USB_UART_HPSYS),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x400294ae
0x400294ae: uart_hal_get_txfifo_count in ROM

SPIWP:0xee
mode:DIO, clock div:2
load:0x40875720,len:0x1804
load:0x4086c110,len:0xe2c
load:0x4086e610,len:0x2e70
entry 0x4086c11a
I (23) boot: ESP-IDF v5.3 2nd stage bootloader
I (23) boot: compile time Sep 24 2024 15:49:55
I (24) boot: chip revision: v0.0
I (25) boot.esp32c6: SPI Speed      : 80MHz
I (30) boot.esp32c6: SPI Mode       : DIO
I (35) boot.esp32c6: SPI Flash Size : 2MB
I (40) boot: Enabling RNG early entropy source...
I (45) boot: Partition Table:
I (49) boot: ## Label            Usage          Type ST Offset   Length
I (56) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (63) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (71) boot:  2 factory          factory app      00 00 00010000 00100000
I (79) boot: End of partition table
I (83) esp_image: segment 0: paddr=00010020 vaddr=42078020 size=18830h (100400) map
I (112) esp_image: segment 1: paddr=00028858 vaddr=40800000 size=077c0h ( 30656) load
I (120) esp_image: segment 2: paddr=00030020 vaddr=42000020 size=71484h (464004) map
I (217) esp_image: segment 3: paddr=000a14ac vaddr=408077c0 size=0b980h ( 47488) load
I (229) esp_image: segment 4: paddr=000ace34 vaddr=40813140 size=02938h ( 10552) load
I (237) boot: Loaded app from partition at offset 0x10000
I (237) boot: Disabling RNG early entropy source...
I (249) cpu_start: Unicore app
None
Waiting for the device to reconnect
I (890) BLE_INIT: Using main XTAL as clock source
I (890) BLE_INIT: ble controller commit:[392c824]
I (890) phy_init: phy_version 310,dde1ba9,Jun  4 2024,16:38:11
I (950) phy: libbtbb version: 04952fd, Jun  4 2024, 16:38:26
I (950) NimBLE_BLE_PRPH: BLE Host Task Started
I (950) NimBLE: Device Address:
I (950) NimBLE: 40:4c:ca:57:d4:92
I (960) NimBLE:

I (960) NimBLE: GAP procedure initiated: extended advertise; instance=0

I (970) uart: queue free spaces: 8
I (970) main_task: Returned from app_main()
BTW: In main.c, I had to change

Code: Select all

case BLE_GAP_EVENT_LINK_ESTAB
to

Code: Select all

case BLE_GAP_EVENT_CONNECT

to get the example to compile.

Has anyone been able to get the extended advertising running? Am I missing something?

--
Reagrds

chegewara
Posts: 2332
Joined: Wed Jun 14, 2017 9:00 pm

Re: Extended Advertising

Postby chegewara » Tue Oct 01, 2024 4:53 am

Not all applications can detect extended advertising, thats probably the reason you cant detect device on smartphone (it is not compatible with normal advertising).
Normal advertising and extended advertising are using different set of API to prepare and start advertising, but they should be running simultaneously if you need it.

Borealis
Posts: 2
Joined: Mon Sep 30, 2024 6:57 am

Re: Extended Advertising

Postby Borealis » Tue Oct 01, 2024 6:52 am

Thanks for your answer. nRF Connect app can detect extended advertising, I have already used it for that purpose in other projects.

Any other tips?

Who is online

Users browsing this forum: Mitchel and 61 guests