WPC provisioning for MWCT2xxxS using EL2GO and MBoot#
WPC provisioning serves to generate WPC Certificate Chain and insert said chain into the target.
WPC Certificate Chain is a crucial component of WPC Qi Authentication process for wireless power transfer.
0. Prerequisites#
MWCT2xxxA Board
NXP HSE firmware
NXP WPC Provisioning firmware
EL2GO account with access to WPC Service
If you don’t have all of the prerequisites above, you may take a look into wpc_model notebook.
This notebook doesn’t use real HW nor EL2GO, but rather device model and EL2GO mock-up 😊
1. Target board preparation#
Flash HSE firmware using available debugger
Flash WPC Provisioning firmware using available debugger
Connect UART interface to PC
Verify firmwares were flashed correctly and running using
nxpdevscan --port
# setup this jupyter notebook
%run ../init_notebook.ipynb
env: JUPYTER_SPSDK=1
Created `%!` as an alias for `%execute`.
%! nxpdevscan --port
nxpdevscan --port
-------- Connected NXP UART Devices --------
Port: COM7
Type: mboot device
2. NXPWPC application setup#
NXPWPC is the SPSDK command-line application facilitating communication between WPC Service and WPC Target.
Out-of-the-box SPSDK provides one Service adapter using EL2GO and one Target adapter using MBoot.
This application provides a subcommand insert-cert
for launching the WPC Provisioning process and get-template
for user-friendly configuration of NXPwPC app.
# This command will generate a configuration file template which you then may customize to your own environment
%! nxpwpc get-template --service-type el2go --target-type mboot --family mwct2xxxs --output config.yaml
nxpwpc get-template --service-type el2go --target-type mboot --family mwct2xxxs --output config.yaml
Creating C:\_projects\mcu_boot\repo\bsdk-master\examples\wpc_provisioning\config.yaml template file.
Within the config.yaml
file please change to following:
service_parameters
(configuration for WPC Service adapter)url
: point to EL2GO instance you’re registered inqi_id
: your Qi ID registered with WPCauth_key
: your API key obtained from EL2GO
target_parameters
(configuration for WPC Target adapter)port
: com port of your target (see output of thenxpdevscan
command earlier)
Once the changes are done, you may run the WPC Provisioning using nxpwpc insert-cert
command.
3. Running the WPC Provisioning#
%! nxpwpc --verbose insert-cert --config config.yaml
nxpwpc --verbose insert-cert --config config.yaml
INFO:spsdk.wpc.utils:Getting WPC ID
INFO:spsdk.wpc.target_mboot:Reading low level WPC ID
INFO:spsdk.mboot.mcuboot:Connect: identifier='uart', device=com7
INFO:spsdk.mboot.mcuboot:CMD: ReadMemory(address=0x20000000, length=136, mem_id=0)
INFO:spsdk.mboot.mcuboot:CMD: Status: 0 (0x0) Success.
INFO:spsdk.mboot.mcuboot:CMD: Successfully Received 136 from 136 Bytes
INFO:spsdk.mboot.mcuboot:Closing: identifier='uart', device=com7
INFO:spsdk.wpc.utils:Computing CSR
INFO:spsdk.wpc.target_mboot:Signing CSR-TBS data
INFO:spsdk.mboot.mcuboot:Connect: identifier='uart', device=com7
INFO:spsdk.mboot.mcuboot:CMD: WriteMemory(address=0x20000100, length=127, mem_id=0)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty(MaxPacketSize, index=0)
INFO:spsdk.mboot.mcuboot:CMD: Status: 0 (0x0) Success.
INFO:spsdk.mboot.mcuboot:CMD: Max Packet Size = 32
INFO:spsdk.mboot.mcuboot:CMD: Status: 0 (0x0) Success.
INFO:spsdk.mboot.mcuboot:CMD: Successfully Send 127 out of 127 Bytes
INFO:spsdk.mboot.mcuboot:CMD: [TrustProvisioning] WPC SIGN CSR-TBS DATA
INFO:spsdk.mboot.mcuboot:CMD: Status: 0 (0x0) Success.
INFO:spsdk.mboot.mcuboot:CMD: ReadMemory(address=0x20000300, length=64, mem_id=0)
INFO:spsdk.mboot.mcuboot:CMD: Status: 0 (0x0) Success.
INFO:spsdk.mboot.mcuboot:CMD: Successfully Received 64 from 64 Bytes
INFO:spsdk.mboot.mcuboot:Closing: identifier='uart', device=com7
INFO:spsdk.wpc.service_el2go:Handling url: https://api.qa.sb.edgelock2go.com/api/v1/wpc/product-unit-certificate/123456/request-puc
INFO:spsdk.wpc.service_el2go:Service response:
{
"pucId": 467,
"qiId": "123456",
"pucType": {
"type": "CSR",
"certificate": "-----BEGIN CERTIFICATE-----\r\nMIIBQjCB6qADAgECAghtMqtwP2OshjAKBggqhkjOPQQDAjASMRAwDgYDVQQDDAcx\r\nMjM0LTU2MCAXDTIzMTAwOTExMjcwMFoYDzk5OTkxMjMxMjI1OTAwWjARMQ8wDQYD\r\nVQQDDAYxMjM0NTYwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQjFX4cT7dzhPA4\r\npzW4q81KRHfGE3P/5igKDK/3EyJpbyAjBYFzuWRdqN9eoG5F0j4rWWDa53HXWMf3\r\nun5Md8QhoykwJzAMBgNVHRMBAf8EAjAAMBcGBWeBFAECAQH/BAsECQHiQAAAAAAA\r\nJDAKBggqhkjOPQQDAgNHADBEAiASSdnczPhp6a9qsdvzxCVYAle3l3YjQLjaVkdP\r\nlpRJ+AIgMw+IlyWGhM2enZqKWwx2SbuKwAJUMHaoOpetXbe1rag=\r\n-----END CERTIFICATE-----\r\n",
"productManufacturingCertificate": "-----BEGIN CERTIFICATE-----\nMIIBmzCCAUCgAwIBAgIQVpDHMGXs+bktXfJHuYNuxjAKBggqhkjOPQQDAjASMRAw\nDgYDVQQDDAdUU1ROWFAxMCAXDTIzMTAwOTA4MjY1OFoYDzk5OTkxMjMxMjM1OTU5\nWjASMRAwDgYDVQQDDAcxMjM0LTU2MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE\ngWFjq/rMoaiMoJDTuFNnbSFCvGiy5hgnro+HIRJ8Edt0aS+ACSFauAOPZfD6qbGs\nN4Ct2fOOCkkEHGXX4Y4RJ6N2MHQwHQYDVR0OBBYEFA2zUdkY5z25gwWHffRGbQM0\nvX6IMB8GA1UdIwQYMBaAFGF/xNC4LZ3iBoGqNzAhEkBNF8zoMBIGA1UdEwEB/wQI\nMAYBAf8CAQAwDgYDVR0PAQH/BAQDAgEGMA4GBWeBFAEBAQH/BAIAATAKBggqhkjO\nPQQDAgNJADBGAiEAxyH3ySQLZPy0AK+ZzXKxEm08xa+x2vaW7KBQEkvu+JkCIQD3\nhX4e0cj5voiYhzkMfzpqZtTRuWDV7GxxuMuVmDawuA==\n-----END CERTIFICATE-----\n",
"rootCaHash": "868B0065CCDFEA934F71B1F034341826979D769289E92F8525944D5D2FB6EB1E",
"referenceId": null
}
}
INFO:spsdk.wpc.target_mboot:Inserting WPC certificate
INFO:spsdk.mboot.mcuboot:Connect: identifier='uart', device=com7
INFO:spsdk.mboot.mcuboot:CMD: WriteMemory(address=0x20000400, length=775, mem_id=0)
INFO:spsdk.mboot.mcuboot:CMD: GetProperty(MaxPacketSize, index=0)
INFO:spsdk.mboot.mcuboot:CMD: Status: 0 (0x0) Success.
INFO:spsdk.mboot.mcuboot:CMD: Max Packet Size = 32
INFO:spsdk.mboot.mcuboot:CMD: Status: 0 (0x0) Success.
INFO:spsdk.mboot.mcuboot:CMD: Successfully Send 775 out of 775 Bytes
INFO:spsdk.mboot.mcuboot:CMD: [TrustProvisioning] WPC INSERT CERT
INFO:spsdk.mboot.mcuboot:CMD: Status: 0 (0x0) Success.
INFO:spsdk.mboot.mcuboot:Closing: identifier='uart', device=com7
Inserting WPC certificate finished successfully.
NOTE: If you don’t want to use config file, you may specify all required settings via command line.
Or you may use command line options to override settings in the config file.
%! nxpwpc insert-cert --help
nxpwpc insert-cert --help
Usage: nxpwpc insert-cert [OPTIONS]
Perform full WPC Cert chain flow.
- Retrieve WPC ID from the target
- Generate WPC cert chain on service
- Insert WPC certificate into the target.
Parameters for target and service may be passed using "-tp" or "-sp" options
respectively, or via a config file ("-c"). The config file template can be
generated using "get-template" command.
Options:
-st, --service-type [el2go] Name of the WPC service type.
-sp, --service-parameters TEXT 'key=value' to set/override a service
adapter setting. Can be used multiple times.
-tt, --target-type [model|mboot]
Name of the MCU target type.
-tp, --target-parameters TEXT 'key=value' to set/override a service
adapter setting. Can be used multiple times.
-c, --config FILE Path to the YAML/JSON configuration file.
-s, --save-debug-data Save the data being transferred (for
debugging purposes).
--help Show this message and exit.