[nRF52833] USB DFU Trigger Library Issue with nrfutil

Hi,

I'm having an issue including USB DFU Trigger library in my prototype application running on nRF52833.

My application is based on the ble_uart example, to which I added Buttonless DFU Service. My bootloader is based off of secure DFU bootloader, with Buttonless DFU support. I also added USB DFU in Bootloader (so Bootloader is dual transport: USB and BLE).

I'm currently able to use UART over BLE and perform BLE OTAs (started while I'm running App) using the nRF Toolbox App for Android/iOS. I'm also able to perform USB updates if I force the Dev Kit to Bootloader by holding Button4 while resetting the Dev Kit (using: "> nrfutil dfu usb-serial ... --p ..." command).

I'm now trying to incorporate the USB DFU Trigger library in my App, so I can start FW updates over USB from App.

It seems `nrfutil` is unable to detect my Dev Kit using the `--serial-number` arg (I don't think I can use `--p` since my App doesn't expose a virtual Serial Port, just USB DFU Trigger interface, as I'm not using USB for anything else in my App, except DFU Trigger).

The only modification I made to the DFU Trigger Library is changing the way DFU is entered: writing GPREGRET (which is also used by BLE Buttonless) instead of toggling the RESETPIN.

I'm calling "nrf_dfu_trigger_usb_init()" before "ble_stack_init()" in my main. Since I'm able to see my device in macOS "System Information" USB tab, I'm assuming the DFU Trigger interface is properly enumerated.

These are my DFU Trigger Library settings in sdk_config.h:

NRF_DFU_TRIGGER_USB_USB_SHARED 0
NRF_DFU_TRIGGER_USB_INTERFACE_NUM 0
APP_USBD_NRF_DFU_TRIGGER_ENABLED 1

Any help is appreciated.

Thanks,

Marco

Setup details:

Host OS: macOS Monterey 12.4 (running on M1)

HW setup: nRF52833 DK

SoftDevice: S113 (v7.2.0)

SDK version: nRF5 SDK 17.1.0 (I need to use this SDK version since I'm working on a legacy codebase)

nrfutil version: 6.1.4

IDE: Segger Embedded Studio for ARM V6.32b

Parents
  • Hi Marco, 
    There are two parts in this set up that need to work together. 
    First is the DFU trigger library on the application and second is the DFU bootloader. 

    We need to verify if they both working. 
    First please put a breakpoint and check if dfu_trigger_evt_handler() is called. It should also printout a log " DFU Detach request received. Triggering a pin reset."

    I assume you have modified dfu_trigger_evt_handler() to write to GPREGRET , I assume you triggered a soft reset after that ? 


    In your bootloader application, do you see that it enters DFU mode ? I would suggest to add a breakpoint and check if the application trigger a reset and the bootloader can read GPREGRET and enter DFU mode. 

    Have you tried to do DFU using COMPort instead of the serial number. 

    For use with serial number you need to match the serial number of the application and the bootloader in DFU mode. I assume app_usbd_serial_num_generate() is called in the application ? 

  • Hi Hung,

    Thanks for your assistance. See my answers below:

    • I tried putting a breakpoint in dfu_trigger_evt_handler() and it does not trigger; the DK does not reboot into Bootloader DFU when I run nrfutil (see the tool error message from the screenshot in my initial post).
    • Yes, I did modify the dfu_trigger_evt_handler() to write GPREGRET and then trigger a soft reset to enter DFU. I also modified the Bootloader to enable GPREGRET as a DFU entry mode.
    • I am able to perform a DFU update if I enter Bootloader DFU using Button4+RESET using the command: "./nrfutil dfu usb-serial -pkg AppUpdateFile.zip -p /dev/tty.usbmodemF40B1429CE201"

    • Yes, app_usbd_serial_num_generate() is called in the App (in the DFU Trigger Library, nrf_dfu_trigger_usb.c)

    I think nrfutil isn't properly detecting the USB DFU Trigger interface. When FW App is running, I do see my DevKit in the "USB Device Tree" in macOS (see screenshot in my initial post), however I do not see any serial port in /dev/tty.*, I'm not sure if this is expected.

    Is the DFU Trigger Library supposed to expose a virtual COM port? If so -- and since I'm unable to see the virtual COM port under /dev/tty.* -- maybe my project is missing some defines in sdk_config.h ?

  • Hi Marco, 

    I would suggest to have a look at this similar case:  Trigger library does not work 

    I did a test with Vidar's example usbd_cdc_acm_w_dfu_trigger.zip and it seems to work with nrfutil, I can get to the breakpoint inside dfu_trigger_evt_handler(). 

    Please take a look at this info from Vidar: 

      

    There is a chance that the driver used on MAC doesn't fully support the trigger library. 
    I would suggest to test Vidar example and follow his approach to include the CDC ACM class. 

  • Hi Hung, thanks for your help. I forgot to update the thread after I found a solution. My issue was that I used the same USB VID/PID as the Bootloader example, in my App. I believe that was causing the `nrfutil` tool to get confused and failed.

    Changing the PID to something else (rather than 0x512f) fixed the issue for me

Reply Children
Related