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

Parents
  • 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, 

    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

Reply
  • 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

Children
Related