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

SDK 15.3 UART DFU Example Not Working

Hello,

I am not able to get the UART DFU secure bootloader example work for PCA10040 nRF52DK.

I have flashed the device with Bootloader and SotDevice 6.1.1 version.

When I run the nrfutil on Ubuntu 16.04 I get this error "pc_ble_driver_py.exceptions.NordicSemiException: Unexpected Executed OP_CODE.
Expected: 0x03 Received: 0xAB"

Command - nrfutil dfu serial -pkg app_s132_for_uart_secure.zip -p /dev/ttyACM0 -fc 0 -b 115200

What is the reason for this error? 

I see that LED1 and LED3 are on initially. Then LED1 and LED2 turn on when I start the command. But the program exits with the error described above.

UART_MemoryMap

Error

Parents
  • Hi,

    Even 15.2 is resulting in the same problem. Is there something that I am missing in the process?

    1. Generate Private and Public Keys

    2. Generate HEX for secure UART Bootloader using Segger Studio with public key from Step 1.

    3. Generte HEX for application, in my case ble_app_uart_pca10040_s132.hex.

    4. Generate settings for bootloader -  nrfutil settings generate --family NRF52 --application ble_app_uart_pca10040_s132.hex --application-version 1 --bootloader-version 2 --bl-settings-version 1 settings.hex

    5. Merge the SD132 + secure BL + settings HEX files.

    6. Flash the nRF52832 device with the HEX generated in Step 5.

    7.  Generate zip file using the command - nrfutil pkg generate --application ble_app_uart_pca10040_s132.hex --application-version 1 --hw-version 52 --sd-req 0xB7 --key-file private.key app_uart.zip

    8. Finally run the command -  nrfutil -vvvv dfu serial -pkg app_uart.zip -p /dev/ttyACM0

    9. The output is shown in the log file.

    2020-02-27 12:02:01,664 Using board at serial port: /dev/ttyACM0
    2020-02-27 12:02:01,666 Sending Application image.
    2020-02-27 12:02:05,172 SLIP: --> [9, 1]
    2020-02-27 12:02:05,173 SLIP: <-- [96, 9, 1, 1]
    2020-02-27 12:02:05,173 Serial: Set Packet Receipt Notification 0
    2020-02-27 12:02:05,173 SLIP: --> [2, 0, 0]
    2020-02-27 12:02:05,175 SLIP: <-- [96, 2, 1]
    2020-02-27 12:02:05,175 SLIP: --> [7]
    2020-02-27 12:02:05,177 SLIP: <-- [96, 7, 1, 131, 0]
    2020-02-27 12:02:05,177 Sending init packet...
    2020-02-27 12:02:05,177 Serial: Selecting Object: type:1
    2020-02-27 12:02:05,177 SLIP: --> [6, 1]
    2020-02-27 12:02:05,180 SLIP: <-- [96, 6, 1, 0, 1, 0, 0, 13, 0, 0, 0, 229, 217, 61, 62]
    2020-02-27 12:02:05,180 Serial: Object selected:  max_size:256 offset:13 crc:1044240869
    2020-02-27 12:02:05,180 SLIP: --> [1, 1, 141, 0, 0, 0]
    2020-02-27 12:02:05,182 SLIP: <-- [96, 1, 1]
    2020-02-27 12:02:05,182 Serial: Streaming Data: len:141 offset:0 crc:0x00000000
    2020-02-27 12:02:05,182 SLIP: --> [8, 18, 138, 1, 10, 68, 8, 1, 18, 64, 8, 1, 16, 52, 26, 2, 183, 1, 32, 0, 40, 0, 48, 0, 56, 220, 227, 1, 66, 36, 8, 3, 18, 32, 126, 84, 193, 118, 182, 12, 221, 145, 49, 195, 254, 90, 230, 121, 193, 235, 58, 88, 57, 146, 196, 122, 165, 169, 202, 70, 129, 208, 61, 100, 13]
    2020-02-27 12:02:05,182 SLIP: --> [8, 84, 72, 0, 82, 4, 8, 1, 18, 0, 16, 0, 26, 64, 134, 246, 184, 220, 67, 162, 219, 171, 10, 128, 82, 185, 154, 0, 184, 152, 202, 30, 241, 87, 202, 249, 103, 8, 32, 49, 198, 158, 119, 89, 136, 71, 119, 49, 48, 218, 24, 53, 79, 245, 188, 231, 188, 214, 208, 245, 116, 242, 203, 31, 63]
    2020-02-27 12:02:05,182 SLIP: --> [8, 152, 38, 82, 9, 78, 187, 176, 216, 154, 104, 181, 86, 250]
    2020-02-27 12:02:05,183 SLIP: --> [3]
    2020-02-27 12:02:05,184 SLIP: <-- [96, 13, 2]
    Traceback (most recent call last):
      File "/home/reddyn/.local/bin/nrfutil", line 8, in <module>
        sys.exit(cli())
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
        return self.main(*args, **kwargs)
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
        rv = self.invoke(ctx)
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
        return callback(*args, **kwargs)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/__main__.py", line 1042, in serial
        timeout)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/__main__.py", line 958, in do_serial
        dfu.dfu_send_images()
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 129, in dfu_send_images
        self._dfu_send_image(self.manifest.application)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 97, in _dfu_send_image
        self.dfu_transport.send_init_packet(data)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 255, in send_init_packet
        self.__stream_data(data=init_packet)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 474, in __stream_data
        response = self.__calculate_checksum()
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 409, in __calculate_checksum
        response = self.__get_response(DfuTransportSerial.OP_CODE['CalcChecSum'])
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 492, in __get_response
        + 'Expected: 0x{:02X} Received: 0x{:02X}'.format(operation, resp[1]))
    pc_ble_driver_py.exceptions.NordicSemiException: Unexpected Executed OP_CODE.
    Expected: 0x03 Received: 0x0D
    

Reply
  • Hi,

    Even 15.2 is resulting in the same problem. Is there something that I am missing in the process?

    1. Generate Private and Public Keys

    2. Generate HEX for secure UART Bootloader using Segger Studio with public key from Step 1.

    3. Generte HEX for application, in my case ble_app_uart_pca10040_s132.hex.

    4. Generate settings for bootloader -  nrfutil settings generate --family NRF52 --application ble_app_uart_pca10040_s132.hex --application-version 1 --bootloader-version 2 --bl-settings-version 1 settings.hex

    5. Merge the SD132 + secure BL + settings HEX files.

    6. Flash the nRF52832 device with the HEX generated in Step 5.

    7.  Generate zip file using the command - nrfutil pkg generate --application ble_app_uart_pca10040_s132.hex --application-version 1 --hw-version 52 --sd-req 0xB7 --key-file private.key app_uart.zip

    8. Finally run the command -  nrfutil -vvvv dfu serial -pkg app_uart.zip -p /dev/ttyACM0

    9. The output is shown in the log file.

    2020-02-27 12:02:01,664 Using board at serial port: /dev/ttyACM0
    2020-02-27 12:02:01,666 Sending Application image.
    2020-02-27 12:02:05,172 SLIP: --> [9, 1]
    2020-02-27 12:02:05,173 SLIP: <-- [96, 9, 1, 1]
    2020-02-27 12:02:05,173 Serial: Set Packet Receipt Notification 0
    2020-02-27 12:02:05,173 SLIP: --> [2, 0, 0]
    2020-02-27 12:02:05,175 SLIP: <-- [96, 2, 1]
    2020-02-27 12:02:05,175 SLIP: --> [7]
    2020-02-27 12:02:05,177 SLIP: <-- [96, 7, 1, 131, 0]
    2020-02-27 12:02:05,177 Sending init packet...
    2020-02-27 12:02:05,177 Serial: Selecting Object: type:1
    2020-02-27 12:02:05,177 SLIP: --> [6, 1]
    2020-02-27 12:02:05,180 SLIP: <-- [96, 6, 1, 0, 1, 0, 0, 13, 0, 0, 0, 229, 217, 61, 62]
    2020-02-27 12:02:05,180 Serial: Object selected:  max_size:256 offset:13 crc:1044240869
    2020-02-27 12:02:05,180 SLIP: --> [1, 1, 141, 0, 0, 0]
    2020-02-27 12:02:05,182 SLIP: <-- [96, 1, 1]
    2020-02-27 12:02:05,182 Serial: Streaming Data: len:141 offset:0 crc:0x00000000
    2020-02-27 12:02:05,182 SLIP: --> [8, 18, 138, 1, 10, 68, 8, 1, 18, 64, 8, 1, 16, 52, 26, 2, 183, 1, 32, 0, 40, 0, 48, 0, 56, 220, 227, 1, 66, 36, 8, 3, 18, 32, 126, 84, 193, 118, 182, 12, 221, 145, 49, 195, 254, 90, 230, 121, 193, 235, 58, 88, 57, 146, 196, 122, 165, 169, 202, 70, 129, 208, 61, 100, 13]
    2020-02-27 12:02:05,182 SLIP: --> [8, 84, 72, 0, 82, 4, 8, 1, 18, 0, 16, 0, 26, 64, 134, 246, 184, 220, 67, 162, 219, 171, 10, 128, 82, 185, 154, 0, 184, 152, 202, 30, 241, 87, 202, 249, 103, 8, 32, 49, 198, 158, 119, 89, 136, 71, 119, 49, 48, 218, 24, 53, 79, 245, 188, 231, 188, 214, 208, 245, 116, 242, 203, 31, 63]
    2020-02-27 12:02:05,182 SLIP: --> [8, 152, 38, 82, 9, 78, 187, 176, 216, 154, 104, 181, 86, 250]
    2020-02-27 12:02:05,183 SLIP: --> [3]
    2020-02-27 12:02:05,184 SLIP: <-- [96, 13, 2]
    Traceback (most recent call last):
      File "/home/reddyn/.local/bin/nrfutil", line 8, in <module>
        sys.exit(cli())
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
        return self.main(*args, **kwargs)
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 717, in main
        rv = self.invoke(ctx)
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/reddyn/.local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
        return callback(*args, **kwargs)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/__main__.py", line 1042, in serial
        timeout)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/__main__.py", line 958, in do_serial
        dfu.dfu_send_images()
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 129, in dfu_send_images
        self._dfu_send_image(self.manifest.application)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu.py", line 97, in _dfu_send_image
        self.dfu_transport.send_init_packet(data)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 255, in send_init_packet
        self.__stream_data(data=init_packet)
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 474, in __stream_data
        response = self.__calculate_checksum()
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 409, in __calculate_checksum
        response = self.__get_response(DfuTransportSerial.OP_CODE['CalcChecSum'])
      File "/home/reddyn/.local/lib/python2.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 492, in __get_response
        + 'Expected: 0x{:02X} Received: 0x{:02X}'.format(operation, resp[1]))
    pc_ble_driver_py.exceptions.NordicSemiException: Unexpected Executed OP_CODE.
    Expected: 0x03 Received: 0x0D
    

Children
No Data
Related