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

bootloader_secure_serial and nRFgo Studio not working

We are trying to get serial bootloader (DFU) working. I compiled a debug version of the experimental_bootloader_secure_serial in SDK13.0.0 to see what really happens there (pca10040 board). I am using UART-to-USB converter (FTDI) in pins 6 and 8. After starting the bootloader and trying to upload a zip file with the nRFgo Studio (38400 with flow control on), the log looks like below:

:INFO:Inside main
:DEBUG:In nrf_bootloader_init
:DEBUG:In real nrf_dfu_init
:DEBUG:running nrf_dfu_settings_init
:DEBUG:Enter nrf_dfu_continue
:ERROR:Single: Invalid bank
:DEBUG:Enter nrf_dfu_app_is_valid
:DEBUG:Return false in valid app check
:DEBUG:In nrf_dfu_transports_init
:DEBUG:num transports: 1
:DEBUG:UART initialized
:DEBUG:After nrf_dfu_transports_init
:DEBUG:Waiting for events
RROR:received an error: 0x00000004!

After the last "RROR" line the bootloader actually makes reset. Sometimes there is even no message, but the bootloader just restarts. With baud rate 115200 I get messages:

:DEBUG:Waiting for events
:WARNING:Received unsupported OP code 00
:DEBUG:Sending Response: [0x0, 0x3]
:WARNING:Received unsupported OP code d1
:DEBUG:Sending Response: [0xd1, 0x3]

In both cases, the nRFgo Studio says:

Timed out waiting for acknowledgement from device.
Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.
Possible causes:
- bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
- baud rate or flow control is not the same as in the target bootloader.
- target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.

Turning flow control off from the bootloader and in the nRFgo Studio does not help.

The question is, how should the serial bootloader actually work? What goes wrong with this?

EDIT

I just installed nrfutil version 2.3.0 and tried a comman:

$ nrfutil dfu serial -pkg dfu_test_app_hrm_s132.zip -p COM9 -b 115200 -fc 0

That gives me the following output at bootloader side:

:WARNING:Received unsupported OP code 09
:DEBUG:Sending Response: [0x9, 0x3]
:WARNING:Received unsupported OP code 09
:DEBUG:Sending Response: [0x9, 0x3]
:DEBUG:Set receipt notif
:DEBUG:Sending Response: [0x2, 0x1]
:DEBUG:Received get serial mtu
:DEBUG:Sending Response: [0x7, 0x1]
:DEBUG:Received select object
:INFO:Valid Command: NRF_DFU_OBJECT_OP_SELECT
:DEBUG:Sending Response: [0x6, 0x1]
:DEBUG:Received execute object
:INFO:Before OP execute command
:INFO:Valid command execute
:INFO:
:INFO:PB: Init packet data len: 61
:INFO:Handling signed command
:ERROR:Prevalidate failed!
:DEBUG:Sending Response: [0x4, 0xa]

So it looks like something is working, but not completely. Any ideas what could be wrong?

serialtest.zip serialtest.hex

  • Hi Jarmo, nRFGo Studio does not support Secure Serial DFU, it only supports the Legacy Serial DFU. In order to perform Secure Serial DFU you need to use nrfutil v2.3.0, like you did in the EDIT section of your question. The Prevalidate error is caused by the signature of the dfu_test_app_hrm_s132.zip cannot be verified with the public key in the bootloader. Have you created a private-public key pair and replaced the public key in the default bootloader example?

  • Yes, I have now tried with the sdk example zip-package using "NRF_DFU_DEBUG_VERSION" of the public key in the bootloader code. Then, I also tried with two self-generated key-pairs, putting the public key into the dfu_public_key.c, and recompiling the bootloader. Then, I generated the package with command:

    nrfutil pkg generate --hw-version 52 --sd-req 0x8c --application-version 3 --application _build/application.hex --key-file private.pem application.zip
    

    But with no luck. The result is always as shown above, with pair of unsupported OP codes and failing with "Prevalidate failed!". Well..?

  • Now that I changed sd-req into 0x98 to match the soft device in sdk 13.0.0, there is no error in bootloader side, but the nrfutil crashes with the following messages:

    $ nrfutil dfu serial -pkg c:/aistin-firmware/core-engine/core-engine.zip -p COM9 -b 115200 -fc 0

    Traceback (most recent call last):
    <...trash removed...>
      File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 347, in __calculate_checksum
        (offset, crc) = struct.unpack('<II', bytearray(response))
    TypeError: 'NoneType' object is not iterable
    

    What could be reason for that?

  • No, I have not seen that error before. Could you attach the zip file you've generated as well as the hex file to this question so that I can try to reproduce the issue here?

Related