This program is used to set the clock frequency of the LMK04828 and LMX2594 chips through the SPI interface. It contains several functions for communicating with these chips and configuring their registers.
The logicrfclk
module is already built into the logicrf-PYNQ-V3.0.1.img
, and you can use it by simply importing it with import logicrfclk
.
Function Descriptions
lmkx_spixfer(spi, tics_regval)
spi: SPI device instance.
tics_regval: A list containing 32-bit register values.
This is an internal function used to write to LMK registers via the SPI interface.
Function: It splits the register value into three bytes (high 8 bits, middle 8 bits, and low 8 bits) and sends them via SPI.
set_lmk_clks(bus, device, lmk04828_txt)
bus: SPI bus number.
device: SPI device number.
lmk04828_txt: File path containing the LMK register configuration.
This function sets the frequency of the LMK chip.
Function: It reads the configuration file and writes the configuration to the LMK chip.
set_lmx_reset(bus, device)
bus: SPI bus number.
device: SPI device number.
This function resets the LMX chip.
Function: Sends a reset command via SPI to reset the LMX chip.
set_lmx_clks(bus, device, lmx2594_txt)
bus: SPI bus number.
device: SPI device number.
lmx2594_txt: File path containing the LMX register configuration.
This function sets the frequency of the LMX chip.
Function: It reads the configuration file and writes the configuration to the LMX chip.
set_lmkx_clks(ref_clk, adc0_clk, adc1_clk, dac_clk, clkfile=None)
ref_clk: Reference clock frequency or file path (if clkfile=True
).
adc0_clk: ADC0 clock frequency or file path (if clkfile=True
).
adc1_clk: ADC1 clock frequency or file path (if clkfile=True
).
dac_clk: DAC clock frequency or file path (if clkfile=True
).
clkfile: Optional parameter. If True
, ref_clk
, adc0_clk
, adc1_clk
, and dac_clk
are treated as file paths.
This function sets the reference clock for all RF data converters.
Function: Based on the provided frequencies or configuration files, it sets the LMK and LMX chips' clocks.
Set Clock Frequency:
set_lmkx_clks(100.0, 250.0, 307.2, 384.0)
Set Clock Using File Paths:
set_lmkx_clks("/path/to/lmk04828.txt", "/path/to/lmx2594_0.txt", "/path/to/lmx2594_1.txt", "/path/to/lmx2594_2.txt", clkfile=True)
Hardware: LogicRF H407/H207/H417/S407 and other development boards supporting SPI interface.
Software: Python environment with the spidev
library installed.
Ensure that the configuration file paths are correct and the file contents are formatted properly.
Make sure the SPI device is correctly connected and configured before calling the functions.
About
Copyright (c) 2023, LogicRF.
Website: https://www.logicrf.com
Email: info@logicrf.com
Previous:nothing more!