Closed dtodor closed 2 years ago
It seems that the BLE connection is established, but the service discovery fails.
Service discovery fails as the device is not able to successfully connect to the Wi-Fi network. See the logs:
I (5287) chip[DL]: WiFi station state change: Connecting -> Connecting_Failed
W (5287) wifi:Haven't to connect to a suitable AP now!
I (5297) chip[DL]: WiFi station state change: Connecting_Failed -> NotConnected
Can you please confirm if the AP SSID/passphrase is correct or the AP is in range?
The BLE service discovery fails:
2022-02-14 15:14:34.455678+0100 CHIPTool[12159:4753756] [all] š“ [1644848074455] [12159:4753756] CHIP: [BLE] Service not found on the device.
The WiFi data is configured in the app, the WiFi credentials are not being provisioned. Not even a PASE session is established.
The device side logs show a Wi-Fi STA connection being initiated and unsuccessful, and may be that's why the BLE related stuff isn't initialized. If the regular BLE Wi-Fi commissioning is to be carried out from the iOS CHIPTool app, then can you please erase-flash on the ESP32 side and try again
After erasing the flash and installing the application again, the behaviour is the same. According to the docs, the default Rendezvous mode for ESP32 is BLE. You can also see in the logs that the BLE advertisement has been started:
I (3130) chip[DL]: Configuring CHIPoBLE advertising (interval 25 ms, connectable, device name MATTER-3840)
I (3130) chip[DL]: Device already advertising, stop active advertisement and restart
I (3150) NimBLE: GAP procedure initiated: stop advertising.
I (3150) NimBLE: GAP procedure initiated: advertise;
I (3160) NimBLE: disc_mode=2
I (3160) NimBLE: adv_channel_map=0 own_addr_type=2 adv_filter_policy=0 adv_itvl_min=40 adv_itvl_max=40
I (3170) NimBLE:
I'm building the python controller for Linux, will try to pair the device using it.
So, I can confirm that pairing with the Linux python controller (Debian 11) works fine. So this should be Darwin related.
Am I the only one experiencing this error? No one else is using a Mac for development?
I'm building the python controller for Linux, will try to pair the device using it. It should work fine with Linux chip-tool as well.
Also, if it is Monterey then there were some issues related to BLE AFAIK cc @vivien-apple
I updated to Monterey 12.2.1 today and seeing the same issue. It was working yesterday on Big Sur.
Log attached of attempting to pair with standalone CHIP tool: chip-tool-log.txt
This is most likely due to iOS (>=15.1) and macOS (>=12.2.1) somehow "swallowing" the Bluetooth Service UUID 0xFFF6 and not letting it onto the application layer. I have tried to change the UUID in both the DUT software and the CHIP stack to something else (i.e. 0x0FF6), which makes it work on iOS and macOS.
@tlykkeberg-grundfos which files do I specifically need to update (and where) for me to try this? Thanks
@tlykkeberg-grundfos which files do I specifically need to update (and where) for me to try this? Thanks
First you need to change the Service UUID which the chip-tool is looking for. This is specified in src/ble/BleUUID.cpp
in line 31, which holds the CHIP_BLE_SVC_ID
. I changed it to 0x00, 0x00, 0x0F, 0xF6, 0x00 ....
Then you would need to change it for your particular platform (mine is CC2652R7 from TI), but the files you would need to change is in the src/platform/....
directory. For the TI platform it is: src/platform/cc13x2_26x2/chipOBleProfile.h
in which I changed the CHIPOBLE_SERV_UUID
from 0xFFF6
to 0x0FF6
.
Thanks for the quick reply @tlykkeberg-grundfos
I tried your suggestion (although perhaps I did something wrong).
modified: ../../../src/ble/BleUUID.cpp
Modified line 31, which holds the CHIP_BLE_SVC_ID. I changed it to 0x00, 0x00, 0x0F, 0xF6, 0x00
modified: ../../../src/platform/Ameba/BLEManagerImpl.cpp
modified: ../../../src/platform/CYW30739/cycfg_gatt_db.h
modified: ../../../src/platform/ESP32/nimble/BLEManagerImpl.cpp
modified: ../../../src/platform/Linux/BLEManagerImpl.cpp
modified: ../../../src/platform/Linux/bluez/Helper.cpp
modified: ../../../src/platform/P6/cycfg_gatt_db.h
modified: ../../../src/platform/Zephyr/BLEManagerImpl.cpp
modified: ../../../src/platform/cc13x2_26x2/chipOBleProfile.h
modified: ../../../src/platform/mbed/BLEManagerImpl.cpp
modified: ../../../src/platform/nxp/k32w/k32w0/gatt_uuid128.h
I'll be honest, I wasn't sure which file to modify, so I modified all the files in the src/platform/....
directory which mentioned 0xFFF6
to 0x0FF6
I then went through the following:
cd ${HOME}/tools/esp-idf
. ./export.sh
cd ~/Desktop/connectedhomeip
source ./scripts/bootstrap.sh
source ./scripts/activate.sh
cd ~/Desktop/connectedhomeip/examples/all-clusters-app/esp32
idf.py set-target esp32
idf.py build
idf.py -p /dev/cu.SLAB_USBtoUART erase_flash
idf.py -p /dev/cu.SLAB_USBtoUART flash monitor
And then finally attempted pairing again:
cd ~/Desktop/connectedhomeip/examples/chip-tool
./out/debug/chip-tool pairing ble-wifi 112233 {ssid} {pw} 20202021 3840
But still the pairing is failing on Monterey 12.2.1. As mentioned, it works fine on my laptop which is using Big Sur.
Log attached of the pairing: log.txt
@danh-geo It is a different error you see now. But perhaps this is because you have failed to setup the Service UUID (both long and short). You are using the Espressif platform (ESP32), but there are 2 variants, I noticed, in the src/platform/ESP32
directory.
src/platform/ESP32/nimble/BLEManagerImpl.cpp
:
const ble_uuid16_t ShortUUID_CHIPoBLEService = { BLE_UUID_TYPE_16, 0xFFF6 };
This must be changed to 0x0FF6
.
Or perhaps in: src/platform/ESP32/bluedroid/BLEManagerImpl.cpp
:
const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 };
const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF };
There you would need to change both the long (128-bit) and the short (16-bit) UUID.
@tlykkeberg-grundfos
So the first change you mentioned for src/platform/ESP32/nimble/BLEManagerImpl.cpp
I had already changed and was part of my modified files in my last comment.
I then modified src/platform/ESP32/bluedroid/BLEManagerImpl.cpp
as you suggested. This is what I changed it too:
const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x10, 0x00, 0x00, 0xF6, 0x0F, 0x00, 0x00 };
const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0x0F };
However the pairing still failed. Appreciating the help thus far.
Log attached. log.txt
Same here, after the changes I'm getting the same error with an ESP32 device.
OK, but now I'm getting the same error also on Linux. I've reverted all the BLE changes, but there seems to be a problem with the all-clusters-app.
Maybe problem related to https://github.com/project-chip/connectedhomeip/commit/907b0f36d3b528250d7efa17ae46e9fd103679e7?
@dtodor have you resolved this problem or still having issues with macOS chip-tool?
I think I need to update to macOS 12.3, haven't done this yet. On Linux the ESP32 problem has gone with the recent commits.
After updating to macOS 12.3, pairing over BLE works.
Commissioning over BLE doesn't seem to work with the current code base. I've tested the following setups:
Controllers
Devices
Here is the output of the iOS app:
Here is the output of the ESP32 device:
It seems that the BLE connection is established, but the service discovery fails.