control-clock

CLI reference

glasgow run control-clock

Generates a 50% duty cycle square wave with a specified frequency by dividing the FPGA system clock. Achievable frequencies are integer fractions of 24 MHz (for revC and later).

usage: glasgow run control-clock [-h] [-V VOLTS] [--clk PIN] [-f FREQ]
-h, --help

show this help message and exit

-V <volts>, --voltage <volts>

clock receiver power (range: 1.8..5 V, or ‘S<port>’ to follow the voltage sensed on a port; default: unchanged)

--clk <pin>

bind clock output to PIN (default: ‘A0’, required)

-f <freq>, --frequency <freq>

set clock frequency to FREQ kHz (default: 1000)

API reference

class glasgow.applet.control.clock.ClockDrivePorts(*, supply: glasgow.abstract.GlasgowSupply, clk: amaranth.lib.io.PortLike)
supply: GlasgowSupply

clock receiver power

clk: PortLike

clock output

class glasgow.applet.control.clock.ClockDriveInterface(logger: Logger, assembly: AbstractAssembly, ports: ClockDrivePorts, *, name: str = 'clk')
async enable(frequency: int) → int

Enable and configure clock.

Sets the clock frequency to frequency Hz and configures the clock pin as push-pull. If the clock pin is already configured as push-pull, then the change in frequency is done as follows: the current half-cycle has the old period, and the next half-cycle has the new period.

Returns the actual frequency used, which may be equal or less than frequency.

async disable()

Disable clock.

Disables the oscillator and configures the clock pin as Hi-Z.