Fix management of CLKOUT/MCU_CLK synth sharing on H1R9#1780
Open
martinling wants to merge 1 commit into
Open
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.
On HackRF One r9, the
CLKOUTandMCU_CLKclocks use the same Si5351A multisynth and output (CLK2).Enabling and disabling the two outputs individually is achieved by downstream logic driven by the
CLKOUT_ENandMCU_CLK_ENsignals.The work in #1751 to add control of the MCU clock still had some bugs on r9:
si5351c_mcu_clkin_enable(drv, true)calledsi5351c_clkout_enablein turn to enable the shared clock, but never set theMCU_CLK_ENGPIO to gate that clock further downstream, so the MCU did not actually receive a clock.si5351c_mcu_clkin_enable(drv, true)had the side effect of turning on theCLKOUT_ENsignal despiteCLKOUTnot being requested.CLKOUTandMCU_CLKwere enabled, calling eithersi5351c_clkout_enable(drv, false)orsi5351c_mcu_clkin_enable(drv, false)would break the other clock by disabling the shared multisynth.Fix this by making both functions check the state of the other clock output, and control the multisynth and GPIOs accordingly.