From 8283c94381c4f74b97c723fe827e88e93835bdf4 Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Thu, 11 Jun 2020 13:39:12 +0200 Subject: [PATCH] Correcting attenuators and RF power measurement: --- stabilizer/src/main.rs | 4 +++- stabilizer/src/pounder/rf_power.rs | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/stabilizer/src/main.rs b/stabilizer/src/main.rs index 2e76070..452e2da 100644 --- a/stabilizer/src/main.rs +++ b/stabilizer/src/main.rs @@ -396,7 +396,9 @@ const APP: () = { }) .frame_size(8); - dp.SPI1.spi((spi_sck, spi_miso, spi_mosi), config, 25.mhz(), &clocks) + // The maximum frequency of this SPI must be limited due to capacitance on the MISO + // line causing a long RC decay. + dp.SPI1.spi((spi_sck, spi_miso, spi_mosi), config, 5.mhz(), &clocks) }; let adc1 = { diff --git a/stabilizer/src/pounder/rf_power.rs b/stabilizer/src/pounder/rf_power.rs index ffe30f1..57a7f7d 100644 --- a/stabilizer/src/pounder/rf_power.rs +++ b/stabilizer/src/pounder/rf_power.rs @@ -4,17 +4,17 @@ use super::{Error, Channel}; pub trait PowerMeasurementInterface { fn sample_converter(&mut self, channel: Channel) -> Result; - /// Measure the power of an inpu channel in dB. + /// Measure the power of an input channel in dBm. /// /// Note: This function assumes the input channel is connected to an AD8363 output. /// /// Args: - /// * `channel` - The pounder channel to measure the power of. + /// * `channel` - The pounder channel to measure the power of in dBm. fn measure_power(&mut self, channel: Channel) -> Result { let analog_measurement = self.sample_converter(channel)?; // The AD8363 with VSET connected to VOUT provides an output voltage of 51.7mV / dB at - // 100MHz. - Ok(analog_measurement / 0.0517) + // 100MHz. It also indicates a y-intercept of -58dBm. + Ok(analog_measurement / 0.0517 - 58.0) } }