ant dfu with nrf util and ant dfu secure example on windows 10 x64

Hello!

My steps:

1 - Full working  dfu over ble on nrf52840-dk  + nrfutil + nrf52840 Dongle

2 - Change transport BLE -> ANT + nrfutil + ANT USB Stick 2, ANT USB(two different sticks)

I think there is some problem with the driver libraries, but what?

Embedded device enter to dfu mode and send messages over ANT. Observ ANT found device type 10, trans type 49, device number 11548

Log from nrf52840-dk

00> <debug> app: Enter nrf_bootloader_fw_activate
00>
00> <info> app: No firmware to activate.
00>
00> <debug> nrf_dfu_validation: CRC check of app failed. Return 0
00>
00> <warning> app: Boot validation failed. App is invalid.
00>
00> <debug> app: DFU mode because app is not valid.
00>
00> <info> nrf_bootloader_wdt: WDT is not enabled
00>
00> <debug> app: in weak nrf_dfu_init_user
00>
00> <debug> app: timer_stop (0x200059BC)
00>
00> <debug> app: timer_activate (0x200059BC)
00>
00> <info> app: Entering DFU mode.
00>
00> <debug> app: Initializing transports (found: 1)
00>
00> <debug> nrf_dfu_ant: Initializing ANT DFU transport
00>
00> <debug> nrf_dfu_ant: Setting up vector table: 0x000F1000
00>
00> <debug> nrf_dfu_ant: Enabling softdevice
00>
00> <debug> nrf_dfu_ant: ANT transport intialized
00>
00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
00>
00> <debug> app: Enter main loop 

Log from pc:

nrfutil -v -v -v -v dfu ant -pkg update.zip -d
2021-11-16 15:58:03,570 Sending Application image.
2021-11-16 15:58:06,712 ANT: --> [9, 1]
Traceback (most recent call last):
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\Scripts\nrfutil-script.py", line 33, in <module>
sys.exit(load_entry_point('nrfutil==6.1.3', 'console_scripts', 'nrfutil')())
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\__main__.py", line 1293, in ant
dfu.dfu_send_images()
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu.py", line 127, in dfu_send_images
self._dfu_send_image(self.manifest.application)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu.py", line 88, in _dfu_send_image
self.dfu_transport.open()
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 364, in open
if not self.__ping():
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 476, in __ping
self.dfu_adapter.send_message([DfuTransportAnt.OP_CODE['Ping'], self.ping_id])
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 198, in send_message
self.__wait_for_condition(lambda: self.tx_result is not None)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 218, in __wait_for_condition
self.__process_mesg(timeout -
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 222, in __process_mesg
mesg = self.__get_ant_mesg(timeout)
File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 294, in __get_ant_mesg
raise NordicSemiException('No message received from device')
pc_ble_driver_py.exceptions.NordicSemiException: No message received from device

Parents
  • dfu_transport.py after row 190 add:

    if len(data) < 9:
                len_append = 9 - len(data)
                for _ in range(len_append):
                    data.append(0)

    and now:

    2021-11-17 15:43:35,879 Sending Application image.
    2021-11-17 15:43:39,333 ANT: --> [9, 1]
    2021-11-17 15:43:39,513 ANT: <-- [96, 9, 1, 1]
    2021-11-17 15:43:39,513 ANT: Set Packet Receipt Notification 0
    2021-11-17 15:43:39,516 ANT: --> [2, 0, 0]
    2021-11-17 15:43:39,703 ANT: <-- [96, 2, 1]
    2021-11-17 15:43:39,703 ANT: --> [7]
    2021-11-17 15:43:39,894 ANT: <-- [96, 7, 1, 0, 4]
    2021-11-17 15:43:39,894 Sending init packet...
    2021-11-17 15:43:39,897 ANT: Selecting Object: type:1
    2021-11-17 15:43:39,897 ANT: --> [6, 1]
    2021-11-17 15:43:40,084 ANT: <-- [96, 6, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    2021-11-17 15:43:40,084 ANT: Object selected:  max_size:512 offset:0 crc:0
    2021-11-17 15:43:40,087 ANT: --> [1, 1, 141, 0, 0, 0]
    2021-11-17 15:43:40,264 ANT: <-- [96, 1, 1]
    2021-11-17 15:43:40,264 ANT: Streaming Data: len:141 offset:0 crc:0x00000000
    2021-11-17 15:43:40,267 ANT: --> [8, 18, 138, 1, 10, 68, 8, 1, 18, 64, 8, 2, 16, 52, 26, 2, 208, 1, 32, 0, 40, 0, 48, 0, 56, 128, 224, 1, 66, 36, 8, 3, 18, 32, 46, 107, 186, 112, 245, 178, 229, 231, 131, 147, 146, 67, 180, 93, 227, 146, 238, 143, 212, 228, 186, 19, 225, 93, 159, 119, 1, 83, 115, 127, 178, 146, 72, 0, 82, 4, 8, 1, 18, 0, 16, 0, 26, 64, 51, 104, 44, 49, 7, 79, 53, 8, 12, 141, 129, 164, 71, 124, 224, 163, 71, 228, 156, 254, 180, 253, 72, 9, 17, 160, 84, 212, 7, 144, 127, 3, 74, 30, 189, 189, 54, 64, 224, 128, 158, 235, 135, 88, 233, 167, 22, 131, 239, 153, 77, 29, 146, 32, 4, 201, 178, 171, 28, 56, 93, 190, 155, 142]
    Traceback (most recent call last):
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\Scripts\nrfutil-script.py", line 33, in <module>
        sys.exit(load_entry_point('nrfutil==6.1.3', 'console_scripts', 'nrfutil')())
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1128, in __call__
        return self.main(*args, **kwargs)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1053, in main
        rv = self.invoke(ctx)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1659, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1659, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1395, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 754, in invoke
        return __callback(*args, **kwargs)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\__main__.py", line 1293, in ant
        dfu.dfu_send_images()
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu.py", line 127, in dfu_send_images
        self._dfu_send_image(self.manifest.application)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu.py", line 95, in _dfu_send_image
        self.dfu_transport.send_init_packet(data)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 416, in send_init_packet
        self.__stream_data(data=init_packet)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 576, in __stream_data
        self.dfu_adapter.send_message(list(to_transmit))
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 208, in send_message
        self.__wait_for_condition(lambda: self.tx_result is not None)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 228, in __wait_for_condition
        self.__process_mesg(timeout -
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 232, in __process_mesg
        mesg = self.__get_ant_mesg(timeout)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 300, in __get_ant_mesg
        if self.ant_dev.wait_for_message(int(timeout * 1000)):
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\antlib\antdevice.py", line 1015, in wait_for_message
        raise ANTDeviceError(self, 'wait_for_message')
    antlib.antdevice.ANTDeviceError: Error interfacing with the ANT Library!
    Error interfacing with ANT device: wait_for_message failed
    Additional Information:
    device: <ANTDevice usb-0 (57600 Baud) with basic framer>

Reply
  • dfu_transport.py after row 190 add:

    if len(data) < 9:
                len_append = 9 - len(data)
                for _ in range(len_append):
                    data.append(0)

    and now:

    2021-11-17 15:43:35,879 Sending Application image.
    2021-11-17 15:43:39,333 ANT: --> [9, 1]
    2021-11-17 15:43:39,513 ANT: <-- [96, 9, 1, 1]
    2021-11-17 15:43:39,513 ANT: Set Packet Receipt Notification 0
    2021-11-17 15:43:39,516 ANT: --> [2, 0, 0]
    2021-11-17 15:43:39,703 ANT: <-- [96, 2, 1]
    2021-11-17 15:43:39,703 ANT: --> [7]
    2021-11-17 15:43:39,894 ANT: <-- [96, 7, 1, 0, 4]
    2021-11-17 15:43:39,894 Sending init packet...
    2021-11-17 15:43:39,897 ANT: Selecting Object: type:1
    2021-11-17 15:43:39,897 ANT: --> [6, 1]
    2021-11-17 15:43:40,084 ANT: <-- [96, 6, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    2021-11-17 15:43:40,084 ANT: Object selected:  max_size:512 offset:0 crc:0
    2021-11-17 15:43:40,087 ANT: --> [1, 1, 141, 0, 0, 0]
    2021-11-17 15:43:40,264 ANT: <-- [96, 1, 1]
    2021-11-17 15:43:40,264 ANT: Streaming Data: len:141 offset:0 crc:0x00000000
    2021-11-17 15:43:40,267 ANT: --> [8, 18, 138, 1, 10, 68, 8, 1, 18, 64, 8, 2, 16, 52, 26, 2, 208, 1, 32, 0, 40, 0, 48, 0, 56, 128, 224, 1, 66, 36, 8, 3, 18, 32, 46, 107, 186, 112, 245, 178, 229, 231, 131, 147, 146, 67, 180, 93, 227, 146, 238, 143, 212, 228, 186, 19, 225, 93, 159, 119, 1, 83, 115, 127, 178, 146, 72, 0, 82, 4, 8, 1, 18, 0, 16, 0, 26, 64, 51, 104, 44, 49, 7, 79, 53, 8, 12, 141, 129, 164, 71, 124, 224, 163, 71, 228, 156, 254, 180, 253, 72, 9, 17, 160, 84, 212, 7, 144, 127, 3, 74, 30, 189, 189, 54, 64, 224, 128, 158, 235, 135, 88, 233, 167, 22, 131, 239, 153, 77, 29, 146, 32, 4, 201, 178, 171, 28, 56, 93, 190, 155, 142]
    Traceback (most recent call last):
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\Scripts\nrfutil-script.py", line 33, in <module>
        sys.exit(load_entry_point('nrfutil==6.1.3', 'console_scripts', 'nrfutil')())
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1128, in __call__
        return self.main(*args, **kwargs)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1053, in main
        rv = self.invoke(ctx)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1659, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1659, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 1395, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\click\core.py", line 754, in invoke
        return __callback(*args, **kwargs)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\__main__.py", line 1293, in ant
        dfu.dfu_send_images()
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu.py", line 127, in dfu_send_images
        self._dfu_send_image(self.manifest.application)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu.py", line 95, in _dfu_send_image
        self.dfu_transport.send_init_packet(data)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 416, in send_init_packet
        self.__stream_data(data=init_packet)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 576, in __stream_data
        self.dfu_adapter.send_message(list(to_transmit))
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 208, in send_message
        self.__wait_for_condition(lambda: self.tx_result is not None)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 228, in __wait_for_condition
        self.__process_mesg(timeout -
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 232, in __process_mesg
        mesg = self.__get_ant_mesg(timeout)
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\nordicsemi\dfu\dfu_transport_ant.py", line 300, in __get_ant_mesg
        if self.ant_dev.wait_for_message(int(timeout * 1000)):
      File "C:\Users\Sam\AppData\Local\Programs\Python\Python39-32\lib\site-packages\antlib\antdevice.py", line 1015, in wait_for_message
        raise ANTDeviceError(self, 'wait_for_message')
    antlib.antdevice.ANTDeviceError: Error interfacing with the ANT Library!
    Error interfacing with ANT device: wait_for_message failed
    Additional Information:
    device: <ANTDevice usb-0 (57600 Baud) with basic framer>

Children
No Data
Related