nRF52 Port Device Setup¶
Introduction¶
At production time, each Tapkey lock is programmed with an individual identity, keys, etc. This process is called provisioning. Tapkey provides a set of provisioning files for each device, including files named tkprov_{lock_id}_lock*
. The files are device type independent and need to be transformed into a format that can be programmed into devices non-volatile memory at production time. As each device type's memory structure is different, this step is device-type dependent.
This port contains the tool TkDeviceSetup
, intended to transform provisioning files into a form, that can be programmed into individual devices non-volatile memory at production time.
TkDeviceSetup¶
The tool TkDeviceSetup is provided with the port as source code. It's a windows tool and can be built using Visual Studio 2017 Professional or above.
Call TkDeviceSetup.exe /?
for help regarding the invocation syntax.
Input Files¶
The tool requires following input data:
-
tkprov_<lock_id>_lock.tklp
: This file contains the actual provisioning data, like the lock's identity. -
Tude_nRF52_App.nm
: This file is produced as part of the firmware application's build. It contains the addresses of symbols within the image. In particular it contains the addresses of the symbol__storage_installer_region_start
, which is where the setup data will be programmed to. -
<device configuration>.json
: This file contains configuration parameters that override the hard-coded default configuration. Examples are provided inPort/RefBoard_nRF52/deviceConfigs
folder. If all default values should be kept, an empty json ({}
) can be provided.
Output File¶
The tool produces a file, typically named *.ts3.hex
in intel hex format, that can be programmed into a device's flash memory at production time. It will program the setup data at the memory location specified in the '.nm' file provided to TkDeviceSetup.exe. The produced hex can therefore only be used as long as the memory layout doesn't change compared to the '.nm' file used to produce the .ts3.hex file. If the device's memory structure changes, the files have to be produced using the new .nm file, according to the changed memory structure.
Provisioning Process¶
- Get the file
Tude_nRF52_App.nm
, which was produced as part of the build. - Get the file
tkprov_<lock_id>_lock.tklp
for the device to be programmed. - Use the
TkDeviceSetup.exe
utility to produce the.ts3.hex
file. - Download the firmware application and boot loader into the target device.
- Use a tool like
nrfjprog.exe
to download the.ts3.hex
file into the target device's flash memory. - Start the device
→ The setup data is unpacked and device setup completed at the device's first start.