Skip to content

Commit

Permalink
dfuse: Ignore poll timeout for SET_ADDRESS special command
Browse files Browse the repository at this point in the history
For the DfuSe special command DFU_DNLOAD request SET_ADDRESS there
shouldn't be any good reason to wait for a poll timeout. This request may
involve verification of address ranges but no slow flash operation
should be needed that would make the device busy.

The non-zero bwPollTimeout seen here on many STM32 bootloaders is likely
a bootloader bug.

https://sourceforge.net/p/dfu-util/tickets/193/

Signed-off-by: Tormod Volden <[email protected]>
  • Loading branch information
tormodvolden committed Apr 15, 2024
1 parent 4faf703 commit d0ecfe7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dfuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,9 @@ static int dfuse_special_command(struct dfu_if *dif, unsigned int address,
fprintf(stderr, " Poll timeout %i ms on command %s (state=%s)\n",
polltimeout, dfuse_command_name[command],
dfu_state_to_string(dst.bState));
/* A non-null bwPollTimeout for SET_ADDRESS seems a common bootloader bug */
if (command == SET_ADDRESS)
polltimeout = 0;
if (dst.bState == DFU_STATE_dfuDNBUSY)
milli_sleep(polltimeout);
if (command == READ_UNPROTECT)
Expand Down

0 comments on commit d0ecfe7

Please sign in to comment.