Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ESP32] cannot find Discriminator: 3840 on all-cluster-app via chip-device-ctrl(python) #20470

Closed
mmt-10 opened this issue Jul 8, 2022 · 15 comments

Comments

@mmt-10
Copy link

mmt-10 commented Jul 8, 2022

Problem

  • expected behavior

ble-scan on chip-device-ctrl can find discriminator:3840.

chip-device-ctrl > ble-scan
2022-07-08 09:28:10,520 ChipBLEMgr INFO scanning started
2022-07-08 09:28:11,044 ChipBLEMgr INFO Name = None
2022-07-08 09:28:11,045 ChipBLEMgr INFO ID = 12a18652-bbd8-41e5-ac1c-35067f35d0cb
2022-07-08 09:28:11,047 ChipBLEMgr INFO RSSI = -59
2022-07-08 09:28:11,048 ChipBLEMgr INFO Address = 7E:1E:1E:79:4F:F7
2022-07-08 09:28:11,053 ChipBLEMgr INFO Pairing State = 0
2022-07-08 09:28:11,053 ChipBLEMgr INFO Discriminator = 3840
2022-07-08 09:28:11,054 ChipBLEMgr INFO Vendor Id = 9050
2022-07-08 09:28:11,054 ChipBLEMgr INFO Product Id = 17729
2022-07-08 09:28:11,077 ChipBLEMgr INFO Adv UUID = 0000fff6-0000-1000-8000-00805f9b34fb
2022-07-08 09:28:11,082 ChipBLEMgr INFO Adv Data = 00000f5a234145
2022-07-08 09:28:11,083 ChipBLEMgr INFO
2022-07-08 09:28:21,198 ChipBLEMgr INFO scanning stopped
chip-device-ctrl >

  • actual behavior

ble-scan on master branch cannot detect discriminator.
I guess the ESP32 for all-cluster-app on master branch did not set Discriminator, Vendor Id and Product Id.
chip-device-ctrl on master branch does not work.
therefore, I use chip-device-ctrl on test_event_4_2021_07_06.

  • steps to reproduce

  • system configuration
    Board : ESP32-C3-DevKitM-1

    • connectedhomeip version
$ git log -1
commit 126f6b2915fc26ee17342e1dc80f96f031938a6c (HEAD -> master, origin/master, origin/HEAD)
Author: Stefan Agner <[email protected]>
Date:   Wed Jul 6 15:04:20 2022 +0200

   [python] Move string encoding to ChipDeviceCtrl.py (#20306)
    
   * Encode strings in ChipDeviceCtrl.py
    
   * Fix Python tests
* ESP-IDF version
$ git log -1
commit 1329b19fe494500aeb79d19b27cfd99b40c37aec (HEAD, tag: v4.4.1)
Author: Michael (XIAO Xufeng) <[email protected]>
Date:   Sat Apr 16 09:43:14 2022 +0800

    versions: Update version to 4.4.1
  • screenshots, images, logs, etc.

chip-device-ctrl > ble-scan
2022-07-08 08:08:54,980 ChipBLEMgr INFO scanning started
2022-07-08 08:08:55,225 ChipBLEMgr INFO Name = None
2022-07-08 08:08:55,226 ChipBLEMgr INFO ID = 4ab2afe7-351f-4c98-a74b-a9c565ca9dba
2022-07-08 08:08:55,228 ChipBLEMgr INFO RSSI = -32
2022-07-08 08:08:55,230 ChipBLEMgr INFO Address = C8:E8:F5:91:36:6F
2022-07-08 08:08:55,238 ChipBLEMgr INFO Adv UUID = 0000fff6-0000-1000-8000-00805f9b34fb
2022-07-08 08:08:55,240 ChipBLEMgr INFO Adv Data = 00000ff1ff008000
2022-07-08 08:08:55,240 ChipBLEMgr INFO
2022-07-08 08:09:05,171 ChipBLEMgr INFO scanning stopped
chip-device-ctrl >

Proposed Solution

<suggested fix, suggested enhancement>

@dhrishi
Copy link
Contributor

dhrishi commented Jul 8, 2022

2022-07-08 18:00:57,607 ChipBLEMgr INFO Adv Data = 00000ff1ff018000

HI @tatsutaigu The "Adv Data" that you see above has the discriminator: 0xF00 (3840), VID: 0xFFF1 as well as PID: 0x8001 in the format as required by the specification. You can verify the same with your values.

Edit: Using the default values for VID, PID here

@mmt-10
Copy link
Author

mmt-10 commented Jul 11, 2022

Hi, @dhrishi
Thank you for your reply.

I use chip-tool and it can find ESP32.
However, chip-tool was stopped as Aborted (core dumped).

Below is log.
chip-tool_20220711.txt

@dhrishi
Copy link
Contributor

dhrishi commented Jul 11, 2022

@tatsutaigu Does this happen everytime? The chip-tool logs show that there was a timeout during commissioning:

[1657513297.745925][3087:3121] CHIP:DMG: Time out! failed to receive invoke command response from Exchange: 16153i
[1657513297.745999][3087:3121] CHIP:CTL: Device failed to receive the Attestation Information Response: ../../third_party/connectedhomeip/src/app/CommandSender.cpp:214: CHIP Error 0x00000032: Timeout
[1657513297.746030][3087:3121] CHIP:CTL: Error on commissioning step 'SendAttestationRequest': '../../third_party/connectedhomeip/src/app/CommandSender.cpp:214: CHIP Error 0x00000032: Timeout'
[1657513297.746045][3087:3121] CHIP:CTL: Failed to perform commissioning step 7

Can you please provide the device side logs too? And other details about the branch/commit id you are using?

@mmt-10
Copy link
Author

mmt-10 commented Jul 11, 2022

@dhrishi

Does this happen everytime?

Yes, it happen everytime.
I will write logs next paragraph.

I tried all-clusters-app example.
I do below command for build.

$ cd $CONNECTEDHOMEIPPATH
$ source ./scripts/bootstrap.sh
$ source ./scripts/activate.sh
$ cd examples/all-clusters-app/esp32/
$ . ./$ESPIDFPATH/export.sh
$ mv sdkconfig.defaults sdkconfig_esp32.defaults
$ ln -s sdkconfig_c3devkit.defaults sdkconfig.defaults
$ idf.py set-target esp32c3
$ idf.py build
$ idf.py -p /dev/ttyUSB0 erase_flash flash

I'm using below branch/commit id for connectedhomeip and ESP-IDF.

  • connectedhomeip

$ git log -1
commit 126f6b2 (HEAD -> master, origin/master, origin/HEAD)
Author: Stefan Agner [email protected]
Date: Wed Jul 6 15:04:20 2022 +0200

[python] Move string encoding to ChipDeviceCtrl.py (#20306)

  • Encode strings in ChipDeviceCtrl.py

  • Fix Python tests

  • ESP-IDF

$ git log -1
commit 1329b19fe494500aeb79d19b27cfd99b40c37aec (HEAD, tag: v4.4.1)
Author: Michael (XIAO Xufeng) [email protected]
Date: Sat Apr 16 09:43:14 2022 +0800

versions: Update version to 4.4.1

@mmt-10
Copy link
Author

mmt-10 commented Jul 11, 2022

Logs

@dhrishi
Copy link
Contributor

dhrishi commented Jul 12, 2022

$ ln -s sdkconfig_c3devkit.defaults sdkconfig.defaults

This is not required. When you do idf.py set-target esp32c3 the sdkconfig gets updated appropriately. Can you please try with the latest codebase. I am able to get this to work fine with it.

@bzbarsky-apple
Copy link
Contributor

@tatsutaigu Please attach logs instead of pasting, or at least wrap them in <details> bits....

@mmt-10
Copy link
Author

mmt-10 commented Jul 12, 2022

@dhrishi
I tried your suggestion.
However, Timeout occurred.
it may chip-tool issue?
for example, chip-tool has insufficient control of BLE controller?

@bzbarsky-apple
I change it.

I will be out of the home today and tomorrow, so, my reply will be delaying.
I'm sorry for inconvenience.

@mmt-10
Copy link
Author

mmt-10 commented Jul 13, 2022

@dhrishi
I would like to know commit ID of working on yours.

I tried latest connectedhomeip.
However, error occurred.
And, Matter device does not clear.
run chip-tool then Matter device increases as below.

BLE-Screenshot

$ git log -1
commit a903f59 (HEAD -> master, origin/master, origin/HEAD)
Author: Kamil Kasperczyk [email protected]
Date: Tue Jul 12 23:01:25 2022 +0200

[nrfconnect] Added mode allowing to send new Cert. Decl. in OTA DFU (#20609)

It is still not agreed if certification declaration that is part
of a firmware will be allowed to change after certification.
It might happen that the CD will need to be changed some other
way than modifying the firmware.

* Added config option allowing to enable certification declaration
storage.
* Added handler that is able to read CD from OTA DFU image
and save it in the Zephyr settings.
* Added nRFConnect define to set the Certification Declaration
value and not use the hardcoded one.

$ git log -1
commit 1329b19fe494500aeb79d19b27cfd99b40c37aec (HEAD, tag: v4.4.1)
Author: Michael (XIAO Xufeng) [email protected]
Date: Sat Apr 16 09:43:14 2022 +0800

versions: Update version to 4.4.1

@dhrishi
Copy link
Contributor

dhrishi commented Jul 13, 2022

Ohh, my bad. I am on the latest commit on my fork which is dhrishi@8ebd7f0 (around 63 commits behind) and it works there. I will update to the latest codebase and try

@dhrishi
Copy link
Contributor

dhrishi commented Jul 13, 2022

@tatsutaigu I am able to perform commissioning and cluster control on the current latest commit on upstream connectedhomeip 51e41f9
Please see attached logs
esp32c3_51e41f9.txt
chip-tool_51e41f9.txt

@mmt-10
Copy link
Author

mmt-10 commented Jul 15, 2022

@dhrishi
Thank for your information.
I tried 51e41f9, but error occurred.
chip-tool-51e41f9.txt

esp32-c3-51e41f9.txt

My environment:
Ubuntu 20.04
Celeron N3350 ( ZBOX PI225 pico )
This environment successfully completed commissioning with test_event_4_2021_07_06.
chip-tool on test_event_4_2021_07_06/ does not work, so I use chip-device-ctrl on python.
It is written in Readme.

chip-device-ctrl-test_event_4_2021_07_06.txt
esp32-c3-test_event_4_2021_07_06.txt

@mmt-10
Copy link
Author

mmt-10 commented Jul 15, 2022

@dhrishi

I tried
chip-device-ctrl on test_event_4_2021_07_06 and esp32-c3 all-cluster-app on 51e41f9.
NG_chip-device-ctrl-test_event_4_2021_07_06.txt
NG_esp32-c3-51e41f9.txt

chip-device-ctrl on 51e41f9 could not run, it aborted.
Therefore, I cannot test chip-device-ctrl on 51e41f9 and esp32-c3 all-cluster-app on test_event_4_2021_07_06.

@mmt-10
Copy link
Author

mmt-10 commented Jul 19, 2022

@dhrishi
all-cluster-app example on ESP32-C3 is working.
root cause is relation chip-tool and bluetooth adapter.

I inserted bluetooth dongle to USB and I choose dongle via --ble-adapter option on chip-tool, then Timeout error does not occur.

current chip-tool is degradation from test_event_4_2021_07_06
python chip-device-ctrl.

should I change title [ESP32] to [chip-tool]?
and, moderator will change label esp32 to chip-tool?

[1658188151.168122][10375:10380] CHIP:DMG: Time out! failed to receive invoke command response from Exchange: 53514i
[1658188151.168195][10375:10380] CHIP:CTL: Device failed to receive the CSR request Response: ../../third_party/connectedhomeip/src/app/CommandSender.cpp:214: CHIP Error 0x00000032: Timeout
[1658188151.168231][10375:10380] CHIP:CTL: Error on commissioning step 'SendOpCertSigningRequest': '../../third_party/connectedhomeip/src/app/CommandSender.cpp:214: CHIP Error 0x00000032: Timeout'
[1658188151.168246][10375:10380] CHIP:CTL: Failed to perform commissioning step 9
[1658188151.168260][10375:10380] CHIP:CTL: Going from commissioning step 'SendOpCertSigningRequest' with lastErr = '../../third_party/connectedhomeip/src/app/CommandSender.cpp:214: CHIP Error 0x00000032: Timeout' -> 'Cleanup'
[1658188151.168285][10375:10380] CHIP:CTL: Performing next commissioning step 'Cleanup' with completion status = '../../third_party/connectedhomeip/src/app/CommandSender.cpp:214: CHIP Error 0x00000032: Timeout'

$ git log -1
commit aa9457e (HEAD -> master, origin/sve, origin/master, origin/HEAD)
Author: manjunath-grl [email protected]
Date: Sun Jul 17 07:47:19 2022 +0530

Manual and modified script update (#20821)
  • bluetooth interface on PC

$ hciconfig --all
hci1: Type: Primary Bus: USB
BD Address: 00:1B:DC:FE:D1:61 ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
RX bytes:6232 acl:171 sco:0 events:135 errors:0
TX bytes:6200 acl:33 sco:0 commands:90 errors:0
Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'tatsutaigu-ZBOX-PI225'
Class: 0x0c0104
Service Classes: Rendering, Capturing
Device Class: Computer, Desktop workstation
HCI Version: 4.0 (0x6) Revision: 0x22bb
LMP Version: 4.0 (0x6) Subversion: 0x22bb
Manufacturer: Cambridge Silicon Radio (10)

hci0: Type: Primary Bus: USB
BD Address: F4:96:34:8F:7E:96 ACL MTU: 1021:5 SCO MTU: 96:6
UP RUNNING
RX bytes:2330 acl:0 sco:0 events:253 errors:0
TX bytes:41862 acl:0 sco:0 commands:252 errors:0
Features: 0xff 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF
Link mode: SLAVE ACCEPT
Name: 'tatsutaigu-ZBOX-PI225 #1'
Class: 0x0c0104
Service Classes: Rendering, Capturing
Device Class: Computer, Desktop workstation
HCI Version: 4.2 (0x8) Revision: 0x1000
LMP Version: 4.2 (0x8) Subversion: 0x1000
Manufacturer: Intel Corp. (2)

@mmt-10
Copy link
Author

mmt-10 commented Jul 21, 2022

Hi,
I use below commit ID, then It is resolved.

commit 5132358 (HEAD -> master, origin/master, origin/HEAD)

@mmt-10 mmt-10 closed this as completed Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants