Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions examples/si5351/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,24 @@ func main() {
// After configuring PLLs and clocks, enable the outputs.
clockgen.EnableOutputs()

time.Sleep(time.Second)

clockgen.DisableOutputs()
println("All outputs disabled for 5 seconds")
time.Sleep(5 * time.Second)

// Now use SetFrequency to re-set the frequencies of the outputs
on := false
for {
if on {
println("Setting Clock 0 output off")
clockgen.OutputEnable(0, false)
on = false
} else {
println("Setting Clock 0 output to 100mhz")
clockgen.SetFrequency(100*machine.MHz, 0, si5351.PLL_A)
on = true
}
time.Sleep(5 * time.Second)
println()
println("Clock 0: 112.5mhz")
println("Clock 1: 13.5531mhz")
println("Clock 2: 10.706khz")
}
}
15 changes: 15 additions & 0 deletions si5351/registers.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,18 @@ const (
MULTISYNTH_DIV_6 = 6
MULTISYNTH_DIV_8 = 8
)

// Frequency constants (in Hz)
const (
CLKOUT_MIN_FREQ = 8000 // 8 kHz
CLKOUT_MAX_FREQ = 150000000 // 150 MHz
MULTISYNTH_MAX_FREQ = 150000000 // 150 MHz
MULTISYNTH_SHARE_MAX = 100000000 // 100 MHz
MULTISYNTH_DIVBY4_FREQ = 150000000 // 150 MHz
PLL_VCO_MIN = 600000000 // 600 MHz
PLL_VCO_MAX = 900000000 // 900 MHz
)

const (
SI5351_PLL_C_MAX = 1048575
)
Loading