Page 1 of 1

ESP-IDF 05_ble_adv example, no advertisements seen on IOS devices ?

Posted: Fri Oct 07, 2016 10:33 am
by lakid74
Hi I might be doing something wrong here but here it goes..
I can compile and upload the sample just fine.
The logs on my esp32 dev board show the app running and moving thru the
ble states
hci_cmd_send_reset();
hci_cmd_send_ble_set_adv_param();
hci_cmd_send_ble_set_adv_data();
hci_cmd_send_ble_adv_start();
So everything appears to be working, but I cannot see the advertisements appear on any apple device. Has anyone got it working on IOS and if so which BLE explorer app did you use ?
Is there any config required in the app before you compile it ?
Thanks

Re: ESP-IDF 05_ble_adv example, no advertisements seen on IOS devices ?

Posted: Fri Oct 07, 2016 10:59 am
by WiFive

Re: ESP-IDF 05_ble_adv example, no advertisements seen on IOS devices ?

Posted: Fri Oct 07, 2016 12:06 pm
by lakid74
OK, so that proves it works fine for iOS devices.
The question is, does the code need anything done to it (beyond download, make defaultconfig, make and make flash) to make it work ?

Re: ESP-IDF 05_ble_adv example, no advertisements seen on IOS devices ?

Posted: Fri Oct 07, 2016 1:34 pm
by ESP_igrr
Make sure you have BLE stack enabled in make menuconfig.

Re: ESP-IDF 05_ble_adv example, no advertisements seen on IOS devices ?

Posted: Fri Oct 07, 2016 11:00 pm
by lakid74
Yep BT stack is enable (assuming that is the same as BLE stack) ?
sdkconfig, make flash and console output is pasted below.
Thanks for all of your work igrr on the esp8266 and esp32, you are a legend !

Code: Select all

[lakidd1:...esp-idf/examples/05_ble_adv]$ cat sdkconfig                                                                        (master✱)
#
# Automatically generated file; DO NOT EDIT.
# Espressif IoT Development Framework Configuration
#

#
# SDK tool configuration
#
CONFIG_TOOLPREFIX="xtensa-esp32-elf-"
CONFIG_PYTHON="python"

#
# Bootloader config
#
# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set
# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set
CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y
# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set
# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set
# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set
CONFIG_LOG_BOOTLOADER_LEVEL=2

#
# Serial flasher config
#
CONFIG_ESPTOOLPY_PORT="/dev/tty.SLAB_USBtoUART"
CONFIG_ESPTOOLPY_BAUD_115200B=y
# CONFIG_ESPTOOLPY_BAUD_230400B is not set
# CONFIG_ESPTOOLPY_BAUD_921600B is not set
# CONFIG_ESPTOOLPY_BAUD_2MB is not set
# CONFIG_ESPTOOLPY_BAUD_OTHER is not set
CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
CONFIG_ESPTOOLPY_BAUD=115200
# CONFIG_ESPTOOLPY_COMPRESSED is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set
# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set
CONFIG_ESPTOOLPY_FLASHMODE="dio"
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
CONFIG_ESPTOOLPY_FLASHFREQ="40m"

#
# Partition Table
#
CONFIG_PARTITION_TABLE_SINGLE_APP=y
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
# CONFIG_PARTITION_TABLE_CUSTOM is not set
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET=0x10000
CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv"
CONFIG_APP_OFFSET=0x10000

#
# Component config
#

#
# BT config
#
CONFIG_BT_ENABLED=y
CONFIG_BT_RESERVE_DRAM=0x10000

#
# ESP32-specific config
#
# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set
# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
# CONFIG_ESP32_ENABLE_STACK_WIFI is not set
CONFIG_ESP32_ENABLE_STACK_BT=y
# CONFIG_ESP32_ENABLE_STACK_NONE is not set
CONFIG_MEMMAP_BT=y
CONFIG_MEMMAP_SMP=y
# CONFIG_MEMMAP_TRACEMEM is not set
CONFIG_TRACEMEM_RESERVE_DRAM=0x0
# CONFIG_MEMMAP_SPISRAM is not set
CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32
CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2048
CONFIG_MAIN_TASK_STACK_SIZE=4096
CONFIG_NEWLIB_STDOUT_ADDCR=y
# CONFIG_ULP_COPROC_ENABLED is not set
CONFIG_ULP_COPROC_RESERVE_MEM=0

#
# FreeRTOS
#
# CONFIG_FREERTOS_UNICORE is not set
CONFIG_FREERTOS_CORETIMER_0=y
# CONFIG_FREERTOS_CORETIMER_1 is not set
# CONFIG_FREERTOS_CORETIMER_2 is not set
CONFIG_FREERTOS_HZ=100
CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y
CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE=y
# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set
# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY is not set
CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1
# CONFIG_FREERTOS_PANIC_PRINT_HALT is not set
CONFIG_FREERTOS_PANIC_PRINT_REBOOT=y
# CONFIG_FREERTOS_PANIC_SILENT_REBOOT is not set
# CONFIG_FREERTOS_PANIC_GDBSTUB is not set
CONFIG_FREERTOS_DEBUG_OCDAWARE=y
CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y
# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set
# CONFIG_FREERTOS_ASSERT_DISABLE is not set
CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG=y
# CONFIG_ENABLE_MEMORY_DEBUG is not set
# CONFIG_FREERTOS_DEBUG_INTERNALS is not set

#
# Log output
#
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_COLORS=y

#
# LWIP
#
CONFIG_LWIP_MAX_SOCKETS=4
CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX=0
# CONFIG_LWIP_SO_REUSE is not set

#
# mbedTLS
#
CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=16384
# CONFIG_MBEDTLS_DEBUG is not set

#
# SPI Flash driver
#
# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set

Code: Select all

[lakidd1:...esp-idf/examples/05_ble_adv]$ make flash                                                                           (master✱)
Flashing project app to 0x10000...
esptool.py v2.0-dev
Connecting...
Uploading stub...
Calling 4009068c
Stub running...
Attaching SPI flash...
Configuring flash size...
Erasing flash...
Took 0.00s to erase flash block
Wrote 8192 bytes at 0x00001000 in 0.7 seconds (91.1 kbit/s)...
Hash of data verified.
Erasing flash...
Took 0.00s to erase flash block
Wrote 253952 bytes at 0x00010000 in 22.5 seconds (90.4 kbit/s)...
Hash of data verified.
Erasing flash...
Took 0.00s to erase flash block
Wrote 8192 bytes at 0x00004000 in 0.7 seconds (91.6 kbit/s)...
Hash of data verified.

Leaving...

A fatal error occurred: Failed to enter RAM download mode (result was 0xff, 0x0)
make: *** [flash] Error 2
I believe the fatal error above is cosmetic ?

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3ffc0000,len:0
load:0x3ffc0000,len:920
load:0x40078000,len:2724
ho 0 tail 12 room 4
load:0x40098000,len:508
entry 0x40098118
␛[0;32mI (68) heap_alloc_caps: Initializing heap allocator:␛[0m
␛[0;32mI (68) heap_alloc_caps: Region 19: 3FFC4EF8 len 0001B108 tag 0␛[0m
␛[0;32mI (69) heap_alloc_caps: Region 25: 3FFE8000 len 00018000 tag 1␛[0m
␛[0;32mI (79) cpu_start: Pro cpu up.␛[0m
␛[0;32mI (84) cpu_start: Starting app cpu, entry point is 0x40080960␛[0m
␛[0;32mI (0) cpu_start: App cpu up.␛[0m
␛[0;32mI (99) cpu_start: Pro cpu start user code␛[0m
rtc v112 Sep 22 2016 16:08:39
XTAL 40M
␛[0;32mI (135) cpu_start: Starting scheduler on PRO CPU.␛[0m
BTDM CONTROLLER VERSION: 010101
btip start
 3ffbff70, len 00007f70U.␛[ t (43) c, _sta0t:01tar
BTDM ROM VERSION 0101
BD_ADDR: 00:00:00:00:00:00
NVDS MAGIC FAILED
phy_version: 123, Sep 13 2016, 20:01:58, 0
EM BASE 3ffb0000
110, 130, 42
RF Init OK
BLE advt task start
BLE Advertise, flag_send_avail: 1, cmd_sent: 1
controller rcv pkt ready
host rcv pkt: 040e0405030c00
BLE Advertise, flag_send_avail: 1, cmd_sent: 2
controller rcv pkt ready
host rcv pkt: 040e0405062000
BLE Advertise, flag_send_avail: 1, cmd_sent: 3
controller rcv pkt ready
host rcv pkt: 040e0405082000
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
controller rcv pkt ready
host rcv pkt: 040e04050a2000
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
BLE Advertise, flag_send_avail: 1, cmd_sent: 4
BLE Advertise, flag_send_avail: 1, cmd_sent: 4

Re: ESP-IDF 05_ble_adv example, no advertisements seen on IOS devices ?

Posted: Sat Oct 08, 2016 5:34 am
by lakid74
ok so replying to myself, using LightBlue on OS X I can see the ESP-HELLO-BLE string but it seems like it advertises itself once and then stays in hci_cmd_send_ble_adv_start forever. If LightBlue isn't running when the program first executes then the announcement is never seen.
Is that what is expected ? or should it continuously advertise ? I am a BLE noob
:-)