diff --git a/firmware/rust1/src/bin/heizung.rs b/firmware/rust1/src/bin/heizung.rs index 6934c33ea978b9f04c454b71656af0b5937d8cb2..4248da48dc9c6d57e8dc7abac3594ddd27c8ffbe 100644 --- a/firmware/rust1/src/bin/heizung.rs +++ b/firmware/rust1/src/bin/heizung.rs @@ -316,9 +316,7 @@ async fn autobaud_task(pio0: embassy_rp::peripherals::PIO0, rx_pin: embassy_rp:: // Send zero to RX FIFO to signal start of next measurement. ".wrap_target", "timeout:", - "set x, 0", - "mov isr, x", - "push", + "in null, 32", // Wait for pin to be high for a longer time (UART is idle), copy waiting time to X // and decrement until done, start again when pin changes. @@ -350,8 +348,7 @@ async fn autobaud_task(pio0: embassy_rp::peripherals::PIO0, rx_pin: embassy_rp:: "jmp x-- measure_low", "jmp timeout", "changed_to_one:", - "mov isr, x" - "push", + "in x, 32" // Start counting, again, but for a high pulse. "mov x, osr", @@ -362,8 +359,7 @@ async fn autobaud_task(pio0: embassy_rp::peripherals::PIO0, rx_pin: embassy_rp:: "jmp x-- measure_high", "jmp timeout", "changed_to_low:", - "mov isr, x" - "push", + "in x, 32", "jmp y-- measure_next", // We are done. @@ -378,7 +374,7 @@ async fn autobaud_task(pio0: embassy_rp::peripherals::PIO0, rx_pin: embassy_rp:: const SM_FREQ: u32 = 125_000_000; cfg.clock_divider = (U56F8!(125_000_000) / U56F8!(125_000_000 /* SM_FREQ */)).to_fixed(); cfg.shift_in = ShiftConfig { - auto_fill: false, + auto_fill: true, threshold: 32, direction: ShiftDirection::Left, }; @@ -404,7 +400,8 @@ async fn autobaud_task(pio0: embassy_rp::peripherals::PIO0, rx_pin: embassy_rp:: unsafe { common.free_instr(loaded_program.used_memory); }; sm.set_enable(false); let relocated = RelocatedProgram::new(&prg.program); - cfg.use_program(&common.load_program(&relocated), &[]); + let loaded_program = common.load_program(&relocated); + cfg.use_program(&loaded_program, &[]); cfg.fifo_join = FifoJoin::RxOnly; sm.set_config(&cfg); sm.set_enable(true); @@ -415,6 +412,8 @@ async fn autobaud_task(pio0: embassy_rp::peripherals::PIO0, rx_pin: embassy_rp:: pin_io(&rx_pin).ctrl().write(|w| w.set_funcsel(embassy_rp::pac::io::vals::Gpio17ctrlFuncsel::UART0_RX.0)); } + info!("Program size for auto-baud: {}", prg.program.code.len()); + let mut dma_in_ref = dma_channel.into_ref(); let mut din = [42u32; 9]; let mut bit_index = 0;