-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Recent changes seem to have broken the CYW43 WIFI AP example. The whole system seems to freeze when a device tries to connect to the AP.
I am using embassy as a git submodule, so I know whatever broke the example is in here: 84e0aef...b8afe4f
But I don't have time to take a closer look right now as I have a project ddl coming up.
I thought I'd create an issue first in case others have the same problem. I'll post updates later.
I'm using the Pimoroni PICO Plus 2W. The code is adapted from the RP2040 wifi ap socket server example.
Full code:
#![no_std]
#![no_main]
extern crate alloc;
use core::net::SocketAddr;
use defmt::*;
use embassy_executor::Executor;
use embassy_executor::Spawner;
use embassy_rp::gpio::Output;
use embassy_rp::gpio::{Input, Level, Pull};
use embassy_rp::peripherals::{DMA_CH0, DMA_CH15, PIO2};
use embassy_rp::pio::InterruptHandler;
use embassy_rp::pio::Pio;
use embassy_rp::{Peripherals, bind_interrupts};
use embassy_time::Duration;
use embassy_time::Timer;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _};
#[unsafe(link_section = ".bi_entries")]
#[used]
pub static PICOTOOL_ENTRIES: [embassy_rp::binary_info::EntryAddr; 4] = [
embassy_rp::binary_info::rp_program_name!(c"Blinky Example"),
embassy_rp::binary_info::rp_program_description!(
c"This example tests the RP Pico on board LED, connected to gpio 25"
),
embassy_rp::binary_info::rp_cargo_version!(),
embassy_rp::binary_info::rp_program_build_attribute!(),
];
use embassy_net::Stack;
use embassy_net::tcp::TcpSocket;
use embassy_rp::clocks::RoscRng;
use embedded_alloc::LlffHeap as Heap;
use log::warn;
use tileglobe::master_node::MCClient;
#[global_allocator]
static HEAP: Heap = Heap::empty();
#[embassy_executor::task]
async fn main_task(spawner: Spawner, ps: Peripherals) -> ! {
{
bind_interrupts!(struct Irqs {
PIO2_IRQ_0 => InterruptHandler<PIO2>;
});
#[embassy_executor::task]
async fn cyw43_task(
runner: cyw43::Runner<
'static,
Output<'static>,
cyw43_pio::PioSpi<'static, PIO2, 0, DMA_CH0>,
>,
) -> ! {
runner.run().await
}
#[embassy_executor::task]
async fn net_task(
mut runner: embassy_net::Runner<'static, cyw43::NetDriver<'static>>,
) -> ! {
runner.run().await
}
let fw = include_bytes!("../../../embassy/cyw43-firmware/43439A0.bin");
let clm = include_bytes!("../../../embassy/cyw43-firmware/43439A0_clm.bin");
let pwr = Output::new(ps.PIN_23, Level::Low);
let cs = Output::new(ps.PIN_25, Level::High);
let mut pio = Pio::new(ps.PIO2, Irqs);
let spi = cyw43_pio::PioSpi::new(
&mut pio.common,
pio.sm0,
cyw43_pio::DEFAULT_CLOCK_DIVIDER,
pio.irq0,
cs,
ps.PIN_24,
ps.PIN_29,
ps.DMA_CH0,
);
static STATE: StaticCell<cyw43::State> = StaticCell::new();
let state = STATE.init(cyw43::State::new());
let (net_device, mut control, runner) = cyw43::new(state, pwr, spi, fw).await;
spawner.spawn(unwrap!(cyw43_task(runner)));
control.init(clm).await;
control
.set_power_management(cyw43::PowerManagementMode::PowerSave)
.await;
// Use a link-local address for communication without DHCP server
let config = embassy_net::Config::ipv4_static(embassy_net::StaticConfigV4 {
address: embassy_net::Ipv4Cidr::new(embassy_net::Ipv4Address::new(169, 254, 1, 1), 16),
dns_servers: heapless::Vec::new(),
gateway: None,
});
// Generate random seed
let seed = RoscRng.next_u64();
// Init network stack
static RESOURCES: StaticCell<embassy_net::StackResources<3>> = StaticCell::new();
let (stack, runner) = embassy_net::new(
net_device,
config,
RESOURCES.init(embassy_net::StackResources::new()),
seed,
);
spawner.spawn(unwrap!(net_task(runner)));
control.start_ap_wpa2("TileGlobeMC", "password", 5).await;
}
loop {
info!("Hello world!");
Timer::after_secs(1).await;
}
}
#[cortex_m_rt::entry]
fn main() -> ! {
#[allow(unused_mut)]
let mut clock_config = embassy_rp::clocks::ClockConfig::crystal(12_000_000);
let ps = embassy_rp::init(embassy_rp::config::Config::new(clock_config));
static EXECUTOR: StaticCell<Executor> = StaticCell::new();
let executor = EXECUTOR.init(Executor::new());
executor.run(|spawner| spawner.spawn(main_task(spawner, ps).unwrap()));
}Metadata
Metadata
Assignees
Labels
No labels