Skip to content

Commit

Permalink
Fix REF_TICK value
Browse files Browse the repository at this point in the history
  • Loading branch information
playfulFence committed Apr 10, 2024
1 parent 0d052c3 commit 2426e2a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions esp-hal/src/soc/esp32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub(crate) mod constants {

pub const SOC_DRAM_LOW: u32 = 0x3FFA_E000;
pub const SOC_DRAM_HIGH: u32 = 0x4000_0000;

pub const REF_TICK: fugit::HertzU32 = fugit::HertzU32::MHz(1);
}

/// Function initializes ESP32 specific memories (RTC slow and fast) and
Expand Down
2 changes: 2 additions & 0 deletions esp-hal/src/soc/esp32s2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ pub(crate) mod constants {

pub const SOC_DRAM_LOW: u32 = 0x3FFB_0000;
pub const SOC_DRAM_HIGH: u32 = 0x4000_0000;

pub const REF_TICK: fugit::HertzU32 = fugit::HertzU32::MHz(1);
}

/// Function initializes ESP32 specific memories (RTC slow and fast) and
Expand Down
6 changes: 4 additions & 2 deletions esp-hal/src/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ const UART_FIFO_SIZE: u16 = 128;

#[cfg(not(any(esp32, esp32s2)))]
use crate::soc::constants::RC_FAST_CLK;
#[cfg(any(esp32, esp32s2))]
use crate::soc::constants::REF_TICK;

/// UART Error
#[derive(Debug, Clone, Copy, PartialEq)]
Expand Down Expand Up @@ -987,8 +989,8 @@ where
fn change_baud_internal(&self, baudrate: u32, clock_source: ClockSource, clocks: &Clocks) {
let clk = match clock_source {
ClockSource::Apb => clocks.apb_clock.to_Hz(),
ClockSource::RefTick => 1, /* ESP32(/-S2) TRM, section 3.2.4.2 (6.2.4.2 for S2)
* (RefTick) */
ClockSource::RefTick => REF_TICK.to_Hz(), /* ESP32(/-S2) TRM, section 3.2.4.2
* (6.2.4.2 for S2) */
};

T::register_block().conf0().modify(|_, w| {
Expand Down

0 comments on commit 2426e2a

Please sign in to comment.