diff options
| author | Thales Fragoso <[email protected]> | 2021-06-10 23:42:20 -0300 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-06-16 16:48:35 +0200 |
| commit | 0c837f07c08dd5d5ea197216b17b6452eddb4cb3 (patch) | |
| tree | 06c6d3169aca86c41a09d5a6825c906ace949e16 | |
| parent | e039c7c42c9e9113f512f5406d68b283c329f4f8 (diff) | |
eth-v2: Enable clocks in new
| -rw-r--r-- | embassy-stm32/src/eth/v2/mod.rs | 16 |
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; | |||
| 12 | use crate::gpio::AnyPin; | 12 | use crate::gpio::AnyPin; |
| 13 | use crate::gpio::Pin as GpioPin; | 13 | use crate::gpio::Pin as GpioPin; |
| 14 | use crate::pac::gpio::vals::Ospeedr; | 14 | use crate::pac::gpio::vals::Ospeedr; |
| 15 | use crate::pac::ETH; | 15 | use crate::pac::{ETH, RCC, SYSCFG}; |
| 16 | use crate::peripherals; | 16 | use crate::peripherals; |
| 17 | use crate::time::Hertz; | 17 | use 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(); |
