Skip to content

Factory configuration tool

The factory config memory region can be configured with various supported types of configurations.

mira_factory_configuration is a Python tool designed for configuring the factory config region.

It's important to note that the Mira license is also part of the factory configuration. Therefore, the factory configuration tool requires a node to undergo the licensing process. For more information about licensing, please refer to the licensing process and licensing tool.

The factory configuration tool supports the following types:

  • Frontend configuration.

  • UART configuration.

Update factory configuration

The factory configuration provides flexibility for updating devices with various licensing scenarios. It supports updating:

  • A device that is already flashed with a license.

  • A hex file containing the license for a specific device.

  • License file in *.lic format. In this scenario, flashing the updated configuration directly or generating it as a hex file are the available options.

To update the factory configuration for an already licensed node, execute the following command:

./mira_factory_configuration.py -P nrfjprog -a AAAAA -l LLLLL -C CONFIG-FILE
where CONFIG-FILE is the factory configuration file.

To add factory configuration to a hex file, run:

./mira_factory_configuration.py -P ihex -f HEX-FILE -a AAAAA -l LLLLL -C CONFIG-FILE
where CONFIG-FILE is the factory configuration file, and HEX-FILE is the license hex file to be updated with the factory configuration.

To add factory configuration to an input license file and directly flashing it to the device, run:

./mira_factory_configuration.py -I IN-FILE -P nrfjprog -a AAAAA -l LLLLL -C CONFIG-FILE
where IN-FILE is the license file in *.lic format

To add factory configuration to an input license file and generate a hex file, run:

./mira_factory_configuration.py -I IN-FILE -P ihex -f HEX-FILE -a AAAAA -l LLLLL -C CONFIG-FILE
where IN-FILE is the license file in *.lic format, and HEX-FILE is the resulting hex file.

Read existing factory config data

The factory configuration tool supports reading out the current configuration, producing a JSON-formatted file as output.

This output file can be directly modified and reused to update the configuration.

To read the existing configuration from the device directly:

./mira_factory_configuration.py -P nrfjprog -a AAAAA -l LLLLL -r OUTPUT-FILE

To read the configuration from a hex file that contains factory config:

./mira_factory_configuration.py -P ihex -f HEX-FILE -a AAAAA -l LLLLL -r OUTPUT-FILE

Example configuration file

The CONFIG-FILE referenced in the usage examples above is the configuration file containing essential data.

The example file includes configuration setting for both frontend and UART, providing a clear illustration of how to structure data within the configuration file.

Format

The format of the configuration file is json5. The format looks like this:

{
    /* An example Front-End Module configuration data.
     *
     * This works with MWA N2-B
     *
     * Describes a module for nRF52 using:
     * CPS = P1.11
     * CSD = P1.10
     * CTX = P1.12
     * CRX = P1.14
     *
     * TX bypass = CPS=0 CSD=1 CRX=0 CTX=1
     * TX active = CPS=1 CSD=1 CRX=0 CTX=1
     * RX bypass = CPS=0 CSD=1 CRX=1 CTX=0
     * RX active = CPS=1 CSD=1 CRX=1 CTX=0
     * idle      = CPS=0 CSD=0 CRX=0 CTX=0
     *
     * ANTSEL = P1.06
     *
     * ANTSEL idle = ANTSEL=0
     * ANTSEL 0    = ANTSEL=0
     * ANTSEL 1    = ANTSEL=1
     */
    "frontend-config": {
        /* In cB (centi-bel, or tenth of dB) */
        "gain_cb_bypass_tx": -30, /**< gain in bypass TX [cB] */
        "gain_cb_active_tx": 300, /**< gain in PA active TX [cB] */
        "gain_cb_bypass_rx": -30, /**< gain in bypass RX [cB] */
        "gain_cb_active_rx": 115, /**< gain in PA active RX [cB] */

        /** Set unused GPIO pins to MIRA_GPIO_PIN_UNDEFINED */
        "gpio_mode_control":[
            [1,12], /* CTX */
            [1,14], /* CRX */
            [1,10], /* CSD */
            [1,11]  /* CPS */
        ], /**< GPIO for PA mode control */
        "gpio_antsel":[[1,6]], /**< GPIO for antenna selection */

        "pin_values_bypass_tx":5, /**< GPIO levels to select bypass TX mode */
        "pin_values_active_tx":13, /**< GPIO levels to select PA active TX mode */
        "pin_values_bypass_rx":6, /**< GPIO levels to select bypass RX mode */
        "pin_values_active_rx":14, /**< GPIO levels to select PA active RX mode */
        "pin_values_idle":0, /**< GPIO levels to set the PA in idle mode */

        "pin_values_antsel":[0, 1, 0, 0], /**< GPIO levels required for gpio_antsel
                                       * to select antenna. Only bit 0 is used. */
        "pin_values_antsel_idle":0, /**< GPIO levels required for gpio_antsel
                                         * to enter idle mode */
    },
    /* An example UART configuration data.
     *
     * This is an example configuration for nRF52 based target.
     */
    "uart-config": {
        "id": 0,
        "tx_pin": [1, 7],
        "rx_pin": [1, 8],
        "baudrate": 115200,
        "parity": 0 /**< Please note: Parity is not yet supported, set to 0 */
    }
}

Back to top