si5351

package
v0.0.0-...-0087ba1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OUTPUT_ENABLE_CONTROL = 3

	CLK0_CONTROL = 16
	CLK1_CONTROL = 17
	CLK2_CONTROL = 18
	CLK3_CONTROL = 19
	CLK4_CONTROL = 20
	CLK5_CONTROL = 21
	CLK6_CONTROL = 22
	CLK7_CONTROL = 23

	MULTISYNTH0_PARAMETERS_1 = 42
	MULTISYNTH0_PARAMETERS_3 = 44
	MULTISYNTH1_PARAMETERS_1 = 50
	MULTISYNTH1_PARAMETERS_3 = 52
	MULTISYNTH2_PARAMETERS_1 = 58
	MULTISYNTH2_PARAMETERS_3 = 60

	SPREAD_SPECTRUM_PARAMETERS = 149

	PLL_RESET = 177

	CRYSTAL_INTERNAL_LOAD_CAPACITANCE = 183
)
View Source
const (
	CRYSTAL_LOAD_6PF  = (1 << 6)
	CRYSTAL_LOAD_8PF  = (2 << 6)
	CRYSTAL_LOAD_10PF = (3 << 6)
)
View Source
const (
	CRYSTAL_FREQ_25MHZ = 25000000
	CRYSTAL_FREQ_27MHZ = 27000000
)
View Source
const (
	PLL_A = iota
	PLL_B
)
View Source
const (
	R_DIV_1 = iota
	R_DIV_2
	R_DIV_4
	R_DIV_8
	R_DIV_16
	R_DIV_32
	R_DIV_64
	R_DIV_128
)
View Source
const (
	MULTISYNTH_DIV_4 = 4
	MULTISYNTH_DIV_6 = 6
	MULTISYNTH_DIV_8 = 8
)
View Source
const AddressAlternative = 0x61 // Assumes ADDR pin is high
View Source
const AddressDefault = 0x60 // Assumes ADDR pin is low

The I2C address which this device listens to.

Variables

View Source
var ErrInvalidParameter = errors.New("Si5351 invalid parameter")
View Source
var ErrNotInitialised = errors.New("Si5351 not initialised")

Functions

This section is empty.

Types

type Device

type Device struct {
	Address uint8
	// contains filtered or unexported fields
}

Device wraps an I2C connection to a SI5351 device.

func New

func New(bus drivers.I2C) Device

New creates a new SI5351 connection. The I2C bus must already be configured.

This function only creates the Device object, it does not touch the device.

func (*Device) Configure

func (d *Device) Configure() error

Configure sets up the device for communication TODO error handling

func (*Device) ConfigureMultisynth

func (d *Device) ConfigureMultisynth(output uint8, pll uint8, div uint32, num uint32, denom uint32) error

ConfigureMultisynth divider, which determines the output clock frequency based on the specified PLL input.

output The output channel to use (0..2)

pll The PLL input source to use, which must be one of:

  • PLL_A
  • PLL_B

div The integer divider for the Multisynth output.

If pure integer values are used, this value must be one of:
- MULTISYNTH_DIV_4
- MULTISYNTH_DIV_6
- MULTISYNTH_DIV_8
If fractional output is used, this value must be between 8 and 900.

num The 20-bit numerator for fractional output (0..1,048,575).

Set this to '0' for integer output.

denom The 20-bit denominator for fractional output (1..1,048,575).

Set this to '1' or higher to avoid divide by zero errors.

Output Clock Configuration

The multisynth dividers are applied to the specified PLL output, and are used to reduce the PLL output to a valid range (500kHz to 160MHz). The relationship can be seen in this formula, where fVCO is the PLL output frequency and MSx is the multisynth divider:

fOUT = fVCO / MSx

Valid multisynth dividers are 4, 6, or 8 when using integers, or any fractional values between 8 + 1/1,048,575 and 900 + 0/1 The following formula is used for the fractional mode divider:

a + b / c

a = The integer value, which must be 4, 6 or 8 in integer mode (MSx_INT=1) or 8..900 in fractional mode (MSx_INT=0). b = The fractional numerator (0..1,048,575) c = The fractional denominator (1..1,048,575)

NOTE: Try to use integers whenever possible to avoid clock jitter NOTE: For output frequencies > 150MHz, you must set the divider

to 4 and adjust to PLL to generate the frequency (for example
a PLL of 640 to generate a 160MHz output clock). This is not
yet supported in the driver, which limits frequencies to 500kHz .. 150MHz.

NOTE: For frequencies below 500kHz (down to 8kHz) Rx_DIV must be

used, but this isn't currently implemented in the driver.

func (*Device) ConfigurePLL

func (d *Device) ConfigurePLL(pll uint8, mult uint8, num uint32, denom uint32) error

ConfigurePLL sets the multiplier for the specified PLL pll The PLL to configure, which must be one of the following: - PLL_A - PLL_B

mult The PLL integer multiplier (must be between 15 and 90)

num The 20-bit numerator for fractional output (0..1,048,575). Set this to '0' for integer output.

denom The 20-bit denominator for fractional output (1..1,048,575). Set this to '1' or higher to avoid divider by zero errors.

PLL Configuration fVCO is the PLL output, and must be between 600..900MHz, where:

fVCO = fXTAL * (a+(b/c))

fXTAL = the crystal input frequency a = an integer between 15 and 90 b = the fractional numerator (0..1,048,575) c = the fractional denominator (1..1,048,575)

NOTE: Try to use integers whenever possible to avoid clock jitter (only use the a part, setting b to '0' and c to '1').

See: http://www.silabs.com/Support%20Documents/TechnicalDocs/AN619.pdf

func (*Device) ConfigureRdiv

func (d *Device) ConfigureRdiv(output uint8, div uint8) error

func (*Device) Connected

func (d *Device) Connected() (bool, error)

Connected returns whether a device at SI5351 address has been found.

func (*Device) DisableOutputs

func (d *Device) DisableOutputs() error

func (*Device) DisableSpreadSpectrum

func (d *Device) DisableSpreadSpectrum() error

func (*Device) EnableOutputs

func (d *Device) EnableOutputs() error

func (*Device) EnableSpreadSpectrum

func (d *Device) EnableSpreadSpectrum() error

func (*Device) OutputEnable

func (d *Device) OutputEnable(output uint8, enable bool) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL