Correcting attenuators and RF power measurement:

This commit is contained in:
Ryan Summers 2020-06-11 13:39:12 +02:00
parent c4979f08f6
commit 8283c94381
2 changed files with 7 additions and 5 deletions

View File

@ -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 = {

View File

@ -4,17 +4,17 @@ use super::{Error, Channel};
pub trait PowerMeasurementInterface {
fn sample_converter(&mut self, channel: Channel) -> Result<f32, Error>;
/// 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<f32, Error> {
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)
}
}