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

Expanding DFU Trigger Library with custom opcode.

Hello,

We are in the final stages of our product development and we would like to add a feature used during assembly to give some sort of confirmation that everything is working OK on the board. Via USB we would like to report a single number value. We already implement the DFU Trigger module (we use the nRF52840), and I was thinking the easiest approach might be to just add an extra opcode. Currently the module has:

  1. 0x00: DFU_DETACH
  2. 0x07: Firmware_Info
  3. 0x08: Version_String

We'd like to add something like 0x09, Status_Report. 

Could someone give me some pointers on where to extend the trigger module to support such a response? I had a hard time understanding where the above three opcodes are processed. And also if this is the right way to tackle this problem. I have little experience with USB classes and as such this seemed like the easiest approach to me, but other ideas are of course welcome.

  • Hi,

    I took a brief look at this, I have not tested it, but I believe you would start by expanding app_usbd_nrf_dfu_trigger_req_t in app_usbd_nrf_dfu_trigger_types.h with the new opcode, e.g. APP_USBD_NRF_DFU_TRIGGER_REQ_STATUS_REPORT
    Then in app_usbd_nrf_dfu_trigger_inst_t in app_usbd_nrf_dfu_trigger_internal.h, add a pointer, similar to p_sem_ver, for the status report.
    The in setup_req_class_in, you would need to add APP_USBD_NRF_DFU_TRIGGER_REQ_STATUS_REPORT in the switch case, and respond with app_usbd_core_setup_rsp() with the status report.

    As you mentioned, there might be alternative approaches as well, depending on your assembly line and the product itself, e.g. indicate that everything is OK with a LED on the product.

Related