espressif / esp-matter

Espressif's SDK for Matter
Apache License 2.0
698 stars 157 forks source link

Which version of IDF could be used to build project in connectedhomeoverip repo (CON-687) #565

Closed 404-code closed 1 year ago

404-code commented 1 year ago

Result

I tried the release/v5.1 branch, and it prompted "Please use idf.py only in an ESP-IDF shell environment." It works by idf v4.4.5

Envirionment

esp-idf: release/v5.1(79b1379662) v4.4.5(ac5d805d0e) matter sdk: v1.1.0.1 project: lighting demo (connectedhomeip/examples/lighting-app/esp32)

Step

  1. source connectedhomeip/scripts/activate.sh
  2. source esp-idf/export.sh
  3. cd connectedhomeip/example/lighting-app/esp32
  4. idf.py set-target esp32c3 and build

Other

I have compiled successfully once, but the device couldn't be commissioned. Error info:

E (123292) chip[CR]: mbedTLS error: CCM - Authenticated decryption failed
E (123302) chip[IN]: Secure transport received message, but failed to decode/authenticate it, discarding

Here is the log:

I (30) boot: ESP-IDF v5.1-480-g79b1379662 2nd stage bootloader
I (30) boot: compile time Aug  3 2023 17:07:06
I (30) boot: chip revision: v0.3
I (34) boot.esp32c3: SPI Speed      : 80MHz
I (39) boot.esp32c3: SPI Mode       : DIO
I (44) boot.esp32c3: SPI Flash Size : 4MB
I (49) boot: Enabling RNG early entropy source...
I (54) boot: Partition Table:
I (58) boot: ## Label            Usage          Type ST Offset   Length
I (65) boot:  0 esp_secure_cert  unknown          3f 06 0000d000 00002000
I (72) boot:  1 nvs              WiFi data        01 02 00010000 00006000
I (80) boot:  2 nvs_keys         NVS keys         01 04 00016000 00001000
I (87) boot:  3 otadata          OTA data         01 00 00017000 00002000
I (95) boot:  4 phy_init         RF data          01 01 00019000 00001000
I (102) boot:  5 ota_0            OTA app          00 10 00020000 001e0000
I (110) boot:  6 ota_1            OTA app          00 11 00200000 001e0000
I (117) boot:  7 fctry            WiFi data        01 02 003e0000 00006000
I (125) boot: End of partition table

..................................

I (121182) chip[DL]: BLE GAP connection established (con 1)
I (121182) chip[DL]: CHIPoBLE advertising stopped
I (121182) app-devicecallbacks: Current free heap: 81296

I (122002) CHIP[DL]: Write request received for CHIPoBLE RX characteristic con 1 12
I (122012) chip[BLE]: local and remote recv window sizes = 5
I (122022) chip[BLE]: selected BTP version 4
I (122022) chip[BLE]: using BTP fragment sizes rx 128 / tx 128.
I (122062) chip[DL]: Write request/command received for CHIPoBLE TX CCCD characteristic (con 1 ) indicate = 1
I (122062) chip[DL]: CHIPoBLE subscribe received
I (122062) NimBLE: GATT procedure initiated: indicate; 
I (122072) NimBLE: att_handle=14

I (122092) app-devicecallbacks: CHIPoBLE connection established
I (122092) app-devicecallbacks: Current free heap: 79724

I (122162) chip[DL]: Confirm received for CHIPoBLE TX characteristic indication (con 1) status= 14 
I (122162) CHIP[DL]: Write request received for CHIPoBLE RX characteristic con 1 12
I (122172) chip[EM]: >>> [E:56833r S:0 M:17667236] (U) Msg RX from 0:5FF657BFA5782867 [0000] --- Type 0000:20 (SecureChannel:PBKDFParamRequest)
I (122192) chip[EM]: <<< [E:56833r S:0 M:25891891] (U) Msg TX to 0:0000000000000000 [0000] --- Type 0000:21 (SecureChannel:PBKDFParamResponse)
I (122202) chip[IN]: (U) Sending msg 25891891 to IP address 'BLE'
I (122202) NimBLE: GATT procedure initiated: indicate; 
I (122212) NimBLE: att_handle=14

I (122352) chip[DL]: Confirm received for CHIPoBLE TX characteristic indication (con 1) status= 14 
I (122352) NimBLE: GATT procedure initiated: indicate; 
I (122372) NimBLE: att_handle=14

I (122452) chip[DL]: Confirm received for CHIPoBLE TX characteristic indication (con 1) status= 14 
I (122452) CHIP[DL]: Write request received for CHIPoBLE RX characteristic con 1 12
I (122462) chip[EM]: >>> [E:56833r S:0 M:17667237] (U) Msg RX from 0:5FF657BFA5782867 [0000] --- Type 0000:22 (SecureChannel:PASE_Pake1)
I (122952) chip[EM]: <<< [E:56833r S:0 M:25891892] (U) Msg TX to 0:0000000000000000 [0000] --- Type 0000:23 (SecureChannel:PASE_Pake2)
I (122972) chip[IN]: (U) Sending msg 25891892 to IP address 'BLE'
I (122972) NimBLE: GATT procedure initiated: indicate; 
I (122982) NimBLE: att_handle=14

I (123042) chip[DL]: Confirm received for CHIPoBLE TX characteristic indication (con 1) status= 14 
I (123042) NimBLE: GATT procedure initiated: indicate; 
I (123052) NimBLE: att_handle=14

I (123132) chip[DL]: Confirm received for CHIPoBLE TX characteristic indication (con 1) status= 14 
I (123132) CHIP[DL]: Write request received for CHIPoBLE RX characteristic con 1 12
I (123152) chip[EM]: >>> [E:56833r S:0 M:17667238] (U) Msg RX from 0:5FF657BFA5782867 [0000] --- Type 0000:24 (SecureChannel:PASE_Pake3)
I (123162) chip[EM]: <<< [E:56833r S:0 M:25891893] (U) Msg TX to 0:0000000000000000 [0000] --- Type 0000:40 (SecureChannel:StatusReport)
I (123172) chip[IN]: (U) Sending msg 25891893 to IP address 'BLE'
I (123172) NimBLE: GATT procedure initiated: indicate; 
I (123192) NimBLE: att_handle=14

I (123192) chip[SC]: SecureSession[0x3fc9a7e0]: Moving from state 'kEstablishing' --> 'kActive'
I (123202) chip[SVR]: Commissioning completed session establishment step
I (123202) chip[DIS]: Updating services using commissioning mode 0
I (123212) chip[DIS]: CHIP minimal mDNS started advertising.
I (123212) chip[SVR]: Device completed Rendezvous process
I (123282) chip[DL]: Confirm received for CHIPoBLE TX characteristic indication (con 1) status= 14 
I (123282) CHIP[DL]: Write request received for CHIPoBLE RX characteristic con 1 12
E (123292) chip[CR]: mbedTLS error: CCM - Authenticated decryption failed
E (123302) chip[IN]: Secure transport received message, but failed to decode/authenticate it, discarding
I (125792) NimBLE: GATT procedure initiated: indicate; 
I (125792) NimBLE: att_handle=14
shubhamdp commented 1 year ago

@404-code did you run esp-idf/install.sh script?

shubhamdp commented 1 year ago

For applications in connectedhomeip repository, please follow steps mentioned in https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/esp32/setup_idf_chip.md

404-code commented 1 year ago

@404-code did you run esp-idf/install.sh script?

thanks first, I have already installed the idf and matter environment (./install.sh esp32c3 and ./scripts/bootstrap). After I run export.sh and activate.sh in same terminal, it prompt that message when I use idf.py."Please use idf.py only in an ESP-IDF shell environment."

shubhamdp commented 1 year ago

This is because you are using the latest IDF and you do not have esp_idf_monitor python package installed in matter python environment.

You may hit few more issues faced in https://github.com/project-chip/connectedhomeip/issues/27313. I'd suggest you take a look at that as well.

404-code commented 1 year ago

This is because you are using the latest IDF and you do not have esp_idf_monitor python package installed in matter python environment.

You may hit few more issues faced in project-chip/connectedhomeip#27313. I'd suggest you take a look at that as well.

thanks, it works. But I face another promble, I couldn't commission it by apple or google home. The error message is:

I (447495) chip[DL]: Confirm received for CHIPoBLE TX characteristic indication (con 1) status= 14 
I (447495) CHIP[DL]: Write request received for CHIPoBLE RX characteristic con 1 12
I (447505) chip[EM]: >>> [E:51114r S:0 M:231935804] (U) Msg RX from 0:E532F14AB282BC0B [0000] --- Type 0000:40 (SecureChannel:StatusReport)
E (447525) chip[SC]: Received error (protocol code 2) during PASE process: 38
E (447535) chip[SC]: Failed during PASE session setup: 38
E (447535) chip[SVR]: Commissioning failed (attempt 1): 38

it seems that the password is not 20202021. I don't change any configuration, just use demo default menuconfig.I tried chip-tool on raspberrypi, and I intentionally used the wrong password. Finally, I got the same error log.

ps

the chip repo is the tag: v1.1.0.1, I just replace the scripts/setup/requirements.esp32.txt with the file in master branch.

shubhamdp commented 1 year ago

@404-code Please attach complete logs for better understanding. Can you try commissioning with chip-tool? For, Home apps, which onboarding code you are using?

I may have a guess but not sure, if thats because of this... try enabling CONFIG_MBEDTLS_HKDF_C=y option.

404-code commented 1 year ago

@shubhamdp I enable the CONFIG_MBEDTLS_HKDF_C=y option, it works. Now I would close the issue. Thank you.