Skip to main content

RmiiClockConfig

Enum RmiiClockConfig 

Source
pub enum RmiiClockConfig {
    InternalApll {
        gpio: ClkGpio,
        xtal: XtalFreq,
    },
    External {
        gpio: ClkGpio,
    },
}
Expand description

RMII reference clock configuration.

The 50 MHz RMII clock can be generated internally (ESP32 APLL) or supplied externally from a PHY-driven oscillator. Mode selection is hardware-specific and Emac::init rejects mismatched GPIO choices with crate::EmacError::InvalidConfig — see each variant’s docs for which pads are valid.

Variants§

§

InternalApll

ESP32 APLL generates 50 MHz and drives it out of the chip.

Valid GPIO choices: ClkGpio::Gpio16 (EMAC_CLK_OUT, 0°) or ClkGpio::Gpio17 (EMAC_CLK_OUT_180, 180° — the LAN8720A reference design preference). ClkGpio::Gpio0 is invalid for this mode: GPIO0 function 5 is EMAC_TX_CLK, an input pad.

xtal selects the SDM coefficients for APLL programming and MUST match the actual on-board crystal — there is no detection at runtime, getting it wrong silently produces a wrong-frequency REF_CLK and the link will not come up.

Coexistence note: ESP32 errata CLK-3.22 — the APLL clock signal emitted on the GPIO pad is corrupted by on-chip RF noise during WiFi/BT transmission. This mode is unsafe with active radio; boards needing Ethernet + WiFi should use Self::External.

Fields

§gpio: ClkGpio

GPIO for clock output. Must be Gpio16 or Gpio17.

§xtal: XtalFreq

On-board crystal frequency. APLL SDM coefficients are chosen accordingly to land on a 50 MHz RMII reference clock.

§

External

External 50 MHz clock fed in from a PHY crystal or oscillator.

Valid GPIO choice: ClkGpio::Gpio0 only — that is the only pad whose function 5 (EMAC_TX_CLK) is an input. Gpio16 / Gpio17 are invalid here.

Required for Ethernet + WiFi coexistence (immune to the CLK-3.22 errata since the clock never leaves the PHY domain).

Fields

§gpio: ClkGpio

GPIO for clock input. Must be Gpio0.

Trait Implementations§

Source§

impl Clone for RmiiClockConfig

Source§

fn clone(&self) -> RmiiClockConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RmiiClockConfig

Source§

impl Debug for RmiiClockConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RmiiClockConfig

Source§

impl Format for RmiiClockConfig

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl PartialEq for RmiiClockConfig

Source§

fn eq(&self, other: &RmiiClockConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RmiiClockConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.