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/stm32f4/src/bin | |
| parent | 694249487cd592a0f806aab61b28534e33c1c5f0 (diff) | |
Add new{_with_phy}, new_mii{_with_phy}
Diffstat (limited to 'examples/stm32f4/src/bin')
| -rw-r--r-- | examples/stm32f4/src/bin/eth.rs | 12 | ||||
| -rw-r--r-- | examples/stm32f4/src/bin/eth_compliance_test.rs | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/examples/stm32f4/src/bin/eth.rs b/examples/stm32f4/src/bin/eth.rs index 2d72b6b0b..8dfa0916d 100644 --- a/examples/stm32f4/src/bin/eth.rs +++ b/examples/stm32f4/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::time::Hertz; | 11 | use embassy_stm32::time::Hertz; |
| 12 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; | 12 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; |
| @@ -20,7 +20,7 @@ bind_interrupts!(struct Irqs { | |||
| 20 | HASH_RNG => rng::InterruptHandler<peripherals::RNG>; | 20 | HASH_RNG => rng::InterruptHandler<peripherals::RNG>; |
| 21 | }); | 21 | }); |
| 22 | 22 | ||
| 23 | type Device = Ethernet<'static, ETH, GenericPhy>; | 23 | type Device = Ethernet<'static, ETH, GenericPhy<Sma<'static, ETH_SMA>>>; |
| 24 | 24 | ||
| 25 | #[embassy_executor::task] | 25 | #[embassy_executor::task] |
| 26 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { | 26 | async fn net_task(mut runner: embassy_net::Runner<'static, Device>) -> ! { |
| @@ -67,16 +67,16 @@ async fn main(spawner: Spawner) -> ! { | |||
| 67 | p.ETH, | 67 | p.ETH, |
| 68 | Irqs, | 68 | Irqs, |
| 69 | p.PA1, | 69 | p.PA1, |
| 70 | p.PA2, | ||
| 71 | p.PC1, | ||
| 72 | p.PA7, | 70 | p.PA7, |
| 73 | p.PC4, | 71 | p.PC4, |
| 74 | p.PC5, | 72 | p.PC5, |
| 75 | p.PG13, | 73 | p.PG13, |
| 76 | p.PB13, | 74 | p.PB13, |
| 77 | p.PG11, | 75 | p.PG11, |
| 78 | GenericPhy::new_auto(), | ||
| 79 | mac_addr, | 76 | mac_addr, |
| 77 | p.ETH_SMA, | ||
| 78 | p.PA2, | ||
| 79 | p.PC1, | ||
| 80 | ); | 80 | ); |
| 81 | 81 | ||
| 82 | let config = embassy_net::Config::dhcpv4(Default::default()); | 82 | let config = embassy_net::Config::dhcpv4(Default::default()); |
diff --git a/examples/stm32f4/src/bin/eth_compliance_test.rs b/examples/stm32f4/src/bin/eth_compliance_test.rs index 734a14c2c..dc5d7dbb6 100644 --- a/examples/stm32f4/src/bin/eth_compliance_test.rs +++ b/examples/stm32f4/src/bin/eth_compliance_test.rs | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_stm32::eth::{Ethernet, GenericPhy, PacketQueue, StationManagement}; | 6 | use embassy_stm32::eth::{Ethernet, PacketQueue, StationManagement}; |
| 7 | use embassy_stm32::time::Hertz; | 7 | use embassy_stm32::time::Hertz; |
| 8 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; | 8 | use embassy_stm32::{Config, bind_interrupts, eth, peripherals, rng}; |
| 9 | use embassy_time::Timer; | 9 | use embassy_time::Timer; |
| @@ -43,27 +43,27 @@ async fn main(_spawner: Spawner) -> ! { | |||
| 43 | 43 | ||
| 44 | let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; | 44 | let mac_addr = [0x00, 0x00, 0xDE, 0xAD, 0xBE, 0xEF]; |
| 45 | 45 | ||
| 46 | const PHY_ADDR: u8 = 0; | ||
| 47 | static PACKETS: StaticCell<PacketQueue<4, 4>> = StaticCell::new(); | 46 | static PACKETS: StaticCell<PacketQueue<4, 4>> = StaticCell::new(); |
| 48 | let mut device = Ethernet::new( | 47 | let mut device = Ethernet::new( |
| 49 | PACKETS.init(PacketQueue::<4, 4>::new()), | 48 | PACKETS.init(PacketQueue::<4, 4>::new()), |
| 50 | p.ETH, | 49 | p.ETH, |
| 51 | Irqs, | 50 | Irqs, |
| 52 | p.PA1, | 51 | p.PA1, |
| 53 | p.PA2, | ||
| 54 | p.PC1, | ||
| 55 | p.PA7, | 52 | p.PA7, |
| 56 | p.PC4, | 53 | p.PC4, |
| 57 | p.PC5, | 54 | p.PC5, |
| 58 | p.PG13, | 55 | p.PG13, |
| 59 | p.PB13, | 56 | p.PB13, |
| 60 | p.PG11, | 57 | p.PG11, |
| 61 | GenericPhy::new(PHY_ADDR), | ||
| 62 | mac_addr, | 58 | mac_addr, |
| 59 | p.ETH_SMA, | ||
| 60 | p.PA2, | ||
| 61 | p.PC1, | ||
| 63 | ); | 62 | ); |
| 64 | 63 | ||
| 65 | let sm = device.station_management(); | 64 | let sm = device.phy_mut().station_management(); |
| 66 | 65 | ||
| 66 | const PHY_ADDR: u8 = 0; | ||
| 67 | // Just an example. Exact register settings depend on the specific PHY and test. | 67 | // Just an example. Exact register settings depend on the specific PHY and test. |
| 68 | sm.smi_write(PHY_ADDR, 0, 0x2100); | 68 | sm.smi_write(PHY_ADDR, 0, 0x2100); |
| 69 | sm.smi_write(PHY_ADDR, 11, 0xA000); | 69 | sm.smi_write(PHY_ADDR, 11, 0xA000); |
