aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/eth/v2/mod.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/embassy-stm32/src/eth/v2/mod.rs b/embassy-stm32/src/eth/v2/mod.rs
index 8a17ac00a..a35f693f5 100644
--- a/embassy-stm32/src/eth/v2/mod.rs
+++ b/embassy-stm32/src/eth/v2/mod.rs
@@ -12,7 +12,7 @@ use crate::gpio::sealed::Pin as __GpioPin;
12use crate::gpio::AnyPin; 12use crate::gpio::AnyPin;
13use crate::gpio::Pin as GpioPin; 13use crate::gpio::Pin as GpioPin;
14use crate::pac::gpio::vals::Ospeedr; 14use crate::pac::gpio::vals::Ospeedr;
15use crate::pac::ETH; 15use crate::pac::{ETH, RCC, SYSCFG};
16use crate::peripherals; 16use crate::peripherals;
17use crate::time::Hertz; 17use crate::time::Hertz;
18 18
@@ -49,6 +49,20 @@ impl<'d, P: PHY, const TX: usize, const RX: usize> Ethernet<'d, P, TX, RX> {
49 ) -> Self { 49 ) -> Self {
50 unborrow!(interrupt, ref_clk, mdio, mdc, crs, rx_d0, rx_d1, tx_d0, tx_d1, tx_en); 50 unborrow!(interrupt, ref_clk, mdio, mdc, crs, rx_d0, rx_d1, tx_d0, tx_d1, tx_en);
51 51
52 // Enable the necessary Clocks
53 // NOTE(unsafe) We have exclusive access to the registers
54 critical_section::with(|_| unsafe {
55 RCC.apb4enr().modify(|w| w.set_syscfgen(true));
56 RCC.ahb1enr().modify(|w| {
57 w.set_eth1macen(true);
58 w.set_eth1txen(true);
59 w.set_eth1rxen(true);
60 });
61
62 // RMII
63 SYSCFG.pmcr().modify(|w| w.set_epis(0b100));
64 });
65
52 ref_clk.configure(); 66 ref_clk.configure();
53 mdio.configure(); 67 mdio.configure();
54 mdc.configure(); 68 mdc.configure();