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

  • Ok, good. Now I tried with flow controls, at least I hope the FTDI module handles them correctly. The result is even worse, bootloader just responds with:

    :WARNING:Received unsupported OP code 09
    :DEBUG:Sending Response: [0x9, 0x3]
    

    And the nrftool dumps out following:

    $ nrfutil dfu serial -pkg ./dfu_test_app_hrm_s132.zip -p COM9 -b 115200 -fc 1
    Traceback (most recent call last):
    <...trash removed...>
      File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu.py", line 83, in _dfu_send_image
        self.dfu_transport.open()
      File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 190, in open
        if self.__ping() == False:
      File "c:\python27\lib\site-packages\nordicsemi\dfu\dfu_transport_serial.py", line 314, in __ping
        raise NordicSemiException('No ping response')
    pc_ble_driver_py.exceptions.NordicSemiException: No ping response
    

    So it does not work, still. Any ideas?

  • Yep, the CTS pin was connected into a wrong pin of the FTDI module. Now that I connected it into correct RTS pin, I really succeeded to upload a zip file into the pca10040 board! Great! Thanks again :) Now we just need to do the same with our own board...

  • @Jarmo, out of curiosity did you happen to have success with this example and modified bootloader without flow control?

  • And for the other readers, let's repeat here that you can't use nRFgo Studio but you have to run the programming from command line as:

    nrfutil dfu serial -pkg application.zip -p COM# -fc 1 -b 115200
    

    And be sure to generate the application.zip with the private.pem -file which matches the public key compiled into the serial bootloader (located in dfu_public_key.c). See nrfutil documents to find out how to generate the needed public/private key pair.

Related