Feature: SWD delay/frequency calibration #1955
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Detailed description
platform_max_frequency_get()
-- could run much slower or much faster.Tested on
blackpill-f411ce
,stlink
/swlink
(GD32F1, GD32F3) andf072
(32F072B-Disco) to enhance precision after correctingtiming_stm32.c
, both no_delay special case and clk_delay constants. Checks out with fx2la to <5%. I also tried emitting more than one SWD LINEREST (four) and I try to compensate for the static overhead of function calls, by subtracting eyeballed cycles taken. STM32F4 has 1-KiB ART cache, STM32F1 doesn't, GD32F1 runs from 0WS flash. STM32F0 also tested. Test a couple times to negate cold flash cache and IRQ uncertainty. JTAG could be implemented as a seprate command. Note that I did not usenative
linear regression calibration workflow, as the normal swdptap behaviour can be approximated as a linear law with no_delay point special-cased.Your checklist for this pull request
Closing issues