From f56487401c8314cfc2b21512d3de8d008a25e63d Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 28 Oct 2020 16:14:48 +0100 Subject: [PATCH] Adding updates for PHY support --- src/main.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index c7d0eaa..58d879e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,7 +36,7 @@ use embedded_hal::digital::v2::{InputPin, OutputPin}; use hal::{ dma::{DmaChannel, DmaExt, DmaInternal}, - ethernet, + ethernet::{self, PHY}, rcc::rec::ResetEnable, }; use smoltcp as net; @@ -183,7 +183,7 @@ const APP: () = { 'static, 'static, ethernet::EthernetDMA<'static>>, - eth_mac: ethernet::EthernetMAC, + eth_mac: ethernet::phy::LAN8742A, mac_addr: net::wire::EthernetAddress, pounder: Option>, @@ -690,6 +690,12 @@ const APP: () = { ) }; + // Reset and initialize the ethernet phy. + let mut lan8742a = + ethernet::phy::LAN8742A::new(eth_mac.set_phy_addr(0)); + lan8742a.phy_reset(); + lan8742a.phy_init(); + unsafe { ethernet::enable_interrupt() }; let store = unsafe { &mut NET_STORE }; @@ -708,7 +714,7 @@ const APP: () = { .ip_addrs(&mut store.ip_addrs[..]) .finalize(); - (interface, eth_mac) + (interface, lan8742a) }; cp.SCB.enable_icache();