Enable C2 HIL (#1680)
* ci: Enable c2 hil * docs: Update pins and add C2 * feat: Update C2 probe-rs args * test: Update pins and disable failing tests * docs: Update S3 wires * ci: Enable C2 hil tests
This commit is contained in:
parent
c9925b7f6d
commit
e46e80b8c1
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -333,6 +333,8 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
# RISC-V devices:
|
# RISC-V devices:
|
||||||
|
- soc: esp32c2
|
||||||
|
rust-target: riscv32imc-unknown-none-elf
|
||||||
- soc: esp32c3
|
- soc: esp32c3
|
||||||
rust-target: riscv32imc-unknown-none-elf
|
rust-target: riscv32imc-unknown-none-elf
|
||||||
- soc: esp32c6
|
- soc: esp32c6
|
||||||
|
|||||||
4
.github/workflows/hil.yml
vendored
4
.github/workflows/hil.yml
vendored
@ -27,6 +27,8 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
# RISC-V devices:
|
# RISC-V devices:
|
||||||
|
- soc: esp32c2
|
||||||
|
rust-target: riscv32imc-unknown-none-elf
|
||||||
- soc: esp32c3
|
- soc: esp32c3
|
||||||
rust-target: riscv32imc-unknown-none-elf
|
rust-target: riscv32imc-unknown-none-elf
|
||||||
- soc: esp32c6
|
- soc: esp32c6
|
||||||
@ -99,6 +101,8 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
# RISC-V devices:
|
# RISC-V devices:
|
||||||
|
- soc: esp32c2
|
||||||
|
runner: esp32c2-jtag
|
||||||
- soc: esp32c3
|
- soc: esp32c3
|
||||||
runner: esp32c3-usb
|
runner: esp32c3-usb
|
||||||
- soc: esp32c6
|
- soc: esp32c6
|
||||||
|
|||||||
@ -55,32 +55,39 @@ Some tests will require physical connections, please see the current [configurat
|
|||||||
### Running Tests Remotes (ie. On Self-Hosted Runners)
|
### Running Tests Remotes (ie. On Self-Hosted Runners)
|
||||||
The [`hil.yml`] workflow builds the test suite for all our available targets and executes them.
|
The [`hil.yml`] workflow builds the test suite for all our available targets and executes them.
|
||||||
|
|
||||||
Our Virtual Machines have the following setup:
|
Our self hosted runners have the following setup:
|
||||||
|
- ESP32-C2 (`esp32c2-jtag`):
|
||||||
|
- Devkit: `ESP8684-DevKitM-1` connected via UART.
|
||||||
|
- `GPIO2` and `GPIO3` are connected.
|
||||||
|
- Probe: `ESP-Prog` connected with the [following connections](https://docs.espressif.com/projects/esp-idf/en/stable/esp32c2/api-guides/jtag-debugging/configure-other-jtag.html#configure-hardware)
|
||||||
|
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
||||||
- ESP32-C3 (`rustboard`):
|
- ESP32-C3 (`rustboard`):
|
||||||
- Devkit: `ESP32-C3-DevKit-RUST-1` connected via USB-Serial-JTAG.
|
- Devkit: `ESP32-C3-DevKit-RUST-1` connected via USB-Serial-JTAG.
|
||||||
- `GPIO2` and `GPIO4` are connected.
|
- `GPIO2` and `GPIO3` are connected.
|
||||||
- `GPIO5` and `GPIO6` are connected.
|
- `GPIO5` and `GPIO6` are connected.
|
||||||
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
||||||
- ESP32-C6 (`esp32c6-usb`):
|
- ESP32-C6 (`esp32c6-usb`):
|
||||||
- Devkit: `ESP32-C6-DevKitC-1 V1.2` connected via USB-Serial-JTAG (`USB` port).
|
- Devkit: `ESP32-C6-DevKitC-1 V1.2` connected via USB-Serial-JTAG (`USB` port).
|
||||||
- `GPIO2` and `GPIO4` are connected.
|
- `GPIO2` and `GPIO3` are connected.
|
||||||
- `GPIO5` and `GPIO6` are connected.
|
- `GPIO5` and `GPIO6` are connected.
|
||||||
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
||||||
- ESP32-H2 (`esp32h2-usb`):
|
- ESP32-H2 (`esp32h2-usb`):
|
||||||
- Devkit: `ESP32-H2-DevKitM-1` connected via USB-Serial-JTAG (`USB` port).
|
- Devkit: `ESP32-H2-DevKitM-1` connected via USB-Serial-JTAG (`USB` port).
|
||||||
- `GPIO2` and `GPIO4` are connected.
|
- `GPIO2` and `GPIO3` are connected.
|
||||||
- `GPIO5` and `GPIO8` are connected.
|
- `GPIO5` and `GPIO8` are connected.
|
||||||
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
||||||
- ESP32-S2 (`esp32s2-jtag`):
|
- ESP32-S2 (`esp32s2-jtag`):
|
||||||
- Devkit: `ESP32-S2-Saola-1` connected via UART.
|
- Devkit: `ESP32-S2-Saola-1` connected via UART.
|
||||||
- `GPIO2` and `GPIO4` are connected.
|
- `GPIO2` and `GPIO3` are connected.
|
||||||
- `GPIO5` and `GPIO6` are connected.
|
- `GPIO5` and `GPIO6` are connected.
|
||||||
- Probe: `ESP-Prog` connected with the [following connections](https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/api-guides/jtag-debugging/configure-other-jtag.html#configure-hardware)
|
- Probe: `ESP-Prog` connected with the [following connections](https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/api-guides/jtag-debugging/configure-other-jtag.html#configure-hardware)
|
||||||
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
||||||
- ESP32-S3 (`esp32s3-usb`):
|
- ESP32-S3 (`esp32s3-usb`):
|
||||||
- Devkit: `ESP32-S3-DevKitC-1` connected via USB-Serial-JTAG.
|
- Devkit: `ESP32-S3-DevKitC-1` connected via USB-Serial-JTAG.
|
||||||
- `GPIO2` and `GPIO4` are connected.
|
- `GPIO2` and `GPIO3` are connected.
|
||||||
- `GPIO5` and `GPIO6` are connected.
|
- `GPIO5` and `GPIO6` are connected.
|
||||||
|
- `GPIO1` and `GPIO21` are connected.
|
||||||
|
- `GPIO43 (TX)` and `GPIO45` are connected.
|
||||||
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
- RPi: Raspbian 12 configured with the following [setup](#vm-setup)
|
||||||
|
|
||||||
[`hil.yml`]: https://github.com/esp-rs/esp-hal/blob/main/.github/workflows/hil.yml
|
[`hil.yml`]: https://github.com/esp-rs/esp-hal/blob/main/.github/workflows/hil.yml
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
//! Delay Test
|
//! Delay Test
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32s3
|
// esp32c2 is disabled currently as it fails
|
||||||
|
//% CHIPS: esp32 esp32c3 esp32c6 esp32s3
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
//! current_time Test
|
//! current_time Test
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
// esp32c2 is disabled currently as it fails
|
||||||
|
//% CHIPS: esp32 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! GPIO2
|
//! GPIO2
|
||||||
//! GPIO4
|
//! GPIO3
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ use esp_backtrace as _;
|
|||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
clock::ClockControl,
|
clock::ClockControl,
|
||||||
delay::Delay,
|
delay::Delay,
|
||||||
gpio::{Gpio2, Gpio4, GpioPin, Input, Io, Level, Output, Pull},
|
gpio::{Gpio2, Gpio3, GpioPin, Input, Io, Level, Output, Pull},
|
||||||
macros::handler,
|
macros::handler,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
@ -29,7 +29,7 @@ static INPUT_PIN: Mutex<RefCell<Option<Input<'static, Gpio2>>>> = Mutex::new(Ref
|
|||||||
|
|
||||||
struct Context<'d> {
|
struct Context<'d> {
|
||||||
io2: Input<'d, Gpio2>,
|
io2: Input<'d, Gpio2>,
|
||||||
io4: Output<'d, Gpio4>,
|
io3: Output<'d, Gpio3>,
|
||||||
delay: Delay,
|
delay: Delay,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ impl<'d> Context<'d> {
|
|||||||
|
|
||||||
Context {
|
Context {
|
||||||
io2: Input::new(io.pins.gpio2, Pull::Down),
|
io2: Input::new(io.pins.gpio2, Pull::Down),
|
||||||
io4: Output::new(io.pins.gpio4, Level::Low),
|
io3: Output::new(io.pins.gpio3, Level::Low),
|
||||||
delay,
|
delay,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ mod tests {
|
|||||||
fn init() -> Context<'static> {
|
fn init() -> Context<'static> {
|
||||||
let mut ctx = Context::init();
|
let mut ctx = Context::init();
|
||||||
// make sure tests don't interfere with each other
|
// make sure tests don't interfere with each other
|
||||||
ctx.io4.set_low();
|
ctx.io3.set_low();
|
||||||
ctx
|
ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ mod tests {
|
|||||||
async fn test_async_edge(ctx: Context<'static>) {
|
async fn test_async_edge(ctx: Context<'static>) {
|
||||||
let counter = AtomicUsize::new(0);
|
let counter = AtomicUsize::new(0);
|
||||||
let Context {
|
let Context {
|
||||||
mut io2, mut io4, ..
|
mut io2, mut io3, ..
|
||||||
} = ctx;
|
} = ctx;
|
||||||
embassy_futures::select::select(
|
embassy_futures::select::select(
|
||||||
async {
|
async {
|
||||||
@ -99,9 +99,9 @@ mod tests {
|
|||||||
},
|
},
|
||||||
async {
|
async {
|
||||||
for _ in 0..5 {
|
for _ in 0..5 {
|
||||||
io4.set_high();
|
io3.set_high();
|
||||||
Timer::after(Duration::from_millis(25)).await;
|
Timer::after(Duration::from_millis(25)).await;
|
||||||
io4.set_low();
|
io3.set_low();
|
||||||
Timer::after(Duration::from_millis(25)).await;
|
Timer::after(Duration::from_millis(25)).await;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -133,19 +133,19 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_gpio_output(mut ctx: Context<'static>) {
|
fn test_gpio_output(mut ctx: Context<'static>) {
|
||||||
// `StatefulOutputPin`:
|
// `StatefulOutputPin`:
|
||||||
assert_eq!(ctx.io4.is_set_low(), true);
|
assert_eq!(ctx.io3.is_set_low(), true);
|
||||||
assert_eq!(ctx.io4.is_set_high(), false);
|
assert_eq!(ctx.io3.is_set_high(), false);
|
||||||
ctx.io4.set_high();
|
ctx.io3.set_high();
|
||||||
assert_eq!(ctx.io4.is_set_low(), false);
|
assert_eq!(ctx.io3.is_set_low(), false);
|
||||||
assert_eq!(ctx.io4.is_set_high(), true);
|
assert_eq!(ctx.io3.is_set_high(), true);
|
||||||
|
|
||||||
// `ToggleableOutputPin`:
|
// `ToggleableOutputPin`:
|
||||||
ctx.io4.toggle();
|
ctx.io3.toggle();
|
||||||
assert_eq!(ctx.io4.is_set_low(), true);
|
assert_eq!(ctx.io3.is_set_low(), true);
|
||||||
assert_eq!(ctx.io4.is_set_high(), false);
|
assert_eq!(ctx.io3.is_set_high(), false);
|
||||||
ctx.io4.toggle();
|
ctx.io3.toggle();
|
||||||
assert_eq!(ctx.io4.is_set_low(), false);
|
assert_eq!(ctx.io3.is_set_low(), false);
|
||||||
assert_eq!(ctx.io4.is_set_high(), true);
|
assert_eq!(ctx.io3.is_set_high(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -155,23 +155,23 @@ mod tests {
|
|||||||
ctx.io2.listen(Event::AnyEdge);
|
ctx.io2.listen(Event::AnyEdge);
|
||||||
INPUT_PIN.borrow_ref_mut(cs).replace(ctx.io2);
|
INPUT_PIN.borrow_ref_mut(cs).replace(ctx.io2);
|
||||||
});
|
});
|
||||||
ctx.io4.set_high();
|
ctx.io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
ctx.io4.set_low();
|
ctx.io3.set_low();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
ctx.io4.set_high();
|
ctx.io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
ctx.io4.set_low();
|
ctx.io3.set_low();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
ctx.io4.set_high();
|
ctx.io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
ctx.io4.set_low();
|
ctx.io3.set_low();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
ctx.io4.set_high();
|
ctx.io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
ctx.io4.set_low();
|
ctx.io3.set_low();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
ctx.io4.set_high();
|
ctx.io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
let count = critical_section::with(|cs| *COUNTER.borrow_ref(cs));
|
let count = critical_section::with(|cs| *COUNTER.borrow_ref(cs));
|
||||||
@ -184,86 +184,86 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_gpio_od(ctx: Context<'static>) {
|
fn test_gpio_od(ctx: Context<'static>) {
|
||||||
let mut io2 = OutputOpenDrain::new(unsafe { GpioPin::<2>::steal() }, Level::High, Pull::Up);
|
let mut io2 = OutputOpenDrain::new(unsafe { GpioPin::<2>::steal() }, Level::High, Pull::Up);
|
||||||
let mut io4 = OutputOpenDrain::new(unsafe { GpioPin::<4>::steal() }, Level::High, Pull::Up);
|
let mut io3 = OutputOpenDrain::new(unsafe { GpioPin::<3>::steal() }, Level::High, Pull::Up);
|
||||||
|
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_high(), true);
|
assert_eq!(io2.is_high(), true);
|
||||||
assert_eq!(io4.is_high(), true);
|
assert_eq!(io3.is_high(), true);
|
||||||
|
|
||||||
io2.set_low();
|
io2.set_low();
|
||||||
io4.set_high();
|
io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_low(), true);
|
assert_eq!(io2.is_low(), true);
|
||||||
assert_eq!(io4.is_low(), true);
|
assert_eq!(io3.is_low(), true);
|
||||||
|
|
||||||
io2.set_high();
|
io2.set_high();
|
||||||
io4.set_high();
|
io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_high(), true);
|
assert_eq!(io2.is_high(), true);
|
||||||
assert_eq!(io4.is_high(), true);
|
assert_eq!(io3.is_high(), true);
|
||||||
|
|
||||||
io2.set_high();
|
io2.set_high();
|
||||||
io4.set_low();
|
io3.set_low();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_low(), true);
|
assert_eq!(io2.is_low(), true);
|
||||||
assert_eq!(io4.is_low(), true);
|
assert_eq!(io3.is_low(), true);
|
||||||
|
|
||||||
io2.set_high();
|
io2.set_high();
|
||||||
io4.set_high();
|
io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_high(), true);
|
assert_eq!(io2.is_high(), true);
|
||||||
assert_eq!(io4.is_high(), true);
|
assert_eq!(io3.is_high(), true);
|
||||||
|
|
||||||
io2.set_low();
|
io2.set_low();
|
||||||
io4.set_low();
|
io3.set_low();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_low(), true);
|
assert_eq!(io2.is_low(), true);
|
||||||
assert_eq!(io4.is_low(), true);
|
assert_eq!(io3.is_low(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gpio_flex(ctx: Context<'static>) {
|
fn test_gpio_flex(ctx: Context<'static>) {
|
||||||
let mut io2 = Flex::new(unsafe { GpioPin::<2>::steal() });
|
let mut io2 = Flex::new(unsafe { GpioPin::<2>::steal() });
|
||||||
let mut io4 = Flex::new(unsafe { GpioPin::<4>::steal() });
|
let mut io3 = Flex::new(unsafe { GpioPin::<3>::steal() });
|
||||||
|
|
||||||
io2.set_high();
|
io2.set_high();
|
||||||
io2.set_as_output();
|
io2.set_as_output();
|
||||||
io4.set_as_input(Pull::None);
|
io3.set_as_input(Pull::None);
|
||||||
|
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_set_high(), true);
|
assert_eq!(io2.is_set_high(), true);
|
||||||
assert_eq!(io4.is_high(), true);
|
assert_eq!(io3.is_high(), true);
|
||||||
|
|
||||||
io2.set_low();
|
io2.set_low();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_set_high(), false);
|
assert_eq!(io2.is_set_high(), false);
|
||||||
assert_eq!(io4.is_high(), false);
|
assert_eq!(io3.is_high(), false);
|
||||||
|
|
||||||
io2.set_as_input(Pull::None);
|
io2.set_as_input(Pull::None);
|
||||||
io4.set_as_output();
|
io3.set_as_output();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_high(), false);
|
assert_eq!(io2.is_high(), false);
|
||||||
assert_eq!(io4.is_set_high(), false);
|
assert_eq!(io3.is_set_high(), false);
|
||||||
|
|
||||||
io4.set_high();
|
io3.set_high();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_high(), true);
|
assert_eq!(io2.is_high(), true);
|
||||||
assert_eq!(io4.is_set_high(), true);
|
assert_eq!(io3.is_set_high(), true);
|
||||||
|
|
||||||
io4.set_low();
|
io3.set_low();
|
||||||
ctx.delay.delay_millis(1);
|
ctx.delay.delay_millis(1);
|
||||||
|
|
||||||
assert_eq!(io2.is_low(), true);
|
assert_eq!(io2.is_low(), true);
|
||||||
assert_eq!(io4.is_set_low(), true);
|
assert_eq!(io3.is_set_low(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//! I2S Loopback Test
|
//! I2S Loopback Test
|
||||||
//!
|
//!
|
||||||
//! It's assumed GPIO2 is connected to GPIO4
|
//! It's assumed GPIO2 is connected to GPIO3
|
||||||
//!
|
//!
|
||||||
//! This test uses I2S TX to transmit known data to I2S RX (forced to slave mode
|
//! This test uses I2S TX to transmit known data to I2S RX (forced to slave mode
|
||||||
//! with loopback mode enabled). It's using circular DMA mode
|
//! with loopback mode enabled). It's using circular DMA mode
|
||||||
@ -81,7 +81,7 @@ mod tests {
|
|||||||
.i2s_rx
|
.i2s_rx
|
||||||
.with_bclk(io.pins.gpio0)
|
.with_bclk(io.pins.gpio0)
|
||||||
.with_ws(io.pins.gpio1)
|
.with_ws(io.pins.gpio1)
|
||||||
.with_din(io.pins.gpio4)
|
.with_din(io.pins.gpio3)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// enable loopback testing
|
// enable loopback testing
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
//! RMT Loopback Test
|
//! RMT Loopback Test
|
||||||
//!
|
//!
|
||||||
//! It's assumed GPIO2 is connected to GPIO4
|
//! It's assumed GPIO2 is connected to GPIO3
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
@ -65,17 +65,17 @@ mod tests {
|
|||||||
if #[cfg(any(feature = "esp32", feature = "esp32s2"))] {
|
if #[cfg(any(feature = "esp32", feature = "esp32s2"))] {
|
||||||
let rx_channel = {
|
let rx_channel = {
|
||||||
use esp_hal::rmt::RxChannelCreator;
|
use esp_hal::rmt::RxChannelCreator;
|
||||||
rmt.channel1.configure(io.pins.gpio4, rx_config).unwrap()
|
rmt.channel1.configure(io.pins.gpio3, rx_config).unwrap()
|
||||||
};
|
};
|
||||||
} else if #[cfg(feature = "esp32s3")] {
|
} else if #[cfg(feature = "esp32s3")] {
|
||||||
let rx_channel = {
|
let rx_channel = {
|
||||||
use esp_hal::rmt::RxChannelCreator;
|
use esp_hal::rmt::RxChannelCreator;
|
||||||
rmt.channel7.configure(io.pins.gpio4, rx_config).unwrap()
|
rmt.channel7.configure(io.pins.gpio3, rx_config).unwrap()
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
let rx_channel = {
|
let rx_channel = {
|
||||||
use esp_hal::rmt::RxChannelCreator;
|
use esp_hal::rmt::RxChannelCreator;
|
||||||
rmt.channel2.configure(io.pins.gpio4, rx_config).unwrap()
|
rmt.channel2.configure(io.pins.gpio3, rx_config).unwrap()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! SCLK GPIO0
|
//! SCLK GPIO0
|
||||||
//! MISO GPIO2
|
//! MISO GPIO2
|
||||||
//! MOSI GPIO4
|
//! MOSI GPIO3
|
||||||
//! CS GPIO5
|
//! CS GPIO8
|
||||||
//!
|
//!
|
||||||
//! Connect MISO (GPIO2) and MOSI (GPIO4) pins.
|
//! Connect MISO (GPIO2) and MOSI (GPIO3) pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
@ -38,8 +38,8 @@ impl Context {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio3;
|
||||||
let cs = io.pins.gpio5;
|
let cs = io.pins.gpio8;
|
||||||
|
|
||||||
let spi = Spi::new(peripherals.SPI2, 1000u32.kHz(), SpiMode::Mode0, &clocks).with_pins(
|
let spi = Spi::new(peripherals.SPI2, 1000u32.kHz(), SpiMode::Mode0, &clocks).with_pins(
|
||||||
Some(sclk),
|
Some(sclk),
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! SCLK GPIO0
|
//! SCLK GPIO0
|
||||||
//! MISO GPIO2
|
//! MISO GPIO2
|
||||||
//! MOSI GPIO4
|
//! MOSI GPIO3
|
||||||
//! CS GPIO5
|
//! CS GPIO8
|
||||||
//!
|
//!
|
||||||
//! Connect MISO (GPIO2) and MOSI (GPIO4) pins.
|
//! Connect MISO (GPIO2) and MOSI (GPIO3) pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s3
|
||||||
|
|
||||||
@ -48,8 +48,8 @@ mod tests {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio3;
|
||||||
let cs = io.pins.gpio5;
|
let cs = io.pins.gpio8;
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
|
|
||||||
@ -91,8 +91,8 @@ mod tests {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio3;
|
||||||
let cs = io.pins.gpio5;
|
let cs = io.pins.gpio8;
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
|
|
||||||
@ -135,8 +135,8 @@ mod tests {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio3;
|
||||||
let cs = io.pins.gpio5;
|
let cs = io.pins.gpio8;
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
|
|
||||||
@ -183,8 +183,8 @@ mod tests {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio3;
|
||||||
let cs = io.pins.gpio5;
|
let cs = io.pins.gpio8;
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
|
|
||||||
@ -232,8 +232,8 @@ mod tests {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio3;
|
||||||
let cs = io.pins.gpio5;
|
let cs = io.pins.gpio8;
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
|
|
||||||
@ -280,8 +280,8 @@ mod tests {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
let miso = io.pins.gpio2;
|
let miso = io.pins.gpio2;
|
||||||
let mosi = io.pins.gpio4;
|
let mosi = io.pins.gpio3;
|
||||||
let cs = io.pins.gpio5;
|
let cs = io.pins.gpio8;
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIP2
|
//! TX GPIP2
|
||||||
//! RX GPIO4
|
//! RX GPIO3
|
||||||
//!
|
//!
|
||||||
//! Connect TX (GPIO2) and RX (GPIO4) pins.
|
//! Connect TX (GPIO2) and RX (GPIO3) pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ impl Context {
|
|||||||
|
|
||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
|
|
||||||
let uart = Uart::new(peripherals.UART1, &clocks, io.pins.gpio2, io.pins.gpio4).unwrap();
|
let uart = Uart::new(peripherals.UART1, &clocks, io.pins.gpio2, io.pins.gpio3).unwrap();
|
||||||
|
|
||||||
Context { clocks, uart }
|
Context { clocks, uart }
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ mod tests {
|
|||||||
|
|
||||||
#[cfg(not(feature = "esp32s2"))]
|
#[cfg(not(feature = "esp32s2"))]
|
||||||
{
|
{
|
||||||
#[cfg(not(feature = "esp32c3"))]
|
#[cfg(not(any(feature = "esp32c3", feature = "esp32c2")))]
|
||||||
{
|
{
|
||||||
// 9600 baud, RC FAST clock source:
|
// 9600 baud, RC FAST clock source:
|
||||||
ctx.uart.change_baud(9600, ClockSource::RcFast, &ctx.clocks);
|
ctx.uart.change_baud(9600, ClockSource::RcFast, &ctx.clocks);
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIP2
|
//! TX GPIP2
|
||||||
//! RX GPIO4
|
//! RX GPIO3
|
||||||
//!
|
//!
|
||||||
//! Connect TX (GPIO2) and RX (GPIO4) pins.
|
//! Connect TX (GPIO2) and RX (GPIO3) pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ impl Context {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
|
|
||||||
let uart =
|
let uart =
|
||||||
Uart::new_async(peripherals.UART0, &clocks, io.pins.gpio2, io.pins.gpio4).unwrap();
|
Uart::new_async(peripherals.UART0, &clocks, io.pins.gpio2, io.pins.gpio3).unwrap();
|
||||||
|
|
||||||
Context { uart }
|
Context { uart }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIP2
|
//! TX GPIP2
|
||||||
//! RX GPIO4
|
//! RX GPIO3
|
||||||
//!
|
//!
|
||||||
//! Connect TX (GPIO2) and RX (GPIO4) pins.
|
//! Connect TX (GPIO2) and RX (GPIO3) pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ impl Context {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
|
|
||||||
let tx = UartTx::new(peripherals.UART0, &clocks, None, io.pins.gpio2).unwrap();
|
let tx = UartTx::new(peripherals.UART0, &clocks, None, io.pins.gpio2).unwrap();
|
||||||
let rx = UartRx::new(peripherals.UART1, &clocks, None, io.pins.gpio4).unwrap();
|
let rx = UartRx::new(peripherals.UART1, &clocks, None, io.pins.gpio3).unwrap();
|
||||||
|
|
||||||
Context { tx, rx }
|
Context { tx, rx }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIP2
|
//! TX GPIP2
|
||||||
//! RX GPIO4
|
//! RX GPIO3
|
||||||
//!
|
//!
|
||||||
//! Connect TX (GPIO2) and RX (GPIO4) pins.
|
//! Connect TX (GPIO2) and RX (GPIO3) pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ impl Context {
|
|||||||
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
|
|
||||||
let tx = UartTx::new_async(peripherals.UART0, &clocks, io.pins.gpio2).unwrap();
|
let tx = UartTx::new_async(peripherals.UART0, &clocks, io.pins.gpio2).unwrap();
|
||||||
let rx = UartRx::new_async(peripherals.UART1, &clocks, io.pins.gpio4).unwrap();
|
let rx = UartRx::new_async(peripherals.UART1, &clocks, io.pins.gpio3).unwrap();
|
||||||
|
|
||||||
Context { tx, rx }
|
Context { tx, rx }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -306,6 +306,13 @@ pub fn execute_app(
|
|||||||
if subcommand == "test" {
|
if subcommand == "test" {
|
||||||
if chip == Chip::Esp32 {
|
if chip == Chip::Esp32 {
|
||||||
builder = builder.arg("--").arg("--chip").arg("esp32-3.3v");
|
builder = builder.arg("--").arg("--chip").arg("esp32-3.3v");
|
||||||
|
} else if chip == Chip::Esp32c2 {
|
||||||
|
builder = builder
|
||||||
|
.arg("--")
|
||||||
|
.arg("--chip")
|
||||||
|
.arg("esp32c2")
|
||||||
|
.arg("--speed")
|
||||||
|
.arg("15000");
|
||||||
} else {
|
} else {
|
||||||
builder = builder.arg("--").arg("--chip").arg(format!("{}", chip));
|
builder = builder.arg("--").arg("--chip").arg(format!("{}", chip));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user