UICRFillerTool - cristianoborgescardoso/nrf52 GitHub Wiki

Downloads:

The following files are required to run the UICRFillerTool

Introduction

The UICRFillerTool is a tool, implemented in Java, to fill, or set, information about the devices, usually sensors and relays, connected to an NRF52 SDK or NRF52832 board.

The information configurated by UICRFillerTool will be parsed and stored on the UICR registers (User information configuration registers), these registers corresponds to a memory area, or a memory range, separated from the memory range used by an application running on the NRF52 boards. So you can flash a new application on the NRF52 board and it will not change the information stored in the UICR and vice-versa.

More information about UICR can be found on Write and read data at UICR.

Development Environment

This tool was developed using the NetBeans 8.2 and JDK 8 on Windows OS, to keep the compatibility the same installation file used during the development is stored in google drive and can be downloaded using the following link: jdk-8u111-nb-8_2-windows-x64

The reason to use the Windows OS is that there are too many tools used to program, configure and profiling the NRF52 boards are avaliable to Windows OS, acctually, by my experience in Widows is fast to start the development on that boards. I tryed many times using Ubunt, but some problems that I faced make me forget that idea.

Running the UICRFillerTool

To run the UICRFillerTool.jar, just run the following command line in the terminal or in the Cygwin on Windows:

$ java -jar release/UICRFillerTool.jar

Searching the file devices.xml

The UICRFillerTool require the file devices.xml to be configurated. You have to specify the path of that file, to do it click at the button Search, browse and select that file.

octocat

Opening the file devices.xml

To open the file devices.xml, just click on the button Open, so xml file will be loaded, the UICRFillerTool will be configurated, and the comboboxes will be shown.

Each combobox correspond to a GPIO port on the NRF52 SDK.

octocat

Configuring the devices on GPIO ports of the NRF52 SDK

The configuration of the GPIO ports of the NRF52 SDK is so intuitive as it looks like. Each combobox in the UICRFillerTool correspond to a GPIO port, so just turn Enable the first combobox to enable the configuration of that port on the NRF52 SDK. When a GPIO port is enabled, and now you can select the type of the device that will be attached on this port.

The device can be a input device, like a sensor, or a output device like a relay. Again, just select the description correspondent to the sensor attached on that GPIO port.

octocat

Visualising GPIO ports

There is an image of the NRF52 SDK, in a resizeable area located right side of the UICRFillerTool application. This image is just to help you remember the position of the GPIO port, just in case that you don't have an SDK board near.

octocat

Flashing Board

To flash the board just left-click in the button Flash Board. Doing that the UICRFillerTool will:

  1. Erase the entire UICR area.
  2. The data configurated in the comboboxes will be parsed and written in the UICR.
  3. The UICR will be re-read, just to confirm if the data was written properly.
  4. All commands will be written in a file named writeUICR.sh located in the same directory of UICRFillerTool. So if you want to keep this file, rename or copy it to a new directory, otherwise, it will be rewritten next time you pressed the button Flash Board.

octocat

Log generated by the UICRFillerTool:

The text below correspond to the log generated by UICRFillerTool, using the presets shown in the previous images

Encoding devices configuration...
Generating command lines...
Number of configurated devices: '4'
P.3 |function='0'|name='2'|  = 0x03000200

P.22 |function='0'|name='0'|  = 0x16000000

P.26 |function='0'|name='7'|  = 0x1a000700

P.13 |function='0'|name='5'|  = 0x0d000500

Adding the number of configurated devices in the first registry: '4'
P.3 |function='0'|name='2'|  = 0x03000204

Erasing UICR...
Running command: '$ nrfjprog -f NRF52 --eraseuicr'

Erasing UICR flash area.
Applying system reset.
Writing UICR Registers...
Running command: '$ nrfjprog  -f NRF52  --memwr 0x10001080 --val 0x03000204'

Parsing parameters.
Writing.
Running command: '$ nrfjprog  -f NRF52  --memwr 0x10001084 --val 0x16000000'

Parsing parameters.
Writing.
Running command: '$ nrfjprog  -f NRF52  --memwr 0x10001088 --val 0x1a000700'

Parsing parameters.
Writing.
Running command: '$ nrfjprog  -f NRF52  --memwr 0x1000108c --val 0x0d000500'

Parsing parameters.
Writing.
Reading UICR Registers...
Running command: '$ nrfjprog -f NRF52 --memrd 0x10001080 --n 4'

0x10001080: 03000204                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x10001084 --n 4'

0x10001084: 16000000                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x10001088 --n 4'

0x10001088: 1A000700                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x1000108c --n 4'

0x1000108C: 0D000500                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x10001090 --n 4'

0x10001090: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x10001094 --n 4'

0x10001094: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x10001098 --n 4'

0x10001098: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x1000109c --n 4'

0x1000109C: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010a0 --n 4'

0x100010A0: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010a4 --n 4'

0x100010A4: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010a8 --n 4'

0x100010A8: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010ac --n 4'

0x100010AC: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010b0 --n 4'

0x100010B0: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010b4 --n 4'

0x100010B4: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010b8 --n 4'

0x100010B8: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010bc --n 4'

0x100010BC: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010c0 --n 4'

0x100010C0: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010c4 --n 4'

0x100010C4: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010c8 --n 4'

0x100010C8: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010cc --n 4'

0x100010CC: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010d0 --n 4'

0x100010D0: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010d4 --n 4'

0x100010D4: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010d8 --n 4'

0x100010D8: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010dc --n 4'

0x100010DC: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010e0 --n 4'

0x100010E0: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010e4 --n 4'

0x100010E4: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010e8 --n 4'

0x100010E8: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010ec --n 4'

0x100010EC: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010f0 --n 4'

0x100010F0: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010f4 --n 4'

0x100010F4: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010f8 --n 4'

0x100010F8: FFFFFFFF                              |....|
Running command: '$ nrfjprog -f NRF52 --memrd 0x100010fc --n 4'

0x100010FC: FFFFFFFF                              |....|
Wrinting file 'writeUICR.sh'

Example of the 'writeUICR.sh'

The script writeUICR.sh, contains the same commands performed by the UICRFillerTool when you click on the FlashBoard button. So you can create a GPIO configuration, dump this configuration in a script and write this configuration on the board later.

The text below correspond to the script generated by the example used on this article:

#!/bin/bash
echo 'Erasing UICR...'
nrfjprog -f NRF52 --eraseuicr
echo 'Writing UICR Registers...'
nrfjprog  -f NRF52  --memwr 0x10001080 --val 0x03000204
nrfjprog  -f NRF52  --memwr 0x10001084 --val 0x16000000
nrfjprog  -f NRF52  --memwr 0x10001088 --val 0x1a000700
nrfjprog  -f NRF52  --memwr 0x1000108c --val 0x0d000500
echo 'Reading UICR Registers...'
nrfjprog -f NRF52 --memrd 0x10001080 --n 4
nrfjprog -f NRF52 --memrd 0x10001084 --n 4
nrfjprog -f NRF52 --memrd 0x10001088 --n 4
nrfjprog -f NRF52 --memrd 0x1000108c --n 4
nrfjprog -f NRF52 --memrd 0x10001090 --n 4
nrfjprog -f NRF52 --memrd 0x10001094 --n 4
nrfjprog -f NRF52 --memrd 0x10001098 --n 4
nrfjprog -f NRF52 --memrd 0x1000109c --n 4
nrfjprog -f NRF52 --memrd 0x100010a0 --n 4
nrfjprog -f NRF52 --memrd 0x100010a4 --n 4
nrfjprog -f NRF52 --memrd 0x100010a8 --n 4
nrfjprog -f NRF52 --memrd 0x100010ac --n 4
nrfjprog -f NRF52 --memrd 0x100010b0 --n 4
nrfjprog -f NRF52 --memrd 0x100010b4 --n 4
nrfjprog -f NRF52 --memrd 0x100010b8 --n 4
nrfjprog -f NRF52 --memrd 0x100010bc --n 4
nrfjprog -f NRF52 --memrd 0x100010c0 --n 4
nrfjprog -f NRF52 --memrd 0x100010c4 --n 4
nrfjprog -f NRF52 --memrd 0x100010c8 --n 4
nrfjprog -f NRF52 --memrd 0x100010cc --n 4
nrfjprog -f NRF52 --memrd 0x100010d0 --n 4
nrfjprog -f NRF52 --memrd 0x100010d4 --n 4
nrfjprog -f NRF52 --memrd 0x100010d8 --n 4
nrfjprog -f NRF52 --memrd 0x100010dc --n 4
nrfjprog -f NRF52 --memrd 0x100010e0 --n 4
nrfjprog -f NRF52 --memrd 0x100010e4 --n 4
nrfjprog -f NRF52 --memrd 0x100010e8 --n 4
nrfjprog -f NRF52 --memrd 0x100010ec --n 4
nrfjprog -f NRF52 --memrd 0x100010f0 --n 4
nrfjprog -f NRF52 --memrd 0x100010f4 --n 4
nrfjprog -f NRF52 --memrd 0x100010f8 --n 4
nrfjprog -f NRF52 --memrd 0x100010fc --n 4

NOTE: if you want to preserve this script, rename, or copy it to a new directory, otherwise, it will be rewritten next time you pressed the button Flash Board.