oskirby / tinydfu-bootloader

USB DFU Bootloader for small FPGAs
Apache License 2.0
6 stars 4 forks source link

Detach timer bug? #6

Open bmentink opened 2 years ago

bmentink commented 2 years ago

Hi,

I was looking through usb/usb_dfu_ctrl_ep.v to determin why I am not able to boot the application for the logicbone target. In the following section:

// The DFU specification suggests that a USB reset from the dfuIDLE state should
  // return the device to application run-time mode. However, as an extension we
  // have also support the DFU_DETACH command which starts the detach timer.
  reg [15:0] dfu_detach_timer = DFU_DETACH_TIMEOUT;
  always @(posedge dfu_msec_clk) begin
    if (usb_reset && dfu_mem['h004] != DFU_STATE_appIDLE) begin
      dfu_detach <= 1'b1;
    end
    if (dfu_mem['h004] == DFU_STATE_appDETACH) begin
        if (dfu_detach_timer) dfu_detach_timer <= dfu_detach_timer - 1;
        else dfu_detach <= 1'b1;
    end
  end

The register dfu_detach is set to "1" on two conditions, but is not used anywhere in the code ... is this a bug?

Has the logicbone board port actually been tested, and determined "running"?

oskirby commented 2 years ago

How the board performs a reset is something that is specific to the FPGA family, so we opt to pass this signal as an output from the usb_dfu_core module so that the top level module can handle it. Most likely you have a bug in the handling of this signal for your board.

This signal has been tested on the Logicbone, TinyFPGA, and Arty-A7 targets.