CONFIG_IBEACON_MODE

tabulous
Posts: 34
Joined: Thu Nov 14, 2019 8:58 am

CONFIG_IBEACON_MODE

Postby tabulous » Thu Apr 02, 2020 11:15 am

Trying to setup iBecon demo.

ESP32 - running as iBeacon reciever.
Android phone - running Beacon Simulator(this enbales you phone to act as a iBeacon).


ESP firmware is built and running
rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:6368
ho 0 tail 12 room 4
load:0x40078000,len:13784
ho 0 tail 12 room 4
load:0x40080400,len:4260
entry 0x400806e4
I (32) boot: ESP-IDF v4.0-beta2 2nd stage bootloader
I (33) boot: compile time 11:02:30
I (33) boot: Enabling RNG early entropy source...
I (38) boot: SPI Speed : 40MHz
I (42) boot: SPI Mode : DIO
I (46) boot: SPI Flash Size : 4MB
I (50) boot: Partition Table:
I (53) boot: ## Label Usage Type ST Offset Length
I (61) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (68) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (76) boot: 2 factory factory app 00 00 00010000 00100000
I (83) boot: End of partition table
I (87) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x1afd4 (110548) map
I (136) esp_image: segment 1: paddr=0x0002affc vaddr=0x3ffbdb60 size=0x02c04 ( 11268) load
I (140) esp_image: segment 2: paddr=0x0002dc08 vaddr=0x40080000 size=0x00400 ( 1024) load
I (143) esp_image: segment 3: paddr=0x0002e010 vaddr=0x40080400 size=0x02000 ( 8192) load
I (155) esp_image: segment 4: paddr=0x00030018 vaddr=0x400d0018 size=0x7168c (464524) map
I (326) esp_image: segment 5: paddr=0x000a16ac vaddr=0x40082400 size=0x100e0 ( 65760) load
I (365) boot: Loaded app from partition at offset 0x10000
I (365) boot: Disabling RNG early entropy source...
I (366) cpu_start: Pro cpu up.
I (369) cpu_start: Application information:
I (374) cpu_start: Project name: ble_ibeacon_demo
I (380) cpu_start: App version: 1
I (384) cpu_start: Compile time: Apr 2 2020 12:05:20
I (390) cpu_start: ELF file SHA256: 9c7ce50c5ab55af8...
I (396) cpu_start: ESP-IDF: v4.0-beta2
I (402) cpu_start: Starting app cpu, entry point is 0x4008125c
I (392) cpu_start: App cpu up.
I (412) heap_init: Initializing. RAM available for dynamic allocation:
I (419) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (425) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (431) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (437) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (443) heap_init: At 3FFC89F0 len 00017610 (93 KiB): DRAM
I (450) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (456) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (462) heap_init: At 400924E0 len 0000DB20 (54 KiB): IRAM
I (469) cpu_start: Pro cpu start user code
I (487) spi_flash: detected chip: generic
I (488) spi_flash: flash io: dio
I (488) cpu_start: Chip Revision: 1
W (489) cpu_start: Chip revision is higher than the one configured in menuconfig. Suggest to upgrade it.
I (499) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (575) BTDM_INIT: BT controller compile version [d6bb204]
I (585) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (685) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
I (1005) IBEACON_DEMO: register callback


Issue is i never see the ESP32 dectect the iBeacon running on my phone.

tabulous
Posts: 34
Joined: Thu Nov 14, 2019 8:58 am

Re: CONFIG_IBEACON_MODE

Postby tabulous » Thu Apr 02, 2020 4:10 pm

anybody help ?

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

Re: CONFIG_IBEACON_MODE

Postby chegewara » Thu Apr 02, 2020 5:42 pm

There is not much to say with only those logs. There is no crash, no backtrace etc.
Without code nothing we can do.

tabulous
Posts: 34
Joined: Thu Nov 14, 2019 8:58 am

Re: CONFIG_IBEACON_MODE

Postby tabulous » Fri Apr 03, 2020 8:32 am

Why not build the iBeacon demo and get Beacon Simulator from google app store ?
This will then show you that the iBeacon are not received.

my issue is around this function that checks if the data is a valid ibeacon packet.

esp_ble_is_ibeacon_packet (uint8_t *adv_data, uint8_t adv_data_len)

the adv_data_len is showing as 27bytes..... but the check on the length is looking for 30bytes.

I (96385) IBEACON_DEMO: Device adv_data_length: 27
I (96635) IBEACON_DEMO: Device adv_data_length: 27
I (96775) IBEACON_DEMO: Device adv_data_length: 28
I (96885) IBEACON_DEMO: Device adv_data_length: 27
I (97025) IBEACON_DEMO: Device adv_data_length: 28
I (98065) IBEACON_DEMO: Device adv_data_length: 28
I (98165) IBEACON_DEMO: Device adv_data_length: 27
I (98425) IBEACON_DEMO: Device adv_data_length: 27
I (98575) IBEACON_DEMO: Device adv_data_length: 28

the 28 byte packets are altbeacons.


So why ? see attached img showing the debugging and the memory that does not look correct....
Untitled.jpg
Untitled.jpg (423.57 KiB) Viewed 6866 times

tabulous
Posts: 34
Joined: Thu Nov 14, 2019 8:58 am

Re: CONFIG_IBEACON_MODE

Postby tabulous » Fri Apr 03, 2020 10:34 am

the adv_data pointer is missing the 3 adv flags........

This is why the iBeacon is 27 and not 30 bytes long.

and this also means it would fail the next logic check

if (!memcmp(adv_data, (uint8_t*)&ibeacon_common_head, sizeof(ibeacon_common_head))){
result = true;
}

As the adv_data is missing the adv flags the content of adv_data will not be the same as ibeacon_comon_head.....!!!



So the question is why are the adv flags missing from the adv_data ?

tabulous
Posts: 34
Joined: Thu Nov 14, 2019 8:58 am

Re: CONFIG_IBEACON_MODE

Postby tabulous » Fri Apr 03, 2020 1:18 pm

and just for extra proof here is debug outputting avd_len and the avd_data

I (13675) IBEACON_DEMO: Device adv_data_length: 27
I (13675) IBEACON_DEMO: adv_data: 0 -> 1A //why is this the first byte it should be 0x02
I (13675) IBEACON_DEMO: adv_data: 1 -> FF
I (13675) IBEACON_DEMO: adv_data: 2 -> 4C
I (13685) IBEACON_DEMO: adv_data: 3 -> 00
I (13685) IBEACON_DEMO: adv_data: 4 -> 02
I (13695) IBEACON_DEMO: adv_data: 5 -> 15
I (13695) IBEACON_DEMO: adv_data: 6 -> 03
I (13705) IBEACON_DEMO: adv_data: 7 -> AE
I (13705) IBEACON_DEMO: adv_data: 8 -> FE
I (13715) IBEACON_DEMO: adv_data: 9 -> 97
I (13715) IBEACON_DEMO: adv_data: 10 -> EF
I (13725) IBEACON_DEMO: adv_data: 11 -> C2
I (13725) IBEACON_DEMO: adv_data: 12 -> 43
I (13735) IBEACON_DEMO: adv_data: 13 -> 73
I (13735) IBEACON_DEMO: adv_data: 14 -> 9C
I (13735) IBEACON_DEMO: adv_data: 15 -> A9
I (13745) IBEACON_DEMO: adv_data: 16 -> 05
I (13745) IBEACON_DEMO: adv_data: 17 -> AF
I (13755) IBEACON_DEMO: adv_data: 18 -> A9
I (13755) IBEACON_DEMO: adv_data: 19 -> 8E
I (13765) IBEACON_DEMO: adv_data: 20 -> D2
I (13765) IBEACON_DEMO: adv_data: 21 -> B4
I (13775) IBEACON_DEMO: adv_data: 22 -> 00
I (13775) IBEACON_DEMO: adv_data: 23 -> 7B
I (13785) IBEACON_DEMO: adv_data: 24 -> 01
I (13785) IBEACON_DEMO: adv_data: 25 -> C8
I (13795) IBEACON_DEMO: adv_data: 26 -> BF

tabulous
Posts: 34
Joined: Thu Nov 14, 2019 8:58 am

Re: CONFIG_IBEACON_MODE

Postby tabulous » Fri Apr 03, 2020 2:56 pm

found the issue, the app i was using was the fault........
Had another ESP32 module that i flashed up with the iBeacon sender and it now works ok

:-)

Who is online

Users browsing this forum: ok-home and 83 guests