Skip to content

Commit

Permalink
platforms: dfu_f1: Return smaller timeouts to speed up dfu-util
Browse files Browse the repository at this point in the history
  • Loading branch information
ALTracer authored and dragonmux committed Feb 2, 2024
1 parent 06e07f2 commit 813cbaf
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/platforms/common/stm32/dfu_f1.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,24 @@ void dfu_flash_program_buffer(const uint32_t baseaddr, const void *const buf, co

uint32_t dfu_poll_timeout(uint8_t cmd, uint32_t addr, uint16_t blocknum)
{
(void)cmd;
(void)addr;
(void)blocknum;
return 100;

/*
* Page (1KiB) erase times:
* STM32F103CB: 20 ms (min), 40 ms (max);
* GD32F103CB: 50 ms (typ), 400 ms (max);
*/
if (cmd == CMD_ERASE)
return 20U;

/*
* Programming times:
* STM32F103CB: 40 us (min), 52.5 us (typ), 70 us (max) -- for 16-bit half-word
* GD32F103CB: 37.5 us (typ), 105 us (max) -- for 32-bit word
* 52.5 us * 512 half-words, or 105 us * 256 words, gives 26.88 ms estimate (typ)
*/
return 27U;
}

void dfu_protect(bool enable)
Expand Down

0 comments on commit 813cbaf

Please sign in to comment.