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

Transfert the firmware update from the PC with the library pc-nrf-dfu-js.

Hi,

Here is my setup, NRF52832 PCA10040 s132, sdk 13.0.0.

I work on Windows 10 with a server (The aim is to do it from a Raspberry later) which one is connected to my sensors with BLE.

I am trying to transfert the firmware update from the PC with the library pc-nrf-dfu-js. This library is announced like the following devices are supported:

  • USB SDFU:
    • PCA10056 nRF52840 Development Kit
    • PCA10059 nRF52840 Dongl

BUT this library contains the DfuTransportNoble class which allows the device firmware update with BLE. 

I modified the library a bit (I put the PRN set to 0 and change the value of MTU from 23 to 20) in order to match with the sdk 13.0.0 DFU bootloader

My sensors work with buttonless DFU service. 

My sensor is currently in bootloader mode and I can connect to it (DfuTarg) and start the updating. The library is able to send the init packet, the sensor validates it, then the library try to send the firmware packet but the transfert of data packet stop after some couple of 20 bytes packets... and seems to disconnect in these conditions : 

I can see in the terminal of Visual Stutio Code of the compiled libraries nrf-dfu-cjs.js that the whole function process so it sent all the 4096 bytes of firmware packets and ask for checksum to sensor.

I can see on the terminal of J-link RTT viewer that the sensor after sending answer to CreatingObject, receives only a couple of 20bytes firmware packets and then nothing else, it stopped.

I got on the terminal VSC from the library side these errors : 

2019-05-10T12:32:07.531Z [error] uncaughtException: LIBUSB_ERROR_IO
Error: LIBUSB_ERROR_IO
at startTransfer (E:\workspace\xxx\hub\xxx_hub\node_modules\usb\usb.js:352:6)
at Transfer.transferDone (E:\workspace\xxx\hub\xxx_hub\node_modules\usb\usb.js:340:4)

2019-05-10T12:32:07.534Z [error] uncaughtException: LIBUSB_TRANSFER_STALL
Error: LIBUSB_TRANSFER_STALL
2019-05-10T12:32:07.537Z [error] uncaughtException: LIBUSB_TRANSFER_ERROR
Error: LIBUSB_TRANSFER_ERROR
2019-05-10T12:32:07.540Z [error] uncaughtException: LIBUSB_TRANSFER_ERROR
Error: LIBUSB_TRANSFER_ERROR
2019-05-10T12:32:07.543Z [error] uncaughtException: LIBUSB_TRANSFER_ERROR
Error: LIBUSB_TRANSFER_ERROR
2019-05-10T12:32:07.545Z [error] uncaughtException: LIBUSB_TRANSFER_ERROR
Error: LIBUSB_TRANSFER_ERROR

I don't find the reason of these errors. 

NB : I tried to do the update with debug mode with breakpoint placed when sending 20 bytes packets and the sensor can receive around 1200-1300 bytes then stop...

Do you have any idea of the cause of this problem ? I will post another comment with a new test right after.

Thank you in advance !! 

Alan

  • 1) Then I tried to transfert the firmware update from the Raspberry using the integrated Bluetooth of the rasp and the same library pc-nrf-dfu-js and I could transfert many more packets (until around 1900 bytes) then it stopped suddenly as previously, but without error. (I'm using MobaXterm as terminal) 

    2) Then I have tried to transfert the firmware update zip from the PC with Bluetooth dongle and the Web Bluetooth Secure DFU https://thegecko.github.io/web-bluetooth-dfu/examples/web.html where I drop the zip file onine and it does the transfert automatically.

    The update completed successfully, it works fine in the case of online procedure with their library, but I can't use this solution because I have to use the library pc-nrf-dfu-ps already in place in the workspace

  • Hi,

    pc-nrf-dfu-js is not made with BLE in mind.

    For BLE DFU you can use the BLE DFU functionality in pc-ble-driver-js. That one is used by nRF Connect for Desktop, for BLE DFU. Please note that it only supports Secure DFU (nRF5 SDK v12 and newer.) If you need buttonless DFU with bonding then you must store the bonding data yourself as it is not handled automatically by the module.

    Another alternative is pc-nrfutil, which you should be able to run from an RPi.

    Regards,
    Terje

  • Hi Terje, thank you for answer. 

    I'm going to try with pc-nrfutil, because it would be a big job to integrate the pc-ble-driver-js in our workspace. 

    I'm working with SDK13, it should be ok. 

    Still I don't understand why it's said that pc-nrf-dfu-js is not made with BLE in mind whereas it contains the class DfuTransportNoble for BLE and I can still transfer init packets and some firmware packets... Where is the limit of use ? Does the implementation of BLE is not functionnal in this library ? 

    About pc-nrfutil, I can't install it on RPI (OS 32bits), is it compatible with 32 bits ?  I got this error : 

    RuntimeError: Could not load shared library /usr/local/lib/python2.7/dist-packages/pc_ble_driver_py/lib/linux/x86_32/libpc_ble_driver_shared_sd_api_v3.so : '/usr/local/lib/python2.7/dist-packages/pc_ble_driver_py/lib/linux/x86_32/libpc_ble_driver_shared_sd_api_v3.so: cannot open shared object file: No such file or directory'.

    Thank you,

    Regards.

    Alan

  • Hi Terje, 

    I have also tried to use pc-nrfutil on windows. 

    I want to precise my aim : I want to update the firmware present on PC to a remote sensor over the air in BLE. 

    Nrfutil prompt a message that "No Segger USB CDC ports found, please connect your board.". Why is it asking for Segger USB while I want to use BLE connectivity to transfert the firmware ? 

    Thank you,

    Best regards,

    Alan

  • As I understood, with nrfutil in order to do a DFU over BLE we need a NRF5 development kit board connected to the PC, which one will transfert the package to another NRF52382.... 

Related