Undivide MCLK and SMCLK in hw_init - #69
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
hw_initprogrammed CSCTL1 (DCO frequency) but never CSCTL3, and a resetreturns CSCTL3 to 33h, which divides both MCLK and SMCLK by 8. The fresh-boot
path fixes this in
timing_gpio_init, but a recovery boot jumps straight backinto the region without running it, so every resumed region ran at DCO/8 —
2 MHz in the default 16 MHz build.
hw_initnow writesCSCTL3 = 0inside the CSKEY window for every frequency.The CSKEY unlock moved out of the
F_CPUbranches, and the 1 MHz build nowprograms
DCOFSEL_0explicitly: it was only correct before because the resetDCO (8 MHz) divided by 8 happens to be 1 MHz.
Measurements
ckpt bench milp crc --cap 10uF, 3 runs per configuration, execution time inmicroseconds (result checksum 39423 in all runs):
BOR is the affected mode: it takes a real reset, so CSCTL3 came back divided.
SWBOR jumps to
_startwithout a hardware reset, so the divider was neverreset there and the timing is unchanged, as expected.
uv run pytest tests/ -m "milp or rockclimb or schematic": 93 passed.