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

Bootloader problem (code = 3)

Hello,

I use the bootloader from the SDK SoftDevice 14.0.0.

I use the Laird module BL652 which have a nRF52832 component without external clock.

To compile the bootloader, I use the source code from : examples\dfu\bootloader_secure_ble\pca10040_debug\armgcc  (without secure key, it's more easy).

(I change the clock to the internal RC, I don't have button....)

To test, I load only the SoftDevice 5.0.0 and this bootloader.

The bootloader run and start. I use a tablet with the nRFConnect application.

I generate my application and have 3 type of file : xx.hex, xx.dat and xx.zip

I choose with nRFConnect the file (.hex+.dat or .zip only), the first commands are sent with good execution but, when nRFConnect want to send file, the nRFConnect application generate an error : "Remote DFU error : EXTENDED ERROR....Détails: Unknown command (Code = 3)"

I not find any information about this "Code = 3". This error code appears with the ZIP file or the HEX/DAT file (same error).

My J-Link RTT Viewer log is :

 0> <info> nrf_sdh_soc: Inside main
 0> <debug> nrf_sdh_soc: In nrf_bootloader_init
 0> <debug> nrf_sdh_soc: in weak nrf_dfu_init_user
 0> <debug> nrf_sdh_soc: In real nrf_dfu_init
 0> <debug> mem_mngr: Running nrf_dfu_settings_init(sd_irq_initialized=false).
 0> <debug> nrf_sdh_ble: Calling nrf_dfu_flash_init(sd_irq_initialized=false)...
 0> <debug> nrf_sdh_ble: Initializing nrf_fstorage_nvmc backend.
 0> <debug> mem_mngr: Resetting bootloader settings.
 0> <debug> mem_mngr: Writing settings...
 0> <debug> mem_mngr: Erasing old settings at: 0x0007F000
 0> <debug> nrf_sdh_ble: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 1
 0> <debug> nrf_sdh_ble: Flash erase success: addr=0x0007F000, pending 0
 0> <debug> nrf_sdh_ble: nrf_fstorage_write(addr=0x0007F000, len=0x1B8 bytes), queue usage: 1
 0> <debug> nrf_sdh_ble: Flash write success: addr=0x0007F000, pending 0
 0> <error> mem_mngr: End of nrf_dfu_settings_init
 0> <debug> nrf_sdh_soc: Initializing the clock.
 0> <debug> nrf_sdh_soc: Enter nrf_dfu_continue : bank_layout = 0, bank_current = 0
 0> <debug> nrf_sdh_soc: Enter nrf_dfu_continue : bank_0 = 0, bank_1 = 0
 0> <error> nrf_sdh_soc: Single: Invalid bank
 0> <debug> nrf_sdh_soc: Application sent bootloader request
 0> <debug> nrf_sdh_soc: In nrf_dfu_transports_init
 0> <debug> nrf_sdh_soc: num transports: 1
 0> <debug> nrf_sdh_soc: Initializing BLE DFU transport
 0> <debug> nrf_sdh_soc: vector table: 0x00073000
 0> <debug> nrf_sdh_soc: vector table: 0x00073000
 0> <debug> nrf_sdh_soc: Error code - sd_softdevice_vector_table_base_set: 0x00000000
 0> <debug> nrf_sdh_soc: Enabling SoftDevice.
 0> <debug> nrf_sdh_soc: SoftDevice enabled.
 0> <debug> nrf_sdh_soc: nrf_dfu_settings_adv_name_is_valid FALSE
 0> <debug> nrf_sdh_soc: Regular adv name
 0> <debug> nrf_sdh_soc: #### Advertising NO BONDING ####
 0> <debug> nrf_sdh_soc: Finished initializing BLE DFU transport
 0> <debug> nrf_sdh_soc: After nrf_dfu_transports_init
 0> <debug> nrf_sdh_ble: Calling nrf_dfu_flash_init(sd_irq_initialized=true)...
 0> <debug> nrf_sdh_ble: Initializing nrf_fstorage_sd backend.
 0> <debug> nrf_sdh_soc: Waiting for events
 0> <debug> nrf_sdh_soc: Received: BLE_GAP_EVT_CONN_PARAM_UPDATE
 0> <debug> nrf_sdh_soc: conn_sup_timeout: 2000
 0> max_conn_interval: 6
 0> min_conn_interval: 6
 0> slave_latency 0
 0> <debug> nrf_sdh_soc: Received: BLE_GAP_EVT_CONN_PARAM_UPDATE
 0> <debug> nrf_sdh_soc: conn_sup_timeout: 2000
 0> max_conn_interval: 36
 0> min_conn_interval: 36
 0> slave_latency 0
 0> <debug> nrf_sdh_soc: Received select object
 0> <info> app: Valid Command: NRF_DFU_OBJECT_OP_SELECT
 0> <debug> nrf_sdh_soc: Sending Object Info: [0x60, 0x06, 0x01 max: 0:x00000100 0:x00000000, CRC:0x00000000]
 0> <debug> nrf_sdh_soc: Set receipt notif
 0> <debug> nrf_sdh_soc: Sending Response: [0x2, 0x1]
 0> <debug> nrf_sdh_soc: Received create object
 0> <info> app: Before OP create command
 0> <info> app: Valid Command Create
 0> <debug> nrf_sdh_soc: Sending Response: [0x1, 0x1]
 0> <info> app: Before OP write command
 0> <info> app: Before OP write command
 0> <info> app: Before OP write command
 0> <info> app: Before OP write command
 0> <debug> nrf_sdh_soc: Received calculate CRC
 0> <info> app: Valid Command CRC
 0> <debug> nrf_sdh_soc: Sending CRC: [0x60, 0x03, 0x01, 0:x00000040, CRC:0xDD71F68F]
 0> <debug> nrf_sdh_soc: Received execute object
 0> <info> app: Before OP execute command
 0> <info> app: Valid command execute
 0> <info> app: PB: Init packet data len: 58
 0> <info> app: Handling unsigned command
 0> <debug> nrf_sdh_soc: Sending Response: [0x4, 0xB]
 0> <debug> nrf_sdh_soc: Received: BLE_GAP_EVT_CONN_PARAM_UPDATE
 0> <debug> nrf_sdh_soc: conn_sup_timeout: 2000
 0> max_conn_interval: 6
 0> min_conn_interval: 6
 0> slave_latency 0
 0> <debug> nrf_sdh_soc: Received: BLE_GAP_EVT_CONN_PARAM_UPDATE
 0> <debug> nrf_sdh_soc: conn_sup_timeout: 2000
 0> max_conn_interval: 36
 0> min_conn_interval: 36
 0> slave_latency 0
 0> <debug> nrf_sdh_soc: TimeOut is finish
 0> <debug> nrf_sdh_soc: After waiting for events
 0> <debug> nrf_sdh_soc: Before nrf_dfu_settings_additional_erase
 0> <debug> nrf_sdh_soc: After nrf_dfu_settings_additional_erase : 0
 0> <debug> nrf_sdh_soc: Enter nrf_dfu_app_is_valid : bank_code = 0
 0> <debug> nrf_sdh_soc: Return false in valid app check
 0> <info> nrf_sdh_soc: After real nrf_dfu_init
 0> <debug> nrf_sdh_soc: After nrf_bootloader_init
 0> <debug> nrf_sdh_soc: Running nrf_bootloader_app_start with address: 0x00023000
 0> <debug> nrf_sdh_soc: Initializing SD in mbr

I send too an image from the nRFConnect application to see the problem.

For me, perhaps, the fault is when I generate the zip file with the nRFUtils :

          .\nrfutil.exe pkg generate example.zip --application application.hex --application-version 4 --hw-version 52 --sd-req 0x9D

I don't see where the error is comming.

Thank you for your helps.

Best regards,

Damien

  • Hi Damien,

    Did you remember to change the clock to internal RC for both the nrf52 chip & the softdevice? Also, did you follow the testing link provided here? In addition, this blog post might be useful. It is based on the same testing procedure.

    Which version of nrfutil are you running (you can check this by running the command: nrfutil version)?

    I believe if you are not using the secure private key, you might need to run this command instead:

    nrfutil pkg generate --debug-mode --application application.hex app_dfu_package.zip

    This will skip version information (hardware version, softdevice firmware ID & application version) & generate an unsigned debug package (see link).

    I would then perform the DFU like you have done using nrf connect for android only uploading the zip file created (i.e. app_dfu_package.zip). Hope that helps!

  • Hi Bjorn,

    In bootloader project, I have made a custom_Board file:

    #define NRF_CLOCK_LFCLKSRC      {.source       = NRF_CLOCK_LF_SRC_RC,      \
                                     .rc_ctiv      = 16,                          \
                                     .rc_temp_ctiv = 2,                          \
                                     .accuracy     =  NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM}

    Into the sdk_config.h, I enable the RC source:

    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 0
    #endif

    --> I have to enable another part for active the RC source ??

    - Ok, I try to follow this blog.

    - The nrfUtil version is the 3.4.0.

    --> Can I shall be update it ?

    - I try your command but the nRFutil have a error because it missing the hw-version and the sd-req. I add this 2 parameters.

    My new command line is:

    nrfutil pkg generate --debug-mode --application application.hex app_dfu_package.zip --hw-version 52 --sd-req 0x9D

    I have try with this new file app_dfu_package.zip but the result is the same. The error (code = 3) appears.

    Perhaps, I try to compile the bootloader project with release version (no debug version) with a private key...

    Thank you,

    Best regards,

    Damien

  • Hi Damien,

    Regarding the custom board file, it might be useful to check this link (see this case too). In addition, this infocenter document could be helpful.

    Regarding the RC source, the NRF_SDH_CLOCK_LF_SRC 0 is the only change you need to make. So this step is correct if you want to use the internal Low Frequency RC oscillator.

    When you say that the nrf52832 component does not have an external clock, you are referring to the 32 kHz low frequency clock, right? Because the Laird module has a 32 MHz high frequency external crystal oscillator according to the datasheet.

    Could be a good idea to update to nrfUtil v 3.5.0, although I have gotten this to work with 3.4.0 too.

    Like you mention, it could also be a good idea to use the release version of the bootloader project with the private key. I have a feeling this might be related to the board file maybe, as this example works fine with the nrf52dk when following the secure dfu blog post. You can use the same nrfutil command as given in the blog post.

    Hope that helps! Kind Regards,

    Bjørn Kvaale

  • Hi Bjorn,

    I have recompile the bootloader source code with Release part (with private/public key, etc....) and I have update my "nRFUtils".

    I follows your tutorials to compile the different source code and I works good (I use the new Gcc (Version 7-2017) to compile all without error.

    Now, All work fine.

    Thank to your helps.

    We can close this post.

    Best regards,

    Damien

  • Great! Good to hear that you figured it out! Good luck with further development.

Related