diff options
| author | datdenkikniet <[email protected]> | 2025-11-13 23:00:58 +0100 |
|---|---|---|
| committer | Johannes Cornelis Draaijer <[email protected]> | 2025-11-14 14:08:06 +0100 |
| commit | 0b3bc35b7dc0f3d2ffa1673ab790df8e6650fe0f (patch) | |
| tree | 71b02b007385bcca6b96d8eb13169bf27551ebe1 /examples/stm32h7 | |
| parent | 694249487cd592a0f806aab61b28534e33c1c5f0 (diff) | |
Add new{_with_phy}, new_mii{_with_phy}
Diffstat (limited to 'examples/stm32h7')
| -rw-r--r-- | examples/stm32h7/src/bin/eth.rs | 12 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/eth_client.rs | 12 | ||||
| -rw-r--r-- | examples/stm32h7/src/bin/eth_client_mii.rs | 12 |
3 files changed, 18 insertions, 18 deletions
diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs index 589f4426e..09915799b 100644 --- a/examples/stm32h7/src/bin/eth.rs +++ b/examples/stm32h7/src/bin/eth.rs | |||
| @@ -5,8 +5,8 @@ use defmt::*; | |||
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_net::tcp::TcpSocket; | 6 | use embassy_net::tcp::TcpSocket; |
| 7 | use embassy_net::{Ipv4Address, StackResources}; | 7 | use embassy_net::{Ipv4Address, StackResources}; |
| 8 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; | 8 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, Sma}; |
| 9 | use embassy_stm32::peripherals::ETH; | 9 | use embassy_stm32::peripherals::{ETH, ETH_SMA}; |
| 10 | use embassy_stm32::rng::Rng; | 10 | use embassy_stm32::rng::Rng; |
| 11 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; | 11 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; |
| 12 | use embassy_time::Timer; | 12 | use embassy_time::Timer; |
| @@ -19,7 +19,7 @@ bind_interrupts!(struct Irqs { | |||
| 19 | RNG => rng::InterruptHandler<peripherals::RNG>; | 19 | RNG => rng::InterruptHandler<peripherals::RNG>; |
| 20 | }); | 20 | }); |
| 21 | 21 | ||
| 22 | type Device = Ethernet<'static, ETH, GenericPhy>; | 22 | type Device = Ethernet<'static, ETH, GenericPhy<Sma<'static, ETH_SMA>>>; |
| 23 | 23 | ||
| 24 | #[embassy_executor::task] | 24 | #[embassy_executor::task] |
| 25 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { | 25 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { |
| @@ -69,16 +69,16 @@ async fn main(spawner: Spawner) -> ! { | |||
| 69 | p.ETH, | 69 | p.ETH, |
| 70 | Irqs, | 70 | Irqs, |
| 71 | p.PA1, // ref_clk | 71 | p.PA1, // ref_clk |
| 72 | p.PA2, // mdio | ||
| 73 | p.PC1, // eth_mdc | ||
| 74 | p.PA7, // CRS_DV: Carrier Sense | 72 | p.PA7, // CRS_DV: Carrier Sense |
| 75 | p.PC4, // RX_D0: Received Bit 0 | 73 | p.PC4, // RX_D0: Received Bit 0 |
| 76 | p.PC5, // RX_D1: Received Bit 1 | 74 | p.PC5, // RX_D1: Received Bit 1 |
| 77 | p.PG13, // TX_D0: Transmit Bit 0 | 75 | p.PG13, // TX_D0: Transmit Bit 0 |
| 78 | p.PB13, // TX_D1: Transmit Bit 1 | 76 | p.PB13, // TX_D1: Transmit Bit 1 |
| 79 | p.PG11, // TX_EN: Transmit Enable | 77 | p.PG11, // TX_EN: Transmit Enable |
| 80 | GenericPhy::new_auto(), | ||
| 81 | mac_addr, | 78 | mac_addr, |
| 79 | p.ETH_SMA, | ||
| 80 | p.PA2, // mdio | ||
| 81 | p.PC1, // mdc | ||
| 82 | ); | 82 | ); |
| 83 | 83 | ||
| 84 | let config = embassy_net::Config::dhcpv4(Default::default()); | 84 | let config = embassy_net::Config::dhcpv4(Default::default()); |
diff --git a/examples/stm32h7/src/bin/eth_client.rs b/examples/stm32h7/src/bin/eth_client.rs index fed8f1a9c..189c99686 100644 --- a/examples/stm32h7/src/bin/eth_client.rs +++ b/examples/stm32h7/src/bin/eth_client.rs | |||
| @@ -7,8 +7,8 @@ use defmt::*; | |||
| 7 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
| 8 | use embassy_net::StackResources; | 8 | use embassy_net::StackResources; |
| 9 | use embassy_net::tcp::client::{TcpClient, TcpClientState}; | 9 | use embassy_net::tcp::client::{TcpClient, TcpClientState}; |
| 10 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; | 10 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, Sma}; |
| 11 | use embassy_stm32::peripherals::ETH; | 11 | use embassy_stm32::peripherals::{ETH, ETH_SMA}; |
| 12 | use embassy_stm32::rng::Rng; | 12 | use embassy_stm32::rng::Rng; |
| 13 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; | 13 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; |
| 14 | use embassy_time::Timer; | 14 | use embassy_time::Timer; |
| @@ -22,7 +22,7 @@ bind_interrupts!(struct Irqs { | |||
| 22 | RNG => rng::InterruptHandler<peripherals::RNG>; | 22 | RNG => rng::InterruptHandler<peripherals::RNG>; |
| 23 | }); | 23 | }); |
| 24 | 24 | ||
| 25 | type Device = Ethernet<'static, ETH, GenericPhy>; | 25 | type Device = Ethernet<'static, ETH, GenericPhy<Sma<'static, ETH_SMA>>>; |
| 26 | 26 | ||
| 27 | #[embassy_executor::task] | 27 | #[embassy_executor::task] |
| 28 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { | 28 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { |
| @@ -71,16 +71,16 @@ async fn main(spawner: Spawner) -> ! { | |||
| 71 | p.ETH, | 71 | p.ETH, |
| 72 | Irqs, | 72 | Irqs, |
| 73 | p.PA1, | 73 | p.PA1, |
| 74 | p.PA2, | ||
| 75 | p.PC1, | ||
| 76 | p.PA7, | 74 | p.PA7, |
| 77 | p.PC4, | 75 | p.PC4, |
| 78 | p.PC5, | 76 | p.PC5, |
| 79 | p.PG13, | 77 | p.PG13, |
| 80 | p.PB13, | 78 | p.PB13, |
| 81 | p.PG11, | 79 | p.PG11, |
| 82 | GenericPhy::new_auto(), | ||
| 83 | mac_addr, | 80 | mac_addr, |
| 81 | p.ETH_SMA, | ||
| 82 | p.PA2, | ||
| 83 | p.PC1, | ||
| 84 | ); | 84 | ); |
| 85 | 85 | ||
| 86 | let config = embassy_net::Config::dhcpv4(Default::default()); | 86 | let config = embassy_net::Config::dhcpv4(Default::default()); |
diff --git a/examples/stm32h7/src/bin/eth_client_mii.rs b/examples/stm32h7/src/bin/eth_client_mii.rs index c3c631f0f..92c823567 100644 --- a/examples/stm32h7/src/bin/eth_client_mii.rs +++ b/examples/stm32h7/src/bin/eth_client_mii.rs | |||
| @@ -7,8 +7,8 @@ use defmt::*; | |||
| 7 | use embassy_executor::Spawner; | 7 | use embassy_executor::Spawner; |
| 8 | use embassy_net::StackResources; | 8 | use embassy_net::StackResources; |
| 9 | use embassy_net::tcp::client::{TcpClient, TcpClientState}; | 9 | use embassy_net::tcp::client::{TcpClient, TcpClientState}; |
| 10 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue}; | 10 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, Sma}; |
| 11 | use embassy_stm32::peripherals::ETH; | 11 | use embassy_stm32::peripherals::{ETH, ETH_SMA}; |
| 12 | use embassy_stm32::rng::Rng; | 12 | use embassy_stm32::rng::Rng; |
| 13 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; | 13 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; |
| 14 | use embassy_time::Timer; | 14 | use embassy_time::Timer; |
| @@ -22,7 +22,7 @@ bind_interrupts!(struct Irqs { | |||
| 22 | RNG => rng::InterruptHandler<peripherals::RNG>; | 22 | RNG => rng::InterruptHandler<peripherals::RNG>; |
| 23 | }); | 23 | }); |
| 24 | 24 | ||
| 25 | type Device = Ethernet<'static, ETH, GenericPhy>; | 25 | type Device = Ethernet<'static, ETH, GenericPhy<Sma<'static, ETH_SMA>>>; |
| 26 | 26 | ||
| 27 | #[embassy_executor::task] | 27 | #[embassy_executor::task] |
| 28 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { | 28 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { |
| @@ -72,8 +72,6 @@ async fn main(spawner: Spawner) -> ! { | |||
| 72 | Irqs, | 72 | Irqs, |
| 73 | p.PA1, | 73 | p.PA1, |
| 74 | p.PC3, | 74 | p.PC3, |
| 75 | p.PA2, | ||
| 76 | p.PC1, | ||
| 77 | p.PA7, | 75 | p.PA7, |
| 78 | p.PC4, | 76 | p.PC4, |
| 79 | p.PC5, | 77 | p.PC5, |
| @@ -84,8 +82,10 @@ async fn main(spawner: Spawner) -> ! { | |||
| 84 | p.PC2, | 82 | p.PC2, |
| 85 | p.PE2, | 83 | p.PE2, |
| 86 | p.PG11, | 84 | p.PG11, |
| 87 | GenericPhy::new_auto(), | ||
| 88 | mac_addr, | 85 | mac_addr, |
| 86 | p.ETH_SMA, | ||
| 87 | p.PA2, | ||
| 88 | p.PC1, | ||
| 89 | ); | 89 | ); |
| 90 | info!("Device created"); | 90 | info!("Device created"); |
| 91 | 91 | ||
