Merge pull request #3901 from CBJamo/rp23_testing

Inital rp23 ci tests
This commit is contained in:
Dario Nieuwenhuis 2025-02-19 14:48:01 +01:00 committed by GitHub
commit fcee67a0d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 162 additions and 62 deletions

14
ci.sh
View File

@ -291,7 +291,8 @@ cargo batch \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f091rc --artifact-dir out/tests/stm32f091rc \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb --artifact-dir out/tests/stm32h503rb \
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u083rc --artifact-dir out/tests/stm32u083rc \
--- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --artifact-dir out/tests/rpi-pico \
--- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --features rp2040 --artifact-dir out/tests/rpi-pico \
--- build --release --manifest-path tests/rp/Cargo.toml --target thumbv8m.main-none-eabihf --features rp235xb --artifact-dir out/tests/pimoroni-pico-plus-2 \
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv6m-none-eabi --features nrf51422 --artifact-dir out/tests/nrf51422-dk \
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52832 --artifact-dir out/tests/nrf52832-dk \
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52833 --artifact-dir out/tests/nrf52833-dk \
@ -319,6 +320,17 @@ rm out/tests/stm32f207zg/usart_rx_ringbuffered
# doesn't work, gives "noise error", no idea why. usart_dma does pass.
rm out/tests/stm32u5a5zj/usart
# probe-rs error: "multi-core ram flash start not implemented yet"
# As of 2025-02-17 these tests work when run from flash
rm out/tests/pimoroni-pico-plus-2/multicore
rm out/tests/pimoroni-pico-plus-2/gpio_multicore
# Doesn't work when run from ram on the 2350
rm out/tests/pimoroni-pico-plus-2/flash
# This test passes locally but fails on the HIL, no idea why
rm out/tests/pimoroni-pico-plus-2/i2c
# The pico2 plus doesn't have the adcs hooked up like the picoW does.
rm out/tests/pimoroni-pico-plus-2/adc
if [[ -z "${TELEPROBE_TOKEN-}" ]]; then
echo No teleprobe token found, skipping running HIL tests
exit

View File

@ -5,8 +5,9 @@
#build-std-features = ["panic_immediate_abort"]
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "teleprobe client run"
#runner = "teleprobe client run"
#runner = "teleprobe local run --chip RP2040 --elf"
runner = "teleprobe local run --chip RP235X --elf"
rustflags = [
# Code-size optimizations.
@ -15,7 +16,8 @@ rustflags = [
]
[build]
target = "thumbv6m-none-eabi"
#target = "thumbv6m-none-eabi"
target = "thumbv8m.main-none-eabihf"
[env]
DEFMT_LOG = "trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info"

View File

@ -4,13 +4,18 @@ name = "embassy-rp-tests"
version = "0.1.0"
license = "MIT OR Apache-2.0"
[features]
rp2040 = ["embassy-rp/rp2040"]
rp235xa = ["embassy-rp/rp235xa"]
rp235xb = ["embassy-rp/rp235xb"]
[dependencies]
teleprobe-meta = "1.1"
embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] }
embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] }
embassy-rp = { version = "0.3.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram", "rp2040"] }
embassy-rp = { version = "0.3.0", path = "../../embassy-rp", features = [ "defmt", "unstable-pac", "time-driver", "critical-section-impl", "intrinsics", "rom-v2-intrinsics", "run-from-ram"] }
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
embassy-net-wiznet = { version = "0.2.0", path = "../../embassy-net-wiznet", features = ["defmt"] }
@ -35,6 +40,30 @@ static_cell = "2"
portable-atomic = { version = "1.5", features = ["critical-section"] }
rand = { version = "0.8.5", default-features = false }
# bootsel not currently supported on 2350
[[bin]]
name = "bootsel"
path = "src/bin/bootsel.rs"
required-features = [ "rp2040",]
# 2350 devboard isn't a W
[[bin]]
name = "cyw43-perf"
path = "src/bin/cyw43-perf.rs"
required-features = [ "rp2040",]
# Eth test only for the w5100s-evb-pico
[[bin]]
name = "ethernet_w5100s_perf"
path = "src/bin/ethernet_w5100s_perf.rs"
required-features = [ "rp2040",]
# Float intrinsics are only relevant for the 2040
[[bin]]
name = "float"
path = "src/bin/float.rs"
required-features = [ "rp2040",]
[profile.dev]
debug = 2
debug-assertions = true

8
tests/rp/readme.md Normal file
View File

@ -0,0 +1,8 @@
# Pico and Pico 2 Plus connections
GP0-GP1
GP3-GP4
GP6-GP9
GP7-GP11
GP18-GP20 with 10k pullup
GP19-GP21 with 10k pullup

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::*;
use embassy_executor::Spawner;
@ -20,14 +23,19 @@ async fn main(_spawner: Spawner) {
let _wifi_off = Output::new(p.PIN_25, Level::High);
let mut adc = Adc::new(p.ADC, Irqs, Config::default());
#[cfg(any(feature = "rp2040", feature = "rp235xa"))]
let (mut a, mut b, mut c, mut d) = (p.PIN_26, p.PIN_27, p.PIN_28, p.PIN_29);
#[cfg(feature = "rp235xb")]
let (mut a, mut b, mut c, mut d) = (p.PIN_44, p.PIN_45, p.PIN_46, p.PIN_47);
{
{
let mut p = Channel::new_pin(&mut p.PIN_26, Pull::Down);
let mut p = Channel::new_pin(&mut a, Pull::Down);
defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
defmt::assert!(adc.read(&mut p).await.unwrap() < 0b01_0000_0000);
}
{
let mut p = Channel::new_pin(&mut p.PIN_26, Pull::Up);
let mut p = Channel::new_pin(&mut a, Pull::Up);
defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
defmt::assert!(adc.read(&mut p).await.unwrap() > 0b11_0000_0000);
}
@ -35,21 +43,21 @@ async fn main(_spawner: Spawner) {
// not bothering with async reads from now on
{
{
let mut p = Channel::new_pin(&mut p.PIN_27, Pull::Down);
let mut p = Channel::new_pin(&mut b, Pull::Down);
defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
}
{
let mut p = Channel::new_pin(&mut p.PIN_27, Pull::Up);
let mut p = Channel::new_pin(&mut b, Pull::Up);
defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
}
}
{
{
let mut p = Channel::new_pin(&mut p.PIN_28, Pull::Down);
let mut p = Channel::new_pin(&mut c, Pull::Down);
defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
}
{
let mut p = Channel::new_pin(&mut p.PIN_28, Pull::Up);
let mut p = Channel::new_pin(&mut c, Pull::Up);
defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
}
}
@ -57,15 +65,15 @@ async fn main(_spawner: Spawner) {
// gp29 is connected to vsys through a 200k/100k divider,
// adding pulls should change the value
let low = {
let mut p = Channel::new_pin(&mut p.PIN_29, Pull::Down);
let mut p = Channel::new_pin(&mut d, Pull::Down);
adc.blocking_read(&mut p).unwrap()
};
let none = {
let mut p = Channel::new_pin(&mut p.PIN_29, Pull::None);
let mut p = Channel::new_pin(&mut d, Pull::None);
adc.blocking_read(&mut p).unwrap()
};
let up = {
let mut p = Channel::new_pin(&mut p.PIN_29, Pull::Up);
let mut p = Channel::new_pin(&mut d, Pull::Up);
adc.blocking_read(&mut p).unwrap()
};
defmt::assert!(low < none);
@ -89,29 +97,14 @@ async fn main(_spawner: Spawner) {
let mut low = [0u16; 16];
let mut none = [0u8; 16];
let mut up = [Sample::default(); 16];
adc.read_many(
&mut Channel::new_pin(&mut p.PIN_29, Pull::Down),
&mut low,
1,
&mut p.DMA_CH0,
)
.await
.unwrap();
adc.read_many(
&mut Channel::new_pin(&mut p.PIN_29, Pull::None),
&mut none,
1,
&mut p.DMA_CH0,
)
.await
.unwrap();
adc.read_many_raw(
&mut Channel::new_pin(&mut p.PIN_29, Pull::Up),
&mut up,
1,
&mut p.DMA_CH0,
)
.await;
adc.read_many(&mut Channel::new_pin(&mut d, Pull::Down), &mut low, 1, &mut p.DMA_CH0)
.await
.unwrap();
adc.read_many(&mut Channel::new_pin(&mut d, Pull::None), &mut none, 1, &mut p.DMA_CH0)
.await
.unwrap();
adc.read_many_raw(&mut Channel::new_pin(&mut d, Pull::Up), &mut up, 1, &mut p.DMA_CH0)
.await;
defmt::assert!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16));
defmt::assert!(up.iter().all(|s| s.good()));
defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value()));
@ -133,7 +126,7 @@ async fn main(_spawner: Spawner) {
{
let mut multi = [0u16; 2];
let mut channels = [
Channel::new_pin(&mut p.PIN_26, Pull::Up),
Channel::new_pin(&mut a, Pull::Up),
Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR),
];
adc.read_many_multichannel(&mut channels, &mut multi, 1, &mut p.DMA_CH0)

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert_eq, *};
use embassy_executor::Spawner;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::*;
use embassy_executor::Spawner;
@ -24,13 +27,19 @@ async fn main(_spawner: Spawner) {
let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0);
// Get JEDEC id
let jedec = defmt::unwrap!(flash.blocking_jedec_id());
info!("jedec id: 0x{:x}", jedec);
#[cfg(feature = "rp2040")]
{
let jedec = defmt::unwrap!(flash.blocking_jedec_id());
info!("jedec id: 0x{:x}", jedec);
}
// Get unique id
let mut uid = [0; 8];
defmt::unwrap!(flash.blocking_unique_id(&mut uid));
info!("unique id: {:?}", uid);
#[cfg(feature = "rp2040")]
{
let mut uid = [0; 8];
defmt::unwrap!(flash.blocking_unique_id(&mut uid));
info!("unique id: {:?}", uid);
}
let mut buf = [0u8; ERASE_SIZE];
defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf));

View File

@ -1,10 +1,15 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert, *};
use embassy_executor::Spawner;
use embassy_rp::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull};
#[cfg(feature = "rp2040")]
use embassy_rp::gpio::OutputOpenDrain;
use embassy_rp::gpio::{Flex, Input, Level, Output, Pull};
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
@ -76,6 +81,7 @@ async fn main(_spawner: Spawner) {
}
// Test input pulldown
#[cfg(feature = "rp2040")]
{
let b = Input::new(&mut b, Pull::Down);
delay();
@ -104,6 +110,7 @@ async fn main(_spawner: Spawner) {
}
// OUTPUT OPEN DRAIN
#[cfg(feature = "rp2040")]
{
let mut b = OutputOpenDrain::new(&mut b, Level::High);
let mut a = Flex::new(&mut a);
@ -202,6 +209,7 @@ async fn main(_spawner: Spawner) {
}
// Test input pulldown
#[cfg(feature = "rp2040")]
{
let mut b = Flex::new(&mut b);
b.set_as_input();

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert, *};
use embassy_executor::Spawner;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{info, unwrap};
use embassy_executor::Executor;
@ -56,7 +59,7 @@ async fn core1_task(p: PIN_1) {
CHANNEL0.receive().await;
let mut pin = Input::new(p, Pull::Down);
let mut pin = Input::new(p, Pull::None);
let wait = pin.wait_for_rising_edge();
CHANNEL1.send(()).await;

View File

@ -1,23 +1,21 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert_eq, info, panic, unwrap};
use defmt::{assert_eq, info, panic};
use embassy_embedded_hal::SetConfig;
use embassy_executor::{Executor, Spawner};
use embassy_executor::Spawner;
use embassy_rp::clocks::{PllConfig, XoscConfig};
use embassy_rp::config::Config as rpConfig;
use embassy_rp::multicore::{spawn_core1, Stack};
use embassy_rp::peripherals::{I2C0, I2C1};
use embassy_rp::{bind_interrupts, i2c, i2c_slave};
use embedded_hal_1::i2c::Operation;
use embedded_hal_async::i2c::I2c;
use static_cell::StaticCell;
use {defmt_rtt as _, panic_probe as _, panic_probe as _, panic_probe as _};
static mut CORE1_STACK: Stack<1024> = Stack::new();
static EXECUTOR1: StaticCell<Executor> = StaticCell::new();
use crate::i2c::AbortReason;
bind_interrupts!(struct Irqs {
@ -106,7 +104,7 @@ async fn device_task(mut dev: i2c_slave::I2cSlave<'static, I2C1>) -> ! {
}
async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) {
info!("Device start");
info!("Controller start");
{
let buf = [0xCA, 0x11];
@ -180,7 +178,7 @@ async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) {
}
#[embassy_executor::main]
async fn main(_core0_spawner: Spawner) {
async fn main(spawner: Spawner) {
let mut config = rpConfig::default();
// Configure clk_sys to 48MHz to support 1kHz scl.
// In theory it can go lower, but we won't bother to test below 1kHz.
@ -210,14 +208,7 @@ async fn controller_task(con: &mut i2c::I2c<'static, I2C0, i2c::Async>) {
config.addr = DEV_ADDR as u16;
let device = i2c_slave::I2cSlave::new(p.I2C1, d_sda, d_scl, Irqs, config);
spawn_core1(
p.CORE1,
unsafe { &mut *core::ptr::addr_of_mut!(CORE1_STACK) },
move || {
let executor1 = EXECUTOR1.init(Executor::new());
executor1.run(|spawner| unwrap!(spawner.spawn(device_task(device))));
},
);
spawner.must_spawn(device_task(device));
let c_sda = p.PIN_21;
let c_scl = p.PIN_20;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{info, unwrap};
use embassy_executor::Executor;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::info;
use embassy_executor::Spawner;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::info;
use embassy_executor::Spawner;

View File

@ -1,10 +1,15 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert, assert_eq, assert_ne, *};
use embassy_executor::Spawner;
use embassy_rp::gpio::{Input, Level, Output, Pull};
use embassy_rp::gpio::{Input, Pull};
#[cfg(feature = "rp2040")]
use embassy_rp::gpio::{Level, Output};
use embassy_rp::pwm::{Config, InputMode, Pwm};
use embassy_time::Timer;
use {defmt_rtt as _, panic_probe as _};
@ -92,6 +97,7 @@ async fn main(_spawner: Spawner) {
}
// Test level-gated
#[cfg(feature = "rp2040")]
{
let mut pin2 = Output::new(&mut p11, Level::Low);
let pwm = Pwm::new_input(&mut p.PWM_SLICE3, &mut p7, Pull::None, InputMode::Level, cfg.clone());
@ -102,12 +108,14 @@ async fn main(_spawner: Spawner) {
Timer::after_millis(1).await;
pin2.set_low();
let ctr = pwm.counter();
info!("ctr: {}", ctr);
assert!(ctr >= 1000);
Timer::after_millis(1).await;
assert_eq!(pwm.counter(), ctr);
}
// Test rising-gated
#[cfg(feature = "rp2040")]
{
let mut pin2 = Output::new(&mut p11, Level::Low);
let pwm = Pwm::new_input(
@ -129,6 +137,7 @@ async fn main(_spawner: Spawner) {
}
// Test falling-gated
#[cfg(feature = "rp2040")]
{
let mut pin2 = Output::new(&mut p11, Level::High);
let pwm = Pwm::new_input(

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert_eq, *};
use embassy_executor::Spawner;

View File

@ -3,7 +3,10 @@
//!
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert_eq, *};
use embassy_executor::Spawner;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert, *};
use embassy_executor::Spawner;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert_eq, *};
use embassy_executor::Spawner;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert_eq, panic, *};
use embassy_executor::Spawner;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert_eq, *};
use embassy_executor::Spawner;

View File

@ -1,6 +1,9 @@
#![no_std]
#![no_main]
#[cfg(feature = "rp2040")]
teleprobe_meta::target!(b"rpi-pico");
#[cfg(feature = "rp235xb")]
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
use defmt::{assert_eq, *};
use embassy_executor::Spawner;