Skip to content

Commit

Permalink
Merge branch 'fix/docs_for_manufacture' into 'master'
Browse files Browse the repository at this point in the history
Fixed the docs for manufacturing consideration and others

See merge request app-frameworks/esp-rainmaker!455
  • Loading branch information
dhrishi committed Jul 19, 2024
2 parents 794a5eb + 657fcaa commit 095e028
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
45 changes: 38 additions & 7 deletions examples/matter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Prerequisites

- ESP-IDF [v4.4.4](https://github.com/espressif/esp-idf/tree/v4.4.4) or [v5.0.1](https://github.com/espressif/esp-idf/tree/v5.0.1)
- ESP-IDF [v5.2.2](https://github.com/espressif/esp-idf/releases/v5.2.2)
- [ESP-Matter SDK](https://github.com/espressif/esp-matter)
- [ESP Rainmaker SDK](https://github.com/espressif/esp-rainmaker)
- [ESP Secure Cert Manager](https://github.com/espressif/esp_secure_cert_mgr)
Expand Down Expand Up @@ -39,18 +39,21 @@ This will fetch the device certificates and flash them on your device.

The factory nvs (fctry partition) needs to be generated using the mfg_tool of esp-matter

mfg_tool is moved to esp-matter-tools repo: https://github.com/espressif/esp-matter-tools/tree/main/mfg_tool.

It is released on pypi: https://pypi.org/project/esp-matter-mfg-tool and can be installed by running `pip install esp-matter-mfg-tool`

```
$ export ESP_SECURE_CERT_PATH=/path/to/esp_secure_cert_mgr
$ cd $ESP_MATTER_PATH/tools/mfg_tool
$ ./mfg_tool.py -v 0x131B -p 0x2 -cd $RMAKER_PATH/examples/matter/mfg/cd_131B_0002.der --csv $RMAKER_PATH/examples/matter/mfg/keys.csv --mcsv $RMAKER_PATH/examples/matter/mfg/master.csv
$ esp-matter-mfg-tool -v 0x131B -p 0x2 -cd $RMAKER_PATH/examples/matter/mfg/cd_131B_0002.der --csv $RMAKER_PATH/examples/matter/mfg/keys.csv --mcsv $RMAKER_PATH/examples/matter/mfg/master.csv
```

This not only generates the factory nvs binary required for matter, but also embeds the RainMaker MQTT Host url into it via the master.csv file. Optionally, you can embed the MQTT host into the firmware itself by using `idf.py menuconfig -> ESP RainMaker Config -> ESP_RMAKER_READ_MQTT_HOST_FROM_CONFIG` and then skipping the --csv and --mcsv options to mfg_tool

The factory binary generated above should be flashed onto the fctry partition (default : `0x3fa000` for ESP32-C6 and `0x3e0000` for other chips. Do check your partition table for exact address).
The factory binary generated above should be flashed onto the fctry partition (default : `0x3f8000` for ESP32-C6 and `0x3e0000` for other chips. Do check your partition table for exact address).

```
$ esptool.py write_flash 0x3e0000 $ESP_MATTER_PATH/tools/mfg_tool/out/131b_2/<node-id>/<node-id>-partition.bin
$ esptool.py write_flash 0x3e0000 out/131b_2/<node-id>/<node-id>_esp_secure_cert.bin 0x3e0000 out/131b_2/<node-id>/<node-id>-partition.bin
```

## Building the example
Expand All @@ -68,7 +71,7 @@ $ idf.py flash monitor
The QR Code required for commissioning your device can be found at `${ESP_MATTER_PATH}/tools/mfg_tool/out/<vendor-id>_<product-id>/<node-id>/<node-id>-qrcode.png`


## Manufacturing Considerations
## Manufacturing Considerations [This step is only suggested for Privately deployed Production set up and not required for test set up)]


### RainMaker MQTT Host
Expand Down Expand Up @@ -103,7 +106,35 @@ $ esp-matter-mfg-tool --dac-in-secure-cert -v 0xFFF2 -p 0x8001 --pai -k $ESP_MAT

Note the path where the files are generated after running the above command since it will be required later.

Before flashing certificates and factory nvs, connect your esp32 device to your computer. Enter the below command to flash certificates and factory partition
## Configure your app
Open the project configuration menu using -

```
idf.py menuconfig
```
In the configuration menu, set the following additional configuration to use custom factory partition and different values for Data and Device Info Providers.

1. Enable `ESP32 Factory Data Provider` [Component config → CHIP Device Layer → Commissioning options → Use ESP32 Factory Data Provider]

Enable config option `CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER`
to use ESP32 specific implementation of CommissionableDataProvider and DeviceAttestationCredentialsProvider.

2. Enable `ESP32 Device Instance Info Provider` [Component config → CHIP Device Layer → Commissioning options → Use ESP32 Device Instance Info Provider]

Enable config option `ENABLE_ESP32_DEVICE_INSTANCE_INFO_PROVIDER`
to get device instance info from factory partition.

3. Enable `Attestation - Secure Cert` [ Component config → ESP Matter → DAC Provider options → Attestation - Secure Cert]

Enable config option `CONFIG_FACTORY_PARTITION_DAC_PROVIDER` to use DAC certificates from the secure_cert partition during Attestation.

4. Set `chip-factory namespace partition label` [Component config → CHIP Device Layer → Matter Manufacturing Options → chip-factory namespace partition label]

Set config option `CHIP_FACTORY_NAMESPACE_PARTITION_LABEL`
to choose the label of the partition to store key-values in the "chip-factory" namespace. The default chosen partition label is `nvs`, change it to `fctry`.


Connect your esp32 device to your computer. Enter the below command to flash certificates and factory partition
```
$ esptool.py write_flash 0xd000 /out/<vendor-id>_<product-id>/<node-id>/<node-id>_esp_secure_cert.bin 0x3e0000 ./out/<vendor-id>_<product-id>/<node-id>/<node-id>-partition.bin
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $ idf.py flash monitor
> Please check the board selection (default ESP32-S3-BOX-3) in one of the ways:
> - Use `idf.py menuconfig`->`HMI Board Config`->`Selece BSP board` to select board.
> - Add only one board config in '[sdkconfig.defaults](matter_controller_with_touchscreen/sdkconfig.defaults)'. e.g. 'CONFIG_BSP_BOARD_ESP32_S3_LCD_EV_BOARD=y' to select ESP32-S3-LCD-EV-BOARD as board. 'CONFIG_BSP_BOARD_ESP32_S3_BOX_3=y' to select ESP32-S3-BOX-3 as board.
>> - Please use ESP-IDF [v5.2](https://github.com/espressif/esp-idf/tree/v5.2).
>> - Please use ESP-IDF [v5.2.2](https://github.com/espressif/esp-idf/releases/v5.2.2).
>> - If the board is ESP32-S3-LCD-EV-BOARD, set-target command should be `idf.py -D SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.defaults.lcdboard" set-target esp32s3`, remember to select board at the same time.
### Building the example (with OpenThread Border Router)
Expand Down

0 comments on commit 095e028

Please sign in to comment.