Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

9 changed files with 207 additions and 209 deletions

View File

@ -58,12 +58,12 @@ in
src = <mirnySrc>;
};
mirny-cpld-release = buildMirnyCpld rec {
version = "0.3.1";
version = "0.3";
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "mirny";
rev = "v${version}";
sha256 = "sha256-FbPUgXcUByEnczbnDCh8wYPO+rpSZSAabG1rtvA7mIs=";
sha256 = "sha256-u1iXcbGX6JkVgfpnCbkyTOVoMYnYcSufLBb6OBAeu8c=";
};
};
mirny-cpld-legacy-almazny = buildMirnyCpld rec {
@ -76,6 +76,16 @@ in
};
patchPhase = "patch -p1 < ${./mirny-legacy-almazny.diff}";
};
mirny-cpld-almazny = buildMirnyCpld rec {
version = "0.3";
src = pkgs.fetchFromGitHub {
owner = "quartiq";
repo = "mirny";
rev = "v${version}";
sha256 = "sha256-u1iXcbGX6JkVgfpnCbkyTOVoMYnYcSufLBb6OBAeu8c=";
};
patchPhase = "patch -p1 < ${./mirny-almazny.diff}";
};
fastino-fpga = pkgs.stdenv.mkDerivation {
name = "fastino-fpga";
src = <fastinoSrc>;

View File

@ -0,0 +1,40 @@
diff --git a/mirny.py b/mirny.py
index 6c041de..73991b1 100644
--- a/mirny.py
+++ b/mirny.py
@@ -135,7 +135,7 @@ class SR(Module):
)
]
- def connect_ext(self, ext, adr, mask):
+ def connect_ext(self, ext, adr, mask, sdi_passthrough=False):
adr &= mask
self._check_intersection(adr, mask)
self._slaves.append((ext, adr, mask))
@@ -146,12 +146,16 @@ class SR(Module):
stb.ce.eq(self.bus.re),
# don't glitch with &stb.o
ext.sck.eq(self.ext.sck),
- ext.sdi.eq(self.ext.sdi & stb.o),
ext.cs.eq(stb.o),
If(stb.o,
self.ext.sdo.eq(ext.sdo),
),
]
+ # Almazny shares one SDI with 4 devices, it cannot be masked by stb
+ if sdi_passthrough:
+ self.comb += ext.sdi.eq(self.ext.sdi)
+ else:
+ self.comb += ext.sdi.eq(self.ext.sdi & stb.o),
def intersection(a, b):
@@ -360,7 +364,7 @@ class Mirny(Module):
]
ext = Record(ext_layout)
- self.sr.connect_ext(ext, adr=i + 12, mask=mask)
+ self.sr.connect_ext(ext, adr=i + 12, mask=mask, sdi_passthrough=True)
self.comb += [
mezz[i + 3].oe.eq(1),
mezz[i + 3].o.eq(~ext.cs), # Almazny REG_LATCH

View File

@ -147,7 +147,7 @@
"emailoverride": "",
"keepnr": 50,
"inputs": {
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.11", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.05", "emailresponsible": false },
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
"urukulSrc": { "type": "git", "value": "https://github.com/quartiq/urukul.git", "emailresponsible": false },
"mirnySrc": { "type": "git", "value": "https://github.com/quartiq/mirny.git", "emailresponsible": false },
@ -161,7 +161,7 @@
"type": 1,
"hidden": false,
"description": "Simple Python Communications",
"flake": "git+https://github.com/m-labs/sipyco.git",
"flake": "github:m-labs/sipyco",
"checkinterval": 600,
"schedulingshares": 10,
"enableemail": false,

View File

@ -11,10 +11,11 @@
"emailoverride": "",
"keepnr": 10,
"inputs": {
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.11", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.05", "emailresponsible": false },
"mozillaOverlay": { "type": "git", "value": "https://github.com/mozilla/nixpkgs-mozilla.git", "emailresponsible": false },
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
"stabilizerSrc": { "type": "git", "value": "https://github.com/quartiq/stabilizer.git main", "emailresponsible": false }
"stabilizerSrc": { "type": "git", "value": "https://github.com/quartiq/stabilizer.git main", "emailresponsible": false },
"saymaMmcSrc": { "type": "git", "value": "https://github.com/sinara-hw/openMMC.git sayma-devel", "emailresponsible": false }
}
},
"thermostat": {

View File

@ -11,7 +11,7 @@
"emailoverride": "",
"keepnr": 10,
"inputs": {
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.11", "emailresponsible": false },
"nixpkgs": { "type": "git", "value": "https://github.com/NixOS/nixpkgs.git nixos-24.05", "emailresponsible": false },
"nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false },
"webSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/web2019.git", "emailresponsible": false },
"nmigenSrc": { "type": "git", "value": "https://gitlab.com/nmigen/nmigen.git", "emailresponsible": false }

View File

@ -8,8 +8,8 @@ let
"thumbv7em-none-eabihf"
];
rustManifest = pkgs.fetchurl {
url = "https://static.rust-lang.org/dist/2024-11-28/channel-rust-stable.toml";
sha256 = "b3544fb72bc3189697fc18ac2d3fa27d57ee8434f59d9919d4d70af2c6f010b3";
url = "https://static.rust-lang.org/dist/2024-06-13/channel-rust-stable.toml";
sha256 = "sha256-Ngiz76YP4HTY75GGdH2P+APE/DEIx2R/Dn+BwwOyzZU=";
};
rustChannelOfTargets = _channel: _date: targets:
(pkgs.lib.rustLib.fromManifestFile rustManifest {
@ -20,21 +20,16 @@ let
};
rust = rustChannelOfTargets "nightly" null targets;
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
rustc = rust // {
# https://github.com/oxalica/rust-overlay/commit/c48c2d76b68dd9ede0815fec53479375c61af857
targetPlatforms = pkgs.lib.platforms.all;
tier1TargetPlatforms = pkgs.lib.platforms.all;
badTargetPlatforms = [ ];
};
rustc = rust;
cargo = rust;
});
buildStm32Firmware = { name, src, cargoDepsName ? name, patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", doCheck ? true, binaryName ? name, extraCargoBuildArgs ? "", outputHashes ? {} }:
buildStm32Firmware = { name, src, cargoDepsName ? name, cargoPatches ? [], patchPhase ? "", extraNativeBuildInputs ? [], checkPhase ? "", doCheck ? true, binaryName ? name, extraCargoBuildArgs ? "", outputHashes ? {} }:
rustPlatform.buildRustPackage rec {
inherit name cargoDepsName;
version = "0.0.0";
inherit src;
inherit src cargoPatches;
cargoLock = { lockFile = "${src}/Cargo.lock"; inherit outputHashes; };
@ -71,6 +66,9 @@ in
patchPhase = ''
patch -p1 < ${./pounder-725.diff}
'';
cargoPatches = [
./pounder-cargo-patch.diff
];
doCheck = false;
} // value))) {
dual-iir = {};
@ -79,4 +77,28 @@ in
extraCargoBuildArgs = "--features pounder_v1_0";
};
lockin = {};
}
} //
{
# openMMC build system breaks if host compiler is not available, so do not use stdenvNoCC here
sayma-mmc = pkgs.stdenv.mkDerivation {
name = "sayma-mmc";
src = <saymaMmcSrc>;
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
nativeBuildInputs = [ pkgs.cmake pkgs.gcc-arm-embedded ];
buildPhase =
''
mkdir build
cd build
cmake .. -DBOARD=sayma -DBOARD_RTM=sayma -DVERSION= -DTARGET_CONTROLLER=LPC1776 -DCMAKE_BUILD_TYPE=Debug
make
'';
installPhase =
''
mkdir $out
cp out/* $out
mkdir -p $out $out/nix-support
echo file binary-dist $out/openMMC.axf >> $out/nix-support/hydra-build-products
echo file binary-dist $out/openMMC.bin >> $out/nix-support/hydra-build-products
'';
};
}

View File

@ -216,19 +216,10 @@ index 025f7d4f..59578cce 100644
fn add_write(&mut self, register: Register, value: &[u8]) {
let data = &mut self.data[self.index..];
diff --git a/src/bin/dual-iir.rs b/src/bin/dual-iir.rs
index d4146cc2..b9bc99d9 100644
index a4a04be8..83dcdefb 100644
--- a/src/bin/dual-iir.rs
+++ b/src/bin/dual-iir.rs
@@ -28,7 +28,7 @@
#![no_std]
#![no_main]
-use core::mem::MaybeUninit;
+use core::mem::{MaybeUninit, size_of};
use core::sync::atomic::{fence, Ordering};
use miniconf::{Leaf, Tree};
use serde::{Deserialize, Serialize};
@@ -48,6 +48,8 @@ use stabilizer::{
@@ -47,6 +47,8 @@ use stabilizer::{
dac::{Dac0Output, Dac1Output, DacCode},
hal,
signal_generator::{self, SignalGenerator},
@ -237,10 +228,10 @@ index d4146cc2..b9bc99d9 100644
timers::SamplingTimer,
DigitalInput0, DigitalInput1, SerialTerminal, SystemTimer, Systick,
UsbDevice, AFE0, AFE1,
@@ -173,6 +175,16 @@ pub struct DualIir {
/// # Value
@@ -179,6 +181,16 @@ pub struct DualIir {
/// See [signal_generator::BasicConfig#miniconf]
source: [signal_generator::BasicConfig; 2],
#[tree(depth = 2)]
signal_generator: [signal_generator::BasicConfig; 2],
+
+ /// Specifies the config for pounder DDS clock configuration, DDS channels & attenuations
+ ///
@ -254,35 +245,24 @@ index d4146cc2..b9bc99d9 100644
}
impl Default for DualIir {
@@ -200,6 +212,8 @@ impl Default for DualIir {
source: Default::default(),
@@ -206,6 +218,8 @@ impl Default for DualIir {
signal_generator: [signal_generator::BasicConfig::default(); 2],
stream: Default::default(),
stream_target: StreamTarget::default(),
+
+ pounder: None.into(),
}
}
}
@@ -211,22 +225,24 @@ mod app {
#[shared]
struct Shared {
usb: UsbDevice,
- network: NetworkUsers<DualIir, 3>,
+ network: NetworkUsers<DualIir, 6>,
settings: Settings,
@@ -222,6 +236,7 @@ mod app {
active_settings: DualIir,
telemetry: TelemetryBuffer,
source: [SignalGenerator; 2],
signal_generator: [SignalGenerator; 2],
+ pounder: Option<Pounder>,
}
#[local]
struct Local {
- usb_terminal: SerialTerminal<Settings, 4>,
+ usb_terminal: SerialTerminal<Settings, 6>,
sampling_timer: SamplingTimer,
digital_inputs: (DigitalInput0, DigitalInput1),
afes: (AFE0, AFE1),
@@ -233,6 +248,7 @@ mod app {
adcs: (Adc0Input, Adc1Input),
dacs: (Dac0Output, Dac1Output),
iir_state: [[[f32; 4]; IIR_CASCADE_LENGTH]; 2],
@ -290,16 +270,16 @@ index d4146cc2..b9bc99d9 100644
generator: FrameGenerator,
cpu_temp_sensor: stabilizer::hardware::cpu_temp_sensor::CpuTempSensor,
}
@@ -236,7 +252,7 @@ mod app {
@@ -242,7 +258,7 @@ mod app {
let clock = SystemTimer::new(|| Systick::now().ticks());
// Configure the microcontroller
- let (stabilizer, _pounder) = hardware::setup::setup::<Settings, 4>(
+ let (mut stabilizer, pounder) = hardware::setup::setup::<Settings, 6>(
+ let (mut stabilizer, pounder) = hardware::setup::setup::<Settings, 4>(
c.core,
c.device,
clock,
@@ -255,6 +271,13 @@ mod app {
@@ -261,6 +277,13 @@ mod app {
let generator = network.configure_streaming(StreamFormat::AdcDacData);
@ -313,7 +293,7 @@ index d4146cc2..b9bc99d9 100644
let shared = Shared {
usb: stabilizer.usb,
network,
@@ -273,6 +296,7 @@ mod app {
@@ -279,6 +302,7 @@ mod app {
),
],
settings: stabilizer.settings,
@ -321,7 +301,7 @@ index d4146cc2..b9bc99d9 100644
};
let mut local = Local {
@@ -283,6 +307,7 @@ mod app {
@@ -289,6 +313,7 @@ mod app {
adcs: stabilizer.adcs,
dacs: stabilizer.dacs,
iir_state: [[[0.; 4]; IIR_CASCADE_LENGTH]; 2],
@ -329,16 +309,16 @@ index d4146cc2..b9bc99d9 100644
generator,
cpu_temp_sensor: stabilizer.temperature_sensor,
};
@@ -452,7 +477,7 @@ mod app {
@@ -458,7 +483,7 @@ mod app {
}
}
- #[task(priority = 1, local=[afes], shared=[network, settings, active_settings, source])]
+ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, active_settings, source, pounder])]
- #[task(priority = 1, local=[afes], shared=[network, settings, active_settings, signal_generator])]
+ #[task(priority = 1, local=[afes, dds_clock_state], shared=[network, settings, active_settings, signal_generator, pounder])]
async fn settings_update(mut c: settings_update::Context) {
c.shared.settings.lock(|settings| {
c.local.afes.0.set_gain(*settings.dual_iir.afe[0]);
@@ -474,6 +499,17 @@ mod app {
c.local.afes.0.set_gain(settings.dual_iir.afe[0]);
@@ -482,6 +507,17 @@ mod app {
),
}
}
@ -354,9 +334,9 @@ index d4146cc2..b9bc99d9 100644
+ }
+ });
c.shared
.network
@@ -485,22 +521,31 @@ mod app {
let target = settings.dual_iir.stream_target.into();
c.shared.network.lock(|net| net.direct_stream(target));
@@ -492,22 +528,31 @@ mod app {
});
}
@ -364,16 +344,16 @@ index d4146cc2..b9bc99d9 100644
+ #[task(priority = 1, shared=[network, settings, telemetry, pounder], local=[cpu_temp_sensor])]
async fn telemetry(mut c: telemetry::Context) {
loop {
let telemetry =
c.shared.telemetry.lock(|telemetry| telemetry.clone());
let telemetry: TelemetryBuffer =
c.shared.telemetry.lock(|telemetry| *telemetry);
- let (gains, telemetry_period) =
+ let (gains, telemetry_period, pounder_config) =
c.shared.settings.lock(|settings| {
- (settings.dual_iir.afe, *settings.dual_iir.telemetry_period)
- (settings.dual_iir.afe, settings.dual_iir.telemetry_period)
+ (
+ settings.dual_iir.afe,
+ *settings.dual_iir.telemetry_period,
+ settings.dual_iir.telemetry_period,
+ settings.dual_iir.pounder
+ )
});
@ -384,90 +364,25 @@ index d4146cc2..b9bc99d9 100644
+
c.shared.network.lock(|net| {
net.telemetry.publish(&telemetry.finalize(
*gains[0],
*gains[1],
gains[0],
gains[1],
c.local.cpu_temp_sensor.get_temperature().unwrap(),
+ pounder_telemetry,
))
});
diff --git a/src/bin/lockin.rs b/src/bin/lockin.rs
index d8d193dd..4e5abb28 100644
index e0cfb58f..c9b26831 100644
--- a/src/bin/lockin.rs
+++ b/src/bin/lockin.rs
@@ -29,7 +29,7 @@
use core::{
convert::TryFrom,
- mem::MaybeUninit,
+ mem::{MaybeUninit, size_of},
sync::atomic::{fence, Ordering},
};
@@ -248,7 +248,7 @@ mod app {
#[shared]
struct Shared {
usb: UsbDevice,
- network: NetworkUsers<Lockin, 2>,
+ network: NetworkUsers<Lockin, 6>,
settings: Settings,
active_settings: Lockin,
telemetry: TelemetryBuffer,
@@ -256,7 +256,7 @@ mod app {
#[local]
struct Local {
- usb_terminal: SerialTerminal<Settings, 3>,
+ usb_terminal: SerialTerminal<Settings, 6>,
sampling_timer: SamplingTimer,
digital_inputs: (DigitalInput0, DigitalInput1),
timestamper: InputStamper,
@@ -275,7 +275,7 @@ mod app {
let clock = SystemTimer::new(|| Systick::now().ticks());
// Configure the microcontroller
- let (mut stabilizer, _pounder) = hardware::setup::setup::<Settings, 3>(
+ let (mut stabilizer, _pounder) = hardware::setup::setup::<Settings, 6>(
c.core,
c.device,
clock,
@@ -543,6 +543,7 @@ mod app {
*gains[0],
*gains[1],
@@ -551,6 +551,7 @@ mod app {
gains[0],
gains[1],
c.local.cpu_temp_sensor.get_temperature().unwrap(),
+ None,
))
});
diff --git a/src/bin/urukul.rs b/src/bin/urukul.rs
index fc7faf40..10ff9016 100644
--- a/src/bin/urukul.rs
+++ b/src/bin/urukul.rs
@@ -104,21 +104,21 @@ mod app {
#[shared]
struct Shared {
usb: UsbDevice,
- network: NetworkUsers<App, 3>,
+ network: NetworkUsers<App, 6>,
settings: Settings,
}
#[local]
struct Local {
urukul: Urukul,
- usb_terminal: SerialTerminal<Settings, 4>,
+ usb_terminal: SerialTerminal<Settings, 6>,
}
#[init]
fn init(c: init::Context) -> (Shared, Local) {
let clock = SystemTimer::new(|| Systick::now().ticks());
- let (stabilizer, _pounder) = hardware::setup::setup::<Settings, 4>(
+ let (stabilizer, _pounder) = hardware::setup::setup::<Settings, 6>(
c.core,
c.device,
clock,
diff --git a/src/hardware/pounder/attenuators.rs b/src/hardware/pounder/attenuators.rs
index cfd08b7f..2570f506 100644
--- a/src/hardware/pounder/attenuators.rs
@ -497,7 +412,7 @@ index cfd08b7f..2570f506 100644
Ok(attenuation_code as f32 / 2.0)
}
diff --git a/src/hardware/pounder/dds_output.rs b/src/hardware/pounder/dds_output.rs
index 5527a8e1..23435e2e 100644
index 3ae1ce90..cd978b01 100644
--- a/src/hardware/pounder/dds_output.rs
+++ b/src/hardware/pounder/dds_output.rs
@@ -55,7 +55,7 @@
@ -509,7 +424,7 @@ index 5527a8e1..23435e2e 100644
use ad9959::{Channel, Mode, ProfileSerializer};
/// The DDS profile update stream.
@@ -157,6 +157,46 @@ impl ProfileBuilder<'_> {
@@ -157,6 +157,46 @@ impl<'a> ProfileBuilder<'a> {
self
}
@ -557,7 +472,7 @@ index 5527a8e1..23435e2e 100644
#[allow(dead_code)]
#[inline]
diff --git a/src/hardware/pounder/mod.rs b/src/hardware/pounder/mod.rs
index c144db0c..a6831605 100644
index 5bc7e9ff..5b8d5d30 100644
--- a/src/hardware/pounder/mod.rs
+++ b/src/hardware/pounder/mod.rs
@@ -1,10 +1,17 @@
@ -570,30 +485,28 @@ index c144db0c..a6831605 100644
+use ad9959::{
+ amplitude_to_acr, frequency_to_ftw, phase_to_pow, validate_clocking,
+};
use embedded_hal_02::blocking::spi::Transfer;
use embedded_hal::blocking::spi::Transfer;
use enum_iterator::Sequence;
+use miniconf::{Leaf, Tree};
+use miniconf::Tree;
+use rf_power::PowerMeasurementInterface;
use serde::{Deserialize, Serialize};
+use stm32h7xx_hal::time::MegaHertz;
pub mod attenuators;
pub mod dds_output;
@@ -120,38 +127,97 @@ impl From<Channel> for GpioPin {
@@ -120,40 +127,99 @@ impl From<Channel> for GpioPin {
}
}
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
-pub struct DdsChannelState {
- pub phase_offset: f32,
- pub frequency: f32,
- pub amplitude: f32,
- pub enabled: bool,
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, Tree)]
+pub struct DdsChannelConfig {
+ pub frequency: Leaf<f32>,
+ pub phase_offset: Leaf<f32>,
+ pub amplitude: Leaf<f32>,
pub frequency: f32,
+ pub phase_offset: f32,
pub amplitude: f32,
- pub enabled: bool,
}
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
@ -603,9 +516,9 @@ index c144db0c..a6831605 100644
+impl Default for DdsChannelConfig {
+ fn default() -> Self {
+ Self {
+ frequency: 0.0.into(),
+ phase_offset: 0.0.into(),
+ amplitude: 0.0.into(),
+ frequency: 0.0,
+ phase_offset: 0.0,
+ amplitude: 0.0,
+ }
+ }
}
@ -627,12 +540,8 @@ index c144db0c..a6831605 100644
+ /// Control amplitudes of DDS channels. It corresponds to the AD9959 ACR register, which
+ /// controls the amplitude scaling factor of DDS channels.
+ pub amplitude_control: u32,
}
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
-pub struct OutputChannelState {
- pub attenuation: f32,
- pub channel: DdsChannelState,
+}
+
+impl TryFrom<(ClockConfig, ChannelConfig)> for Profile {
+ type Error = ad9959::Error;
+
@ -640,52 +549,52 @@ index c144db0c..a6831605 100644
+ (clocking, channel): (ClockConfig, ChannelConfig),
+ ) -> Result<Self, Self::Error> {
+ let system_clock_frequency =
+ *clocking.reference_clock * *clocking.multiplier as f32;
+ clocking.reference_clock * clocking.multiplier as f32;
+ Ok(Profile {
+ frequency_tuning_word: frequency_to_ftw(
+ *channel.dds.frequency,
+ channel.dds.frequency,
+ system_clock_frequency,
+ )?,
+ phase_offset: phase_to_pow(*channel.dds.phase_offset)?,
+ amplitude_control: amplitude_to_acr(*channel.dds.amplitude)?,
+ phase_offset: phase_to_pow(channel.dds.phase_offset)?,
+ amplitude_control: amplitude_to_acr(channel.dds.amplitude)?,
+ })
+ }
}
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
-pub struct DdsClockConfig {
- pub multiplier: u8,
- pub reference_clock: f32,
- pub external_clock: bool,
-pub struct OutputChannelState {
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, Tree)]
+pub struct ChannelConfig {
+ #[tree]
+ pub dds: DdsChannelConfig,
+ pub attenuation: Leaf<f32>,
+}
+
pub attenuation: f32,
- pub channel: DdsChannelState,
}
-#[derive(Serialize, Deserialize, Copy, Clone, Debug)]
-pub struct DdsClockConfig {
+impl Default for ChannelConfig {
+ fn default() -> Self {
+ ChannelConfig {
+ dds: DdsChannelConfig::default(),
+ attenuation: 31.5.into(),
+ attenuation: 31.5,
+ }
+ }
+}
+
+#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq, Tree)]
+pub struct ClockConfig {
+ pub multiplier: Leaf<u8>,
+ pub reference_clock: Leaf<f32>,
+ pub external_clock: Leaf<bool>,
+}
+
pub multiplier: u8,
pub reference_clock: f32,
pub external_clock: bool,
}
+impl Default for ClockConfig {
+ fn default() -> Self {
+ Self {
+ multiplier: 5.into(),
+ reference_clock: (MegaHertz::MHz(100).to_Hz() as f32).into(),
+ external_clock: false.into(),
+ multiplier: 5,
+ reference_clock: MegaHertz::MHz(100).to_Hz() as f32,
+ external_clock: false,
+ }
+ }
+}
@ -694,13 +603,15 @@ index c144db0c..a6831605 100644
+pub struct PounderConfig {
+ #[tree]
+ pub clock: ClockConfig,
+ #[tree]
+ #[tree(depth = 2)]
+ pub in_channel: [ChannelConfig; 2],
+ #[tree]
+ #[tree(depth = 2)]
+ pub out_channel: [ChannelConfig; 2],
}
+}
+
impl From<Channel> for ad9959::Channel {
/// Translate pounder channels to DDS output channels.
fn from(other: Channel) -> Self {
@@ -585,3 +651,78 @@ impl rf_power::PowerMeasurementInterface for PounderDevices {
Ok(adc_scale * 2.048)
}
@ -714,19 +625,19 @@ index c144db0c..a6831605 100644
+ ) {
+ if *clocking != settings.clock {
+ match validate_clocking(
+ *settings.clock.reference_clock,
+ *settings.clock.multiplier,
+ settings.clock.reference_clock,
+ settings.clock.multiplier,
+ ) {
+ Ok(_frequency) => {
+ self.pounder
+ .set_ext_clk(*settings.clock.external_clock)
+ .set_ext_clk(settings.clock.external_clock)
+ .unwrap();
+
+ self.dds_output
+ .builder()
+ .set_system_clock(
+ *settings.clock.reference_clock,
+ *settings.clock.multiplier,
+ settings.clock.reference_clock,
+ settings.clock.multiplier,
+ )
+ .unwrap()
+ .write();
@ -757,7 +668,7 @@ index c144db0c..a6831605 100644
+
+ if let Err(err) = self.pounder.set_attenuation(
+ pounder_channel,
+ *channel_config.attenuation,
+ channel_config.attenuation,
+ ) {
+ log::error!("Invalid attenuation settings: {:?}", err)
+ }
@ -780,24 +691,11 @@ index c144db0c..a6831605 100644
+ }
+ }
+}
diff --git a/src/net/data_stream.rs b/src/net/data_stream.rs
index 714ec57f..d442f197 100644
--- a/src/net/data_stream.rs
+++ b/src/net/data_stream.rs
@@ -25,7 +25,7 @@
#![allow(non_camel_case_types)] // https://github.com/rust-embedded/heapless/issues/411
-use core::{fmt::Write, mem::MaybeUninit};
+use core::{fmt::Write, mem::{MaybeUninit, size_of_val}};
use heapless::{
box_pool,
pool::boxed::{Box, BoxBlock},
diff --git a/src/net/mod.rs b/src/net/mod.rs
index 8d815e51..5541f8ba 100644
index a10b7cdb..efa2b8c8 100644
--- a/src/net/mod.rs
+++ b/src/net/mod.rs
@@ -32,14 +32,14 @@ pub type NetworkReference =
@@ -33,14 +33,14 @@ pub type NetworkReference =
pub struct MqttStorage {
telemetry: [u8; 2048],
@ -815,7 +713,7 @@ index 8d815e51..5541f8ba 100644
}
}
diff --git a/src/net/telemetry.rs b/src/net/telemetry.rs
index 6b42b97c..48f9828e 100644
index 4aa82601..3dc3086c 100644
--- a/src/net/telemetry.rs
+++ b/src/net/telemetry.rs
@@ -16,7 +16,7 @@ use minimq::{DeferredPublication, Publication};
@ -853,8 +751,8 @@ index 6b42b97c..48f9828e 100644
+ pub config: PounderConfig,
}
impl TelemetryBuffer {
@@ -77,10 +97,17 @@ impl TelemetryBuffer {
impl Default for TelemetryBuffer {
@@ -87,10 +107,17 @@ impl TelemetryBuffer {
/// * `afe0` - The current AFE configuration for channel 0.
/// * `afe1` - The current AFE configuration for channel 1.
/// * `cpu_temp` - The current CPU temperature.
@ -873,7 +771,7 @@ index 6b42b97c..48f9828e 100644
let in0_volts = Into::<f32>::into(self.adcs[0]) / afe0.as_multiplier();
let in1_volts = Into::<f32>::into(self.adcs[1]) / afe1.as_multiplier();
@@ -89,6 +116,7 @@ impl TelemetryBuffer {
@@ -99,6 +126,7 @@ impl TelemetryBuffer {
adcs: [in0_volts, in1_volts],
dacs: [self.dacs[0].into(), self.dacs[1].into()],
digital_inputs: self.digital_inputs,

View File

@ -0,0 +1,28 @@
diff --git a/Cargo.lock b/Cargo.lock
index 7c796acf..cee5ba60 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -983,9 +983,9 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.203"
+version = "1.0.202"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
+checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
dependencies = [
"serde_derive",
]
@@ -1003,9 +1003,9 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.203"
+version = "1.0.202"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
+checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
dependencies = [
"proc-macro2",
"quote",

View File

@ -8,8 +8,7 @@ in
web-intl = pkgs.runCommand "web-intl" {}
''
cd ${web-src}
export DOMAINNAME=m-labs-intl.com
${pkgs.zola}/bin/zola build -o $out -u https://$DOMAINNAME
DOMAINNAME=m-labs-intl.com ${pkgs.zola}/bin/zola build -o $out
'';
sphinxcontrib-platformpicker = pkgs.python3Packages.buildPythonPackage rec {
pname = "sphinxcontrib-platformpicker";