From 9dd6be55beb4d6f367d593d8787b68cdd565db7d Mon Sep 17 00:00:00 2001 From: JP Stringham Date: Fri, 4 Sep 2026 14:59:33 -0400 Subject: [PATCH] Fixing si5351 under release mode with some delays --- src/main.rs | 9 ++++----- src/si5351.rs | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 36a18f3..c86e058 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,11 +4,11 @@ mod morse; mod si5351; -use cortex_m::prelude::{_embedded_hal_PwmPin, _embedded_hal_serial_Read}; +use cortex_m::prelude::_embedded_hal_PwmPin; use defmt::{println, warn}; use defmt_rtt as _; -use fixedstr::{str_format, str8, str16, str32, str48, zstr}; +use fixedstr::{str_format, str32, str48}; use panic_probe as _; use rp2040_hal::clocks::ClockSource; @@ -108,7 +108,7 @@ fn main() -> ! { led_pin.set_high(); // Init PWMs - let mut pwm_slices = hal::pwm::Slices::new(pac.PWM, &mut pac.RESETS); + // let mut pwm_slices = hal::pwm::Slices::new(pac.PWM, &mut pac.RESETS); let test_parse: u32 = "4000".parse().unwrap(); println!("Parse: {}", test_parse); @@ -160,7 +160,6 @@ fn main() -> ! { gfx_buf.sprites[0].x = 108; gfx_buf.clear(); gfx_buf.draw_textfield(10, 10, 107, 20, boot_msg.to_str()); - gfx_buf.draw_textfield(10, 40, 107, 20, "Initializing si5351"); sh1106_dev.blit_framebuffer(&mut i2c, &gfx_buf); @@ -202,7 +201,7 @@ fn main() -> ! { // UART RX (characters received by RP2040) on pin 2 (GPIO1) pins.gpio1.into_function(), ); - let mut uart = hal::uart::UartPeripheral::new(pac.UART0, uart_pins, &mut pac.RESETS) + let uart = hal::uart::UartPeripheral::new(pac.UART0, uart_pins, &mut pac.RESETS) .enable( UartConfig::new(9600.Hz(), DataBits::Eight, None, StopBits::One), pll_freq, diff --git a/src/si5351.rs b/src/si5351.rs index 374eab7..114c24e 100644 --- a/src/si5351.rs +++ b/src/si5351.rs @@ -154,8 +154,10 @@ impl Si5351Dev { // clk 0 and 2 are the ones we actually use // clk 0 use PLL A, 8mA drive + delay.delay_ms(10); safe_reg_write(i2c, Si5351Register::Clock0Ctrl as u8, 0b0000_1111); // clk 2 use PLL B, 2mA drive + delay.delay_ms(10); safe_reg_write(i2c, Si5351Register::Clock2Ctrl as u8, 0b0010_1100); send_command(i2c, &Si5351Register::PLLReset, 0xAC);