This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Customizing a bootloader

If all you need is changing  PHY, Tx power and Device Name in a standard nRF52840, do you need building a new bootloader from the scratch or the is a way to edit the standard firmware,  build a new edited file and finally re-program this file in a standard nRF52840? Thanks

Parents
  • Hi Vidar. Following the Getting started with Nordic's Secure DFU bootloader, a step by step guide, in the A1 step, Generate your own private key. Type this command line:  nrfutil.exe keys generate private.key, all I get is:

    C:\Users\jtorr>nrfutil.exe keys generate private.key
    File found at private.key. Do you want to overwrite the file?  [y/N]
    Traceback (most recent call last):
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Users\jtorr\AppData\Local\Programs\Python\Python37-32\Scripts\nrfutil.exe\__main__.py", line 9, in <module>
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 764, in __call__
        return self.main(*args, **kwargs)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 717, in main
        rv = self.invoke(ctx)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 555, in invoke
        return callback(*args, **kwargs)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\nordicsemi\__main__.py", line 364, in generate
        if not query_func("File found at %s. Do you want to overwrite the file?" % key_file):
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\nordicsemi\dfu\util.py", line 69, in query_func
        choice = raw_input().lower()
    NameError: name 'raw_input' is not defined

    ..... but I don't see any private key string to continue, in order to obtain the public key.

    Any comments?

    Thanks in advance.

Reply
  • Hi Vidar. Following the Getting started with Nordic's Secure DFU bootloader, a step by step guide, in the A1 step, Generate your own private key. Type this command line:  nrfutil.exe keys generate private.key, all I get is:

    C:\Users\jtorr>nrfutil.exe keys generate private.key
    File found at private.key. Do you want to overwrite the file?  [y/N]
    Traceback (most recent call last):
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Users\jtorr\AppData\Local\Programs\Python\Python37-32\Scripts\nrfutil.exe\__main__.py", line 9, in <module>
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 764, in __call__
        return self.main(*args, **kwargs)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 717, in main
        rv = self.invoke(ctx)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\click\core.py", line 555, in invoke
        return callback(*args, **kwargs)
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\nordicsemi\__main__.py", line 364, in generate
        if not query_func("File found at %s. Do you want to overwrite the file?" % key_file):
      File "c:\users\jtorr\appdata\local\programs\python\python37-32\lib\site-packages\nordicsemi\dfu\util.py", line 69, in query_func
        choice = raw_input().lower()
    NameError: name 'raw_input' is not defined

    ..... but I don't see any private key string to continue, in order to obtain the public key.

    Any comments?

    Thanks in advance.

Children
  • Hi Vidar.

    I need customizing the TXPOWER parameter through BLE in several nRF52840 modules I am testing, in such a way next time they boot up, they will do with their output power set to pos8dBm and not to pos6dBm as is the case now. Would you please help me with a step by step guide?

    I barely understand how to build and program a secure DFU using nRFtools, but I don't know how to build the source file to initiate the process.

    And also, where in within all the blocks the firmware is made up is this parameter defined? In the Bootloader block, in the SoftDevice, in the App_Data, in the Application itself or somewhere else that I am not yet aware? The modules I am testing are from uBlox. Will I need special source files other than if I set this parameter in the module of a nRF52840 DK board?

    Thanks so much

  • Hi,

    The output power is 0 dBm by default. If you want to change it you need to do it after you have enabled the softdevice  using sd_ble_gap_tx_power_set().

    E.g., setting the output power in gap_params_init(): 

        void gap_init()
        {
            ...
            
            /*Set output power to +8dBm for advertisment and connection*/
            err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, 0, 8);
            APP_ERROR_CHECK(err_code);
            
            ...
        }

    This must be done in both bootloader and application, but I'd suggest that you start testing this with just an application (select one of the ble peripheral examples from the SDK) and softdevice first to verify that you have a working setup.  

  • Hi,

    And how do you issue all these commands to the bootloader, application and Softdevice? Using a Putty console perhaps through a COM port?

  • Hi,

    You need to edit the source code and re-build the project to change the output power. There are some application examples that have a command line interface, the Experimental: BLE Interactive Command Line Interface Example for instance, but I'm not aware of any that include a command for setting the output power.  

  • I understand Vidar. There are examples including CLI commands to change the Tx_Power, but not permanently though. As soon as nRF52840 DK gets switched-off, this parameter returns to 0 dBm. I wonder if once you've modified this parameter through CLI, there would be a way to automatically generate a source file reflecting this change you could later build and program in any factory set module?

Related