zephyr/subsys/usb/device/class/dfu/Kconfig
Tomasz Moń a9bfe0a423 usb: dfu: Reduce default bwPollTimeout value
The bwPollTimeout name is somewhat confusing as it refers to minimum
polling period. The bwPollTImeout is essentially a mechanism allowing
device to ratelimit DFU_GETSTATUS requests from host.

Setting bwPollTimeout to relatively high values effectively slows down
DFU download process. The slowdown is not observed if the time between
DFU_DNLOAD and DFU_GETSTATUS is enough for the device to process the
write. That is, the bwPollTimeout does not effect DFU download if the
first DFU_GETSTATUS after DFU_DNLOAD reports dfuDNLOAD-IDLE state.
Otherwise the host must wait bwPollTimeout ms before issuing next
DFU_GETSTATUS, which slows the communicaiton to not more than 1 download
block (CONFIG_USB_REQUEST_BUFFER_SIZE) every bwPollTimeout ms.

The bwPollTimeout ideally should report an estimate how much longer the
download operation will take. Zephyr does not have such estimate and
therefore defaults to using fixed value. Reduce default bwPollTimeout
from 256 to 8 ms to allow significantly faster DFU downloads on devices
where the time between DFU_DNLOAD and DFU_GETSTATUS is too short to
process download block at the expense of unnecessary bus traffic if
processing download block takes longer than 8 ms.

Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
2022-11-22 13:03:11 +09:00

67 lines
1.9 KiB
Plaintext

# Copyright (c) 2020 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
menuconfig USB_DFU_CLASS
bool "USB DFU Class Driver"
select MPU_ALLOW_FLASH_WRITE
select POLL
depends on IMG_MANAGER
select IMG_ERASE_PROGRESSIVELY if (SOC_FLASH_NRF || FLASH_MCUX_FLEXSPI_NOR)
help
USB DFU class driver
if USB_DFU_CLASS
config USB_DEVICE_DFU_PID
hex "USB DFU Product ID"
default 0xFFFF
help
USB device product ID in DFU mode. MUST be configured by vendor.
config USB_DFU_WILL_DETACH
bool "Generate detach-attach sequence on DFU detach"
default y
help
Enabling this option makes the device responsible for detaching
itself from the bus after the DFU_DETACH request. Select this
for compatibility with host drivers that cannot issue USB reset.
DFU fails on Windows with WinUSB driver if this is not enabled.
config USB_DFU_DETACH_TIMEOUT
int
default 100 if USB_DFU_WILL_DETACH
default 1000
config USB_DFU_DEFAULT_POLLTIMEOUT
int "Default value for bwPollTimeout"
default 8
range 0 1000
help
Default value for bwPollTimeout (in ms)
config USB_DFU_ENABLE_UPLOAD
bool "Firmware uploading to the host"
help
Enabling this option allows to upload firmware image to the host.
Be aware that upload capability can be a security risk because
the executable image is always decrypted despite the image
encryption is enabled.
config USB_DFU_REBOOT
bool "Reboot after download"
select REBOOT
help
When enabled the device will automatically reboot after a download
so the bootloader can swap the images.
config USB_DFU_PERMANENT_DOWNLOAD
bool "Mark slot 1 as permanent after download"
help
When enabled the image written to slot 1 will be marked as permanent.
WARNING: This bypasses Mcuboot's test-confirm mechanism!
Downloading the wrong image will cause a bricked device.
Make sure there is some kind of recovery mechanism.
endif # USB_DFU_CLASS