Merge pull request #1831 from vDorst/adin1110-part2

embassy-net-adin1110 more improvements
This commit is contained in:
Dario Nieuwenhuis
2023-09-02 00:49:17 +02:00
committed by GitHub
8 changed files with 811 additions and 232 deletions

View File

@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "embassy-stm32l4-examples"
version = "0.1.0"
version = "0.1.1"
license = "MIT OR Apache-2.0"
[dependencies]
@ -12,7 +12,7 @@ embassy-executor = { version = "0.3.0", path = "../../embassy-executor", feature
embassy-time = { version = "0.1.3", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", "unstable-traits", "nightly"] }
embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" }
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
embassy-net-adin1110 = { version = "0.1.0", path = "../../embassy-net-adin1110", default-features = false }
embassy-net-adin1110 = { version = "0.2.0", path = "../../embassy-net-adin1110" }
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "udp", "tcp", "dhcpv4", "medium-ethernet"] }
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
embedded-io-async = { version = "0.5.0", features = ["defmt-03"] }

View File

@ -11,7 +11,9 @@
// Settings switch S201 "HW CFG":
// - Without SPI CRC: OFF-ON-OFF-OFF-OFF
// - With SPI CRC: ON -ON-OFF-OFF-OFF
// Settings switch S303 "uC CFG": CFG0: On = static ip, Off = Dhcp
// Settings switch S303 "uC CFG":
// - CFG0: On = static ip, Off = Dhcp
// - CFG1: Ethernet `FCS` on TX path: On, Off
// The webserver shows the actual temperature of the onboard i2c temp sensor.
use core::marker::PhantomData;
@ -107,7 +109,7 @@ async fn main(spawner: Spawner) {
// Read the uc_cfg switches
let uc_cfg0 = Input::new(dp.PB2, Pull::None);
let _uc_cfg1 = Input::new(dp.PF11, Pull::None);
let uc_cfg1 = Input::new(dp.PF11, Pull::None);
let _uc_cfg2 = Input::new(dp.PG6, Pull::None);
let _uc_cfg3 = Input::new(dp.PG11, Pull::None);
@ -154,11 +156,13 @@ async fn main(spawner: Spawner) {
let cfg0_without_crc = spe_cfg0.is_high();
let cfg1_spi_mode = spe_cfg1.is_high();
let uc_cfg1_fcs_en = uc_cfg1.is_low();
defmt::println!(
"ADIN1110: CFG SPI-MODE 1-{}, CRC-bit 0-{}",
"ADIN1110: CFG SPI-MODE 1-{}, CRC-bit 0-{} FCS-{}",
cfg1_spi_mode,
cfg0_without_crc
cfg0_without_crc,
uc_cfg1_fcs_en
);
// Check the SPI mode selected with the "HW CFG" dip-switch
@ -172,8 +176,16 @@ async fn main(spawner: Spawner) {
let state = make_static!(embassy_net_adin1110::State::<8, 8>::new());
let (device, runner) =
embassy_net_adin1110::new(MAC, state, spe_spi, spe_int, spe_reset_n, !cfg0_without_crc).await;
let (device, runner) = embassy_net_adin1110::new(
MAC,
state,
spe_spi,
spe_int,
spe_reset_n,
!cfg0_without_crc,
uc_cfg1_fcs_en,
)
.await;
// Start task blink_led
unwrap!(spawner.spawn(heartbeat_led(led_uc3_yellow)));