USB

class squishy.gateware.usb.dfu.DFURequestHandler(*args: Any, src_loc_at: int = 0, **kwargs: Any)

USB DFU Request handler.

This implements both a fully DFU capable endpoint for firmware flashing as well as a simple DFU stub that is used to reboot the device into bootloader mode.

Parameters:
  • configuration (int) – The configuration ID for this DFU endpoint

  • interface (int) – The interface ID for this DFU endpoint

  • boot_stub (bool) – If True, only the bare minimum for triggering a DFU reboot will be generated, otherwise if False a full DFU implementation will be generated.

  • fifo (AsyncFIFO | None) – The storage FIFO.

Variables:
  • trigger_reboot (Signal) – Output: driven high when the DFU handler wants to reboot the device

  • slot_selection (Signal(2)) – Output: the flash slot address

  • dl_start (Signal) – Output: Start of a DFU transfer.

  • dl_finish (Signal) – Output: An acknowledgement of the dl_done signal

  • dl_ready (Signal) – Input: If the backing storage is ready for data.

  • dl_done (Signal) – Input: When the backing storage is done storing the data.

  • dl_size (Signal(16)) – Output: The size of the DFU transfer into the the FIFO

  • slot_changed (Signal) – Output: Raised when the DFU alt-mode is changed.

  • slot_ack (Signal) – Input: When the slot_changed signal was acted on.

Note

All of the signals for this module are expected to be on the ‘USB’ clock domain, meaning you need an FFSynchronizer for any other domain.

Raises:

ValueError – If fifo is None when boot_stub is False.