Disabled LTO to fix I2C

This commit is contained in:
Sebastian 2023-06-14 20:38:02 +02:00
parent b604412992
commit a1fe0d2bb0
2 changed files with 15 additions and 9 deletions

View File

@ -58,7 +58,7 @@ codegen-units = 1
debug = 2
debug-assertions = false # <-
incremental = false
lto = 'fat'
#lto = 'fat'
opt-level = 3 # <-
overflow-checks = false # <-
@ -68,7 +68,7 @@ codegen-units = 1
debug = 2
debug-assertions = false # <-
incremental = false
lto = 'fat'
#lto = 'fat'
opt-level = 3 # <-
overflow-checks = false # <-

View File

@ -144,6 +144,8 @@ mod app {
pll.set_ms_phase(&mut i2c, si5153::Multisynth::MS1, 100);
pll.enable_ms_output(&mut i2c, si5153::Multisynth::MS1);
defmt::info!("Si5153 Setup done");
let dma1_channels = cx.device.DMA1.split();
let dma1_ch1 = dma1_channels.1;
// Setup ADC
@ -151,14 +153,15 @@ mod app {
adc1.set_external_trigger(EXTSEL_A::Tim1cc1);
let pa8 = gpioa.pa8.into_alternate_push_pull(&mut gpioa.crh);
let mut iq_sample_pwm = cx.device.TIM1.pwm_hz::<timer::Tim1NoRemap, _, _>(
let mut sample_pwm = cx.device.TIM1.pwm_hz::<timer::Tim1NoRemap, _, _>(
pa8,
&mut afio.mapr,
8.kHz(),
&clocks,
);
let max_duty = iq_sample_pwm.get_max_duty();
iq_sample_pwm.set_duty(Channel::C1, max_duty / 2);
let max_duty = sample_pwm.get_max_duty();
sample_pwm.set_duty(Channel::C1, max_duty / 2);
sample_pwm.enable(Channel::C1);
let i_in = gpioa.pa1.into_analog(&mut gpioa.crl);
let q_in = gpioa.pa0.into_analog(&mut gpioa.crl);
@ -214,13 +217,13 @@ mod app {
loop {
while ctx.local.iq_buffer.readable_half().unwrap() != expected_half {}
ctx.local.board_led.toggle();
ctx.local.board_led.set_low();
let half = ctx.local.iq_buffer.peek(|half, _| *half).unwrap();
for idx in 0..half.len() / 2 {
let q_raw = half[idx / 2];
let i_raw = half[idx / 2 + 1];
let q_raw = half[idx * 2];
let i_raw = half[idx * 2 + 1];
*ctx.local.i_offset = 0.95 * *ctx.local.i_offset + 0.05 * (i_raw as f32);
*ctx.local.q_offset = 0.95 * *ctx.local.q_offset + 0.05 * (q_raw as f32);
@ -229,12 +232,15 @@ mod app {
let q_sample = (q_raw as f32) - *ctx.local.q_offset;
let sample = Complex::new(i_sample as f32 / 4096.0, q_sample as f32 / 4096.0);
let filtered = ctx.local.usb_filter.compute(sample) * 2.0;
let _filtered = ctx.local.usb_filter.compute(sample) * 2.0;
}
ctx.local.board_led.set_high();
expected_half = if expected_half == dma::Half::First {
defmt::info!("Switching to second half.");
dma::Half::Second
} else {
defmt::info!("Switching to first half.");
dma::Half::First
}
}