Fixing si5351 under release mode with some delays

This commit is contained in:
2026-09-04 14:59:33 -04:00
parent 9b72868d59
commit 9dd6be55be
2 changed files with 6 additions and 5 deletions

View File

@@ -4,11 +4,11 @@
mod morse; mod morse;
mod si5351; 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::{println, warn};
use defmt_rtt as _; use defmt_rtt as _;
use fixedstr::{str_format, str8, str16, str32, str48, zstr}; use fixedstr::{str_format, str32, str48};
use panic_probe as _; use panic_probe as _;
use rp2040_hal::clocks::ClockSource; use rp2040_hal::clocks::ClockSource;
@@ -108,7 +108,7 @@ fn main() -> ! {
led_pin.set_high(); led_pin.set_high();
// Init PWMs // 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(); let test_parse: u32 = "4000".parse().unwrap();
println!("Parse: {}", test_parse); println!("Parse: {}", test_parse);
@@ -160,7 +160,6 @@ fn main() -> ! {
gfx_buf.sprites[0].x = 108; gfx_buf.sprites[0].x = 108;
gfx_buf.clear(); gfx_buf.clear();
gfx_buf.draw_textfield(10, 10, 107, 20, boot_msg.to_str()); gfx_buf.draw_textfield(10, 10, 107, 20, boot_msg.to_str());
gfx_buf.draw_textfield(10, 40, 107, 20, "Initializing si5351"); gfx_buf.draw_textfield(10, 40, 107, 20, "Initializing si5351");
sh1106_dev.blit_framebuffer(&mut i2c, &gfx_buf); sh1106_dev.blit_framebuffer(&mut i2c, &gfx_buf);
@@ -202,7 +201,7 @@ fn main() -> ! {
// UART RX (characters received by RP2040) on pin 2 (GPIO1) // UART RX (characters received by RP2040) on pin 2 (GPIO1)
pins.gpio1.into_function(), 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( .enable(
UartConfig::new(9600.Hz(), DataBits::Eight, None, StopBits::One), UartConfig::new(9600.Hz(), DataBits::Eight, None, StopBits::One),
pll_freq, pll_freq,

View File

@@ -154,8 +154,10 @@ impl Si5351Dev {
// clk 0 and 2 are the ones we actually use // clk 0 and 2 are the ones we actually use
// clk 0 use PLL A, 8mA drive // clk 0 use PLL A, 8mA drive
delay.delay_ms(10);
safe_reg_write(i2c, Si5351Register::Clock0Ctrl as u8, 0b0000_1111); safe_reg_write(i2c, Si5351Register::Clock0Ctrl as u8, 0b0000_1111);
// clk 2 use PLL B, 2mA drive // clk 2 use PLL B, 2mA drive
delay.delay_ms(10);
safe_reg_write(i2c, Si5351Register::Clock2Ctrl as u8, 0b0010_1100); safe_reg_write(i2c, Si5351Register::Clock2Ctrl as u8, 0b0010_1100);
send_command(i2c, &Si5351Register::PLLReset, 0xAC); send_command(i2c, &Si5351Register::PLLReset, 0xAC);