Skip to content

Commit fcee67a

Browse files
authored
Merge pull request embassy-rs#3901 from CBJamo/rp23_testing
Inital rp23 ci tests
2 parents f3b98a8 + 28e2789 commit fcee67a

22 files changed

+162
-62
lines changed

ci.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ cargo batch \
291291
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32f091rc --artifact-dir out/tests/stm32f091rc \
292292
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv8m.main-none-eabihf --features stm32h503rb --artifact-dir out/tests/stm32h503rb \
293293
--- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv6m-none-eabi --features stm32u083rc --artifact-dir out/tests/stm32u083rc \
294-
--- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --artifact-dir out/tests/rpi-pico \
294+
--- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --features rp2040 --artifact-dir out/tests/rpi-pico \
295+
--- build --release --manifest-path tests/rp/Cargo.toml --target thumbv8m.main-none-eabihf --features rp235xb --artifact-dir out/tests/pimoroni-pico-plus-2 \
295296
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv6m-none-eabi --features nrf51422 --artifact-dir out/tests/nrf51422-dk \
296297
--- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --features nrf52832 --artifact-dir out/tests/nrf52832-dk \
297298
--- 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
319320
# doesn't work, gives "noise error", no idea why. usart_dma does pass.
320321
rm out/tests/stm32u5a5zj/usart
321322

323+
# probe-rs error: "multi-core ram flash start not implemented yet"
324+
# As of 2025-02-17 these tests work when run from flash
325+
rm out/tests/pimoroni-pico-plus-2/multicore
326+
rm out/tests/pimoroni-pico-plus-2/gpio_multicore
327+
# Doesn't work when run from ram on the 2350
328+
rm out/tests/pimoroni-pico-plus-2/flash
329+
# This test passes locally but fails on the HIL, no idea why
330+
rm out/tests/pimoroni-pico-plus-2/i2c
331+
# The pico2 plus doesn't have the adcs hooked up like the picoW does.
332+
rm out/tests/pimoroni-pico-plus-2/adc
333+
322334
if [[ -z "${TELEPROBE_TOKEN-}" ]]; then
323335
echo No teleprobe token found, skipping running HIL tests
324336
exit

tests/rp/.cargo/config.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
#build-std-features = ["panic_immediate_abort"]
66

77
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
8-
runner = "teleprobe client run"
8+
#runner = "teleprobe client run"
99
#runner = "teleprobe local run --chip RP2040 --elf"
10+
runner = "teleprobe local run --chip RP235X --elf"
1011

1112
rustflags = [
1213
# Code-size optimizations.
@@ -15,7 +16,8 @@ rustflags = [
1516
]
1617

1718
[build]
18-
target = "thumbv6m-none-eabi"
19+
#target = "thumbv6m-none-eabi"
20+
target = "thumbv8m.main-none-eabihf"
1921

2022
[env]
2123
DEFMT_LOG = "trace,embassy_hal_internal=debug,embassy_net_esp_hosted=debug,cyw43=info,cyw43_pio=info,smoltcp=info"

tests/rp/Cargo.toml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@ name = "embassy-rp-tests"
44
version = "0.1.0"
55
license = "MIT OR Apache-2.0"
66

7+
[features]
8+
rp2040 = ["embassy-rp/rp2040"]
9+
rp235xa = ["embassy-rp/rp235xa"]
10+
rp235xb = ["embassy-rp/rp235xb"]
11+
712
[dependencies]
813
teleprobe-meta = "1.1"
914

1015
embassy-sync = { version = "0.6.2", path = "../../embassy-sync", features = ["defmt"] }
1116
embassy-executor = { version = "0.7.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "defmt"] }
1217
embassy-time = { version = "0.4.0", path = "../../embassy-time", features = ["defmt", ] }
13-
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"] }
18+
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"] }
1419
embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
1520
embassy-net = { version = "0.7.0", path = "../../embassy-net", features = ["defmt", "tcp", "udp", "dhcpv4", "medium-ethernet"] }
1621
embassy-net-wiznet = { version = "0.2.0", path = "../../embassy-net-wiznet", features = ["defmt"] }
@@ -35,6 +40,30 @@ static_cell = "2"
3540
portable-atomic = { version = "1.5", features = ["critical-section"] }
3641
rand = { version = "0.8.5", default-features = false }
3742

43+
# bootsel not currently supported on 2350
44+
[[bin]]
45+
name = "bootsel"
46+
path = "src/bin/bootsel.rs"
47+
required-features = [ "rp2040",]
48+
49+
# 2350 devboard isn't a W
50+
[[bin]]
51+
name = "cyw43-perf"
52+
path = "src/bin/cyw43-perf.rs"
53+
required-features = [ "rp2040",]
54+
55+
# Eth test only for the w5100s-evb-pico
56+
[[bin]]
57+
name = "ethernet_w5100s_perf"
58+
path = "src/bin/ethernet_w5100s_perf.rs"
59+
required-features = [ "rp2040",]
60+
61+
# Float intrinsics are only relevant for the 2040
62+
[[bin]]
63+
name = "float"
64+
path = "src/bin/float.rs"
65+
required-features = [ "rp2040",]
66+
3867
[profile.dev]
3968
debug = 2
4069
debug-assertions = true

tests/rp/readme.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Pico and Pico 2 Plus connections
2+
3+
GP0-GP1
4+
GP3-GP4
5+
GP6-GP9
6+
GP7-GP11
7+
GP18-GP20 with 10k pullup
8+
GP19-GP21 with 10k pullup

tests/rp/src/bin/adc.rs

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![no_std]
22
#![no_main]
3+
#[cfg(feature = "rp2040")]
34
teleprobe_meta::target!(b"rpi-pico");
5+
#[cfg(feature = "rp235xb")]
6+
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
47

58
use defmt::*;
69
use embassy_executor::Spawner;
@@ -20,52 +23,57 @@ async fn main(_spawner: Spawner) {
2023
let _wifi_off = Output::new(p.PIN_25, Level::High);
2124
let mut adc = Adc::new(p.ADC, Irqs, Config::default());
2225

26+
#[cfg(any(feature = "rp2040", feature = "rp235xa"))]
27+
let (mut a, mut b, mut c, mut d) = (p.PIN_26, p.PIN_27, p.PIN_28, p.PIN_29);
28+
#[cfg(feature = "rp235xb")]
29+
let (mut a, mut b, mut c, mut d) = (p.PIN_44, p.PIN_45, p.PIN_46, p.PIN_47);
30+
2331
{
2432
{
25-
let mut p = Channel::new_pin(&mut p.PIN_26, Pull::Down);
33+
let mut p = Channel::new_pin(&mut a, Pull::Down);
2634
defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
2735
defmt::assert!(adc.read(&mut p).await.unwrap() < 0b01_0000_0000);
2836
}
2937
{
30-
let mut p = Channel::new_pin(&mut p.PIN_26, Pull::Up);
38+
let mut p = Channel::new_pin(&mut a, Pull::Up);
3139
defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
3240
defmt::assert!(adc.read(&mut p).await.unwrap() > 0b11_0000_0000);
3341
}
3442
}
3543
// not bothering with async reads from now on
3644
{
3745
{
38-
let mut p = Channel::new_pin(&mut p.PIN_27, Pull::Down);
46+
let mut p = Channel::new_pin(&mut b, Pull::Down);
3947
defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
4048
}
4149
{
42-
let mut p = Channel::new_pin(&mut p.PIN_27, Pull::Up);
50+
let mut p = Channel::new_pin(&mut b, Pull::Up);
4351
defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
4452
}
4553
}
4654
{
4755
{
48-
let mut p = Channel::new_pin(&mut p.PIN_28, Pull::Down);
56+
let mut p = Channel::new_pin(&mut c, Pull::Down);
4957
defmt::assert!(adc.blocking_read(&mut p).unwrap() < 0b01_0000_0000);
5058
}
5159
{
52-
let mut p = Channel::new_pin(&mut p.PIN_28, Pull::Up);
60+
let mut p = Channel::new_pin(&mut c, Pull::Up);
5361
defmt::assert!(adc.blocking_read(&mut p).unwrap() > 0b11_0000_0000);
5462
}
5563
}
5664
{
5765
// gp29 is connected to vsys through a 200k/100k divider,
5866
// adding pulls should change the value
5967
let low = {
60-
let mut p = Channel::new_pin(&mut p.PIN_29, Pull::Down);
68+
let mut p = Channel::new_pin(&mut d, Pull::Down);
6169
adc.blocking_read(&mut p).unwrap()
6270
};
6371
let none = {
64-
let mut p = Channel::new_pin(&mut p.PIN_29, Pull::None);
72+
let mut p = Channel::new_pin(&mut d, Pull::None);
6573
adc.blocking_read(&mut p).unwrap()
6674
};
6775
let up = {
68-
let mut p = Channel::new_pin(&mut p.PIN_29, Pull::Up);
76+
let mut p = Channel::new_pin(&mut d, Pull::Up);
6977
adc.blocking_read(&mut p).unwrap()
7078
};
7179
defmt::assert!(low < none);
@@ -89,29 +97,14 @@ async fn main(_spawner: Spawner) {
8997
let mut low = [0u16; 16];
9098
let mut none = [0u8; 16];
9199
let mut up = [Sample::default(); 16];
92-
adc.read_many(
93-
&mut Channel::new_pin(&mut p.PIN_29, Pull::Down),
94-
&mut low,
95-
1,
96-
&mut p.DMA_CH0,
97-
)
98-
.await
99-
.unwrap();
100-
adc.read_many(
101-
&mut Channel::new_pin(&mut p.PIN_29, Pull::None),
102-
&mut none,
103-
1,
104-
&mut p.DMA_CH0,
105-
)
106-
.await
107-
.unwrap();
108-
adc.read_many_raw(
109-
&mut Channel::new_pin(&mut p.PIN_29, Pull::Up),
110-
&mut up,
111-
1,
112-
&mut p.DMA_CH0,
113-
)
114-
.await;
100+
adc.read_many(&mut Channel::new_pin(&mut d, Pull::Down), &mut low, 1, &mut p.DMA_CH0)
101+
.await
102+
.unwrap();
103+
adc.read_many(&mut Channel::new_pin(&mut d, Pull::None), &mut none, 1, &mut p.DMA_CH0)
104+
.await
105+
.unwrap();
106+
adc.read_many_raw(&mut Channel::new_pin(&mut d, Pull::Up), &mut up, 1, &mut p.DMA_CH0)
107+
.await;
115108
defmt::assert!(low.iter().zip(none.iter()).all(|(l, n)| *l >> 4 < *n as u16));
116109
defmt::assert!(up.iter().all(|s| s.good()));
117110
defmt::assert!(none.iter().zip(up.iter()).all(|(n, u)| (*n as u16) < u.value()));
@@ -133,7 +126,7 @@ async fn main(_spawner: Spawner) {
133126
{
134127
let mut multi = [0u16; 2];
135128
let mut channels = [
136-
Channel::new_pin(&mut p.PIN_26, Pull::Up),
129+
Channel::new_pin(&mut a, Pull::Up),
137130
Channel::new_temp_sensor(&mut p.ADC_TEMP_SENSOR),
138131
];
139132
adc.read_many_multichannel(&mut channels, &mut multi, 1, &mut p.DMA_CH0)

tests/rp/src/bin/dma_copy_async.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![no_std]
22
#![no_main]
3+
#[cfg(feature = "rp2040")]
34
teleprobe_meta::target!(b"rpi-pico");
5+
#[cfg(feature = "rp235xb")]
6+
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
47

58
use defmt::{assert_eq, *};
69
use embassy_executor::Spawner;

tests/rp/src/bin/flash.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![no_std]
22
#![no_main]
3+
#[cfg(feature = "rp2040")]
34
teleprobe_meta::target!(b"rpi-pico");
5+
#[cfg(feature = "rp235xb")]
6+
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
47

58
use defmt::*;
69
use embassy_executor::Spawner;
@@ -24,13 +27,19 @@ async fn main(_spawner: Spawner) {
2427
let mut flash = embassy_rp::flash::Flash::<_, Async, { 2 * 1024 * 1024 }>::new(p.FLASH, p.DMA_CH0);
2528

2629
// Get JEDEC id
27-
let jedec = defmt::unwrap!(flash.blocking_jedec_id());
28-
info!("jedec id: 0x{:x}", jedec);
30+
#[cfg(feature = "rp2040")]
31+
{
32+
let jedec = defmt::unwrap!(flash.blocking_jedec_id());
33+
info!("jedec id: 0x{:x}", jedec);
34+
}
2935

3036
// Get unique id
31-
let mut uid = [0; 8];
32-
defmt::unwrap!(flash.blocking_unique_id(&mut uid));
33-
info!("unique id: {:?}", uid);
37+
#[cfg(feature = "rp2040")]
38+
{
39+
let mut uid = [0; 8];
40+
defmt::unwrap!(flash.blocking_unique_id(&mut uid));
41+
info!("unique id: {:?}", uid);
42+
}
3443

3544
let mut buf = [0u8; ERASE_SIZE];
3645
defmt::unwrap!(flash.blocking_read(ADDR_OFFSET, &mut buf));

tests/rp/src/bin/gpio.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#![no_std]
22
#![no_main]
3+
#[cfg(feature = "rp2040")]
34
teleprobe_meta::target!(b"rpi-pico");
5+
#[cfg(feature = "rp235xb")]
6+
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
47

58
use defmt::{assert, *};
69
use embassy_executor::Spawner;
7-
use embassy_rp::gpio::{Flex, Input, Level, Output, OutputOpenDrain, Pull};
10+
#[cfg(feature = "rp2040")]
11+
use embassy_rp::gpio::OutputOpenDrain;
12+
use embassy_rp::gpio::{Flex, Input, Level, Output, Pull};
813
use {defmt_rtt as _, panic_probe as _};
914

1015
#[embassy_executor::main]
@@ -76,6 +81,7 @@ async fn main(_spawner: Spawner) {
7681
}
7782

7883
// Test input pulldown
84+
#[cfg(feature = "rp2040")]
7985
{
8086
let b = Input::new(&mut b, Pull::Down);
8187
delay();
@@ -104,6 +110,7 @@ async fn main(_spawner: Spawner) {
104110
}
105111

106112
// OUTPUT OPEN DRAIN
113+
#[cfg(feature = "rp2040")]
107114
{
108115
let mut b = OutputOpenDrain::new(&mut b, Level::High);
109116
let mut a = Flex::new(&mut a);
@@ -202,6 +209,7 @@ async fn main(_spawner: Spawner) {
202209
}
203210

204211
// Test input pulldown
212+
#[cfg(feature = "rp2040")]
205213
{
206214
let mut b = Flex::new(&mut b);
207215
b.set_as_input();

tests/rp/src/bin/gpio_async.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![no_std]
22
#![no_main]
3+
#[cfg(feature = "rp2040")]
34
teleprobe_meta::target!(b"rpi-pico");
5+
#[cfg(feature = "rp235xb")]
6+
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
47

58
use defmt::{assert, *};
69
use embassy_executor::Spawner;

tests/rp/src/bin/gpio_multicore.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#![no_std]
22
#![no_main]
3+
#[cfg(feature = "rp2040")]
34
teleprobe_meta::target!(b"rpi-pico");
5+
#[cfg(feature = "rp235xb")]
6+
teleprobe_meta::target!(b"pimoroni-pico-plus-2");
47

58
use defmt::{info, unwrap};
69
use embassy_executor::Executor;
@@ -56,7 +59,7 @@ async fn core1_task(p: PIN_1) {
5659

5760
CHANNEL0.receive().await;
5861

59-
let mut pin = Input::new(p, Pull::Down);
62+
let mut pin = Input::new(p, Pull::None);
6063
let wait = pin.wait_for_rising_edge();
6164

6265
CHANNEL1.send(()).await;

0 commit comments

Comments
 (0)