You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried the RP2040 ethernet_w5500_tcp_server example on the RP2350 (exact code below) (Pico2 board with external W5500) and it was working at the end of September and it now fails at runtime with this error:
I have done a git bisect and found that the regression is caused by this commit changing the clock frequency to 150 MHz.
I have tried to use logic analyzer to check the SPI clock frequency but I only own a cheap FX2 based Salae logic clone with 24 MHz max frequency.
I am then unable to check the 50 MHz signal used in the example. By reducing the frequency, the example starts working again.
With lower frequencies (500 kHz, 1,6 MHz, 12 MHz), the SCLK frequency measured with the logic analyzer is correct.
I have also switched the Pico2 board with a RP2040 based Pico board and it works at 50 MHz on current main branch, this is then RP2350 specific.
ethernet_w5500_tcp_server.rs version for RP2350
//! This example implements a TCP echo server on port 1234 and using DHCP.//! Send it some data, you should see it echoed back and printed in the console.//!#![no_std]#![no_main]use defmt::*;use embassy_executor::Spawner;use embassy_futures::yield_now;use embassy_net::{Stack,StackResources};use embassy_net_wiznet::chip::W5500;use embassy_net_wiznet::*;use embassy_rp::block::ImageDef;use embassy_rp::clocks::RoscRng;use embassy_rp::gpio::{Input,Level,Output,Pull};use embassy_rp::peripherals::SPI0;use embassy_rp::spi::{Async,ConfigasSpiConfig,Spi};use embassy_time::{Delay,Duration};use embedded_hal_bus::spi::ExclusiveDevice;use embedded_io_async::Write;use rand::RngCore;use static_cell::StaticCell;use{defmt_rtt as _, panic_probe as _};#[link_section = ".start_block"]#[used]pubstaticIMAGE_DEF:ImageDef = ImageDef::secure_exe();#[embassy_executor::task]asyncfnethernet_task(runner:Runner<'static,W5500,ExclusiveDevice<Spi<'static,SPI0,Async>,Output<'static>,Delay>,Input<'static>,Output<'static>,>,) -> ! {
runner.run().await}#[embassy_executor::task]asyncfnnet_task(mutrunner: embassy_net::Runner<'static,Device<'static>>) -> ! {
runner.run().await}#[embassy_executor::main]asyncfnmain(spawner:Spawner){let p = embassy_rp::init(Default::default());info!("Start Ethernet");letmut rng = RoscRng;letmut led = Output::new(p.PIN_25,Level::Low);info!("Ethernet init...");letmut spi_cfg = SpiConfig::default();
spi_cfg.frequency = 50_000_000;let(miso, mosi, clk) = (p.PIN_20, p.PIN_19, p.PIN_22);let spi = Spi::new(p.SPI0, clk, mosi, miso, p.DMA_CH0, p.DMA_CH1, spi_cfg);let cs = Output::new(p.PIN_21,Level::High);let w5500_int = Input::new(p.PIN_18,Pull::Up);let w5500_reset = Output::new(p.PIN_26,Level::High);let mac_addr = [0x02,0x00,0x00,0x00,0x00,0x00];staticSTATE:StaticCell<State<8,8>> = StaticCell::new();let state = STATE.init(State::<8,8>::new());let(device, runner) = embassy_net_wiznet::new(
mac_addr,
state,ExclusiveDevice::new(spi, cs,Delay),
w5500_int,
w5500_reset,).await.unwrap();unwrap!(spawner.spawn(ethernet_task(runner)));info!("Ethernet init done.");// Generate random seedlet seed = rng.next_u64();// Init network stackstaticRESOURCES:StaticCell<StackResources<3>> = StaticCell::new();let(stack, runner) = embassy_net::new(
device,
embassy_net::Config::dhcpv4(Default::default()),RESOURCES.init(StackResources::new()),
seed,);// Launch network taskunwrap!(spawner.spawn(net_task(runner)));info!("Waiting for DHCP...");let cfg = wait_for_config(stack).await;let local_addr = cfg.address.address();info!("IP address: {:?}", local_addr);letmut rx_buffer = [0;4096];letmut tx_buffer = [0;4096];letmut buf = [0;4096];loop{letmut socket = embassy_net::tcp::TcpSocket::new(stack,&mut rx_buffer,&mut tx_buffer);
socket.set_timeout(Some(Duration::from_secs(10)));
led.set_low();info!("Listening on TCP:1234...");ifletErr(e) = socket.accept(1234).await{warn!("accept error: {:?}", e);continue;}info!("Received connection from {:?}", socket.remote_endpoint());
led.set_high();loop{let n = match socket.read(&mut buf).await{Ok(0) => {warn!("read EOF");break;}Ok(n) => n,Err(e) => {warn!("{:?}", e);break;}};info!("rxd {}", core::str::from_utf8(&buf[..n]).unwrap());ifletErr(e) = socket.write_all(&buf[..n]).await{warn!("write error: {:?}", e);break;}}}}asyncfnwait_for_config(stack:Stack<'static>) -> embassy_net::StaticConfigV4{loop{ifletSome(config) = stack.config_v4(){return config.clone();}yield_now().await;}}
The text was updated successfully, but these errors were encountered:
I have tried the RP2040
ethernet_w5500_tcp_server
example on the RP2350 (exact code below) (Pico2 board with external W5500) and it was working at the end of September and it now fails at runtime with this error:I have done a git bisect and found that the regression is caused by this commit changing the clock frequency to 150 MHz.
I have tried to use logic analyzer to check the SPI clock frequency but I only own a cheap FX2 based Salae logic clone with 24 MHz max frequency.
I am then unable to check the 50 MHz signal used in the example. By reducing the frequency, the example starts working again.
With lower frequencies (500 kHz, 1,6 MHz, 12 MHz), the SCLK frequency measured with the logic analyzer is correct.
I have also switched the Pico2 board with a RP2040 based Pico board and it works at 50 MHz on current main branch, this is then RP2350 specific.
ethernet_w5500_tcp_server.rs version for RP2350
The text was updated successfully, but these errors were encountered: