Compare commits

..

No commits in common. "master" and "134-m-labs-intl" have entirely different histories.

6 changed files with 104 additions and 56 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

@ -1,4 +1,4 @@
{ pkgs, isePath ? "/opt/Xilinx/14.7/ISE_DS", vivadoPath ? "/opt/Xilinx/Vivado/2022.2" }:
{ pkgs, isePath ? "/opt/Xilinx/14.7/ISE_DS", vivadoPath ? "/opt/Xilinx/Vivado/2021.2" }:
rec {
ise = let
makeXilinxEnv = name: pkgs.buildFHSUserEnv {

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

@ -24,12 +24,12 @@ let
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; };
@ -66,10 +66,10 @@ in
patchPhase = ''
patch -p1 < ${./pounder-725.diff}
'';
cargoPatches = [
./pounder-cargo-patch.diff
];
doCheck = false;
outputHashes = {
"menu-0.6.0" = "sha256-Zilj27J4a/T/Je2qJr6igFj2OEw0/4fU4f0t+afm4TY=";
};
} // value))) {
dual-iir = {};
dual-iir-pounder_v1_0 = {

View File

@ -216,18 +216,9 @@ 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 ea566e14..84bde34a 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 serde::{Deserialize, Serialize};
@@ -47,6 +47,8 @@ use stabilizer::{
dac::{Dac0Output, Dac1Output, DacCode},
hal,
@ -240,7 +231,7 @@ index ea566e14..84bde34a 100644
@@ -179,6 +181,16 @@ pub struct DualIir {
/// See [signal_generator::BasicConfig#miniconf]
#[tree(depth = 2)]
source: [signal_generator::BasicConfig; 2],
signal_generator: [signal_generator::BasicConfig; 2],
+
+ /// Specifies the config for pounder DDS clock configuration, DDS channels & attenuations
+ ///
@ -255,9 +246,9 @@ index ea566e14..84bde34a 100644
impl Default for DualIir {
@@ -206,6 +218,8 @@ impl Default for DualIir {
source: Default::default(),
signal_generator: [signal_generator::BasicConfig::default(); 2],
stream: Default::default(),
stream_target: StreamTarget::default(),
+
+ pounder: None.into(),
}
@ -266,7 +257,7 @@ index ea566e14..84bde34a 100644
@@ -222,6 +236,7 @@ mod app {
active_settings: DualIir,
telemetry: TelemetryBuffer,
source: [SignalGenerator; 2],
signal_generator: [SignalGenerator; 2],
+ pounder: Option<Pounder>,
}
@ -322,12 +313,12 @@ index ea566e14..84bde34a 100644
}
}
- #[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]);
@@ -480,6 +505,17 @@ mod app {
@@ -482,6 +507,17 @@ mod app {
),
}
}
@ -343,9 +334,9 @@ index ea566e14..84bde34a 100644
+ }
+ });
c.shared
.network
@@ -491,21 +527,30 @@ 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 {
});
}
@ -353,7 +344,8 @@ index ea566e14..84bde34a 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);
let telemetry: TelemetryBuffer =
c.shared.telemetry.lock(|telemetry| *telemetry);
- let (gains, telemetry_period) =
+ let (gains, telemetry_period, pounder_config) =
@ -380,19 +372,10 @@ index ea566e14..84bde34a 100644
});
diff --git a/src/bin/lockin.rs b/src/bin/lockin.rs
index 3ddecd7c..77a7474b 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},
};
@@ -547,6 +547,7 @@ mod app {
@@ -551,6 +551,7 @@ mod app {
gains[0],
gains[1],
c.local.cpu_temp_sensor.get_temperature().unwrap(),
@ -708,24 +691,11 @@ index 5bc7e9ff..5b8d5d30 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 43733fa8..a8b90f86 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],
@ -743,7 +713,7 @@ index 43733fa8..a8b90f86 100644
}
}
diff --git a/src/net/telemetry.rs b/src/net/telemetry.rs
index c8eb536b..116382a3 100644
index 4aa82601..3dc3086c 100644
--- a/src/net/telemetry.rs
+++ b/src/net/telemetry.rs
@@ -16,7 +16,7 @@ use minimq::{DeferredPublication, Publication};

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",