Enable ESP32 HIL (#1977)
* Enable ESP32 HIL * RMT fixed * SPI DMA partially works, _pcnt tests not working * bckup * finish * readme and cleanup * rebase + cleanup * RMT S2 pin typo + clean forgotten comments * review comments * update 10000 * indentation * replace cfg gate with cfg_if
This commit is contained in:
parent
fba475ee40
commit
17daa464ba
6
.github/workflows/hil.yml
vendored
6
.github/workflows/hil.yml
vendored
@ -86,6 +86,8 @@ jobs:
|
|||||||
- soc: esp32h2
|
- soc: esp32h2
|
||||||
rust-target: riscv32imac-unknown-none-elf
|
rust-target: riscv32imac-unknown-none-elf
|
||||||
# # Xtensa devices:
|
# # Xtensa devices:
|
||||||
|
- soc: esp32
|
||||||
|
rust-target: xtensa-esp32-none-elf
|
||||||
- soc: esp32s2
|
- soc: esp32s2
|
||||||
rust-target: xtensa-esp32s2-none-elf
|
rust-target: xtensa-esp32s2-none-elf
|
||||||
- soc: esp32s3
|
- soc: esp32s3
|
||||||
@ -168,6 +170,10 @@ jobs:
|
|||||||
host: armv7
|
host: armv7
|
||||||
hubs: "1-1"
|
hubs: "1-1"
|
||||||
# Xtensa devices:
|
# Xtensa devices:
|
||||||
|
- soc: esp32
|
||||||
|
runner: esp32-jtag
|
||||||
|
host: aarch64
|
||||||
|
hubs: "1 3"
|
||||||
- soc: esp32s2
|
- soc: esp32s2
|
||||||
runner: esp32s2-jtag
|
runner: esp32s2-jtag
|
||||||
host: armv7
|
host: armv7
|
||||||
|
|||||||
@ -103,9 +103,17 @@ Our self-hosted runners have the following setup:
|
|||||||
- `GPIO9` and `GPIO10` are connected.
|
- `GPIO9` and `GPIO10` are connected.
|
||||||
- `GPIO43 (TX)` and `GPIO45` are connected.
|
- `GPIO43 (TX)` and `GPIO45` are connected.
|
||||||
- RPi: Raspbian 12 configured with the following [setup]
|
- RPi: Raspbian 12 configured with the following [setup]
|
||||||
|
- ESP32 (`esp32-jtag`):
|
||||||
|
- Devkit: `ESP32-DevKitC-V4` connected via UART.
|
||||||
|
- `GPIO32` and `GPIO33` are I2C pins.
|
||||||
|
- `GPIO4` and `GPIO5` are connected.
|
||||||
|
- `GPIO26` and `GPIO27` are connected.
|
||||||
|
- Probe: `ESP-Prog` connected with the [following connections][connection_esp32]
|
||||||
|
- RPi: Raspbian 12 configured with the following [setup]
|
||||||
|
|
||||||
[connection_c2]: https://docs.espressif.com/projects/esp-idf/en/stable/esp32c2/api-guides/jtag-debugging/configure-other-jtag.html#configure-hardware
|
[connection_c2]: https://docs.espressif.com/projects/esp-idf/en/stable/esp32c2/api-guides/jtag-debugging/configure-other-jtag.html#configure-hardware
|
||||||
[connection_s2]: https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/api-guides/jtag-debugging/configure-other-jtag.html#configure-hardware
|
[connection_s2]: https://docs.espressif.com/projects/esp-idf/en/stable/esp32s2/api-guides/jtag-debugging/configure-other-jtag.html#configure-hardware
|
||||||
|
[connection_esp32]: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/jtag-debugging/configure-other-jtag.html#configure-hardware.html#configure-hardware
|
||||||
[`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
|
||||||
[setup]: #rpi-setup
|
[setup]: #rpi-setup
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,8 @@ macro_rules! i2c_pins {
|
|||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(any(esp32s2, esp32s3))] {
|
if #[cfg(any(esp32s2, esp32s3))] {
|
||||||
($io.pins.gpio2, $io.pins.gpio3)
|
($io.pins.gpio2, $io.pins.gpio3)
|
||||||
|
} else if #[cfg(esp32)] {
|
||||||
|
($io.pins.gpio32, $io.pins.gpio33)
|
||||||
} else if #[cfg(esp32c6)] {
|
} else if #[cfg(esp32c6)] {
|
||||||
($io.pins.gpio6, $io.pins.gpio7)
|
($io.pins.gpio6, $io.pins.gpio7)
|
||||||
} else if #[cfg(esp32h2)] {
|
} else if #[cfg(esp32h2)] {
|
||||||
@ -49,7 +51,11 @@ macro_rules! common_test_pins {
|
|||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(any(esp32s2, esp32s3))] {
|
if #[cfg(any(esp32s2, esp32s3))] {
|
||||||
($io.pins.gpio9, $io.pins.gpio10)
|
($io.pins.gpio9, $io.pins.gpio10)
|
||||||
} else {
|
}
|
||||||
|
else if #[cfg(esp32)] {
|
||||||
|
($io.pins.gpio26, $io.pins.gpio27)
|
||||||
|
}
|
||||||
|
else {
|
||||||
($io.pins.gpio2, $io.pins.gpio3)
|
($io.pins.gpio2, $io.pins.gpio3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,21 +8,23 @@
|
|||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use embassy_time::{Duration, Ticker, Timer};
|
use embassy_time::{Duration, Ticker, Timer};
|
||||||
use esp_hal::{
|
|
||||||
interrupt::software::SoftwareInterruptControl,
|
|
||||||
peripherals::Peripherals,
|
|
||||||
prelude::*,
|
|
||||||
timer::{timg::TimerGroup, ErasedTimer, OneShotTimer, PeriodicTimer},
|
|
||||||
};
|
|
||||||
#[cfg(not(feature = "esp32"))]
|
#[cfg(not(feature = "esp32"))]
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
|
interrupt::software::SoftwareInterruptControl,
|
||||||
interrupt::Priority,
|
interrupt::Priority,
|
||||||
timer::systimer::{Alarm, FrozenUnit, Periodic, SystemTimer, Target},
|
timer::systimer::{Alarm, FrozenUnit, Periodic, SystemTimer, Target},
|
||||||
|
timer::ErasedTimer,
|
||||||
|
};
|
||||||
|
use esp_hal::{
|
||||||
|
peripherals::Peripherals,
|
||||||
|
prelude::*,
|
||||||
|
timer::{timg::TimerGroup, OneShotTimer, PeriodicTimer},
|
||||||
};
|
};
|
||||||
#[cfg(not(feature = "esp32"))]
|
#[cfg(not(feature = "esp32"))]
|
||||||
use esp_hal_embassy::InterruptExecutor;
|
use esp_hal_embassy::InterruptExecutor;
|
||||||
use hil_test as _;
|
use hil_test as _;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "esp32"))]
|
||||||
macro_rules! mk_static {
|
macro_rules! mk_static {
|
||||||
($t:ty,$val:expr) => {{
|
($t:ty,$val:expr) => {{
|
||||||
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
|
static STATIC_CELL: static_cell::StaticCell<$t> = static_cell::StaticCell::new();
|
||||||
@ -123,7 +125,9 @@ fn set_up_embassy_with_systimer(peripherals: Peripherals) {
|
|||||||
#[embedded_test::tests(executor = esp_hal_embassy::Executor::new())]
|
#[embedded_test::tests(executor = esp_hal_embassy::Executor::new())]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{test_cases::*, test_helpers::*};
|
use crate::test_cases::*;
|
||||||
|
#[cfg(not(feature = "esp32"))]
|
||||||
|
use crate::test_helpers::*;
|
||||||
|
|
||||||
#[init]
|
#[init]
|
||||||
fn init() -> Peripherals {
|
fn init() -> Peripherals {
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
//! GPIO Test
|
//! GPIO Test
|
||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//! GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
//% FEATURES: generic-queue
|
//% FEATURES: generic-queue
|
||||||
|
|||||||
@ -4,12 +4,14 @@
|
|||||||
//! SDA GPIO2 (esp32s2 and esp32s3)
|
//! SDA GPIO2 (esp32s2 and esp32s3)
|
||||||
//! GPIO6 (esp32c6)
|
//! GPIO6 (esp32c6)
|
||||||
//! GPIO18 (esp32c2)
|
//! GPIO18 (esp32c2)
|
||||||
//! GPIO4 (esp32, esp32h2 and esp32c3)
|
//! GPIO4 (esp32h2 and esp32c3)
|
||||||
|
//! GPIO32 (esp32)
|
||||||
//!
|
//!
|
||||||
//! SCL GPIO3 (esp32s2 and esp32s3)
|
//! SCL GPIO3 (esp32s2 and esp32s3)
|
||||||
//! GPIO7 (esp32c6, esp32 and esp32c3)
|
//! GPIO7 (esp32c6 and esp32c3)
|
||||||
//! GPIO22 (esp32h2)
|
//! GPIO22 (esp32h2)
|
||||||
//! GPIO19 (esp32c2)
|
//! GPIO19 (esp32c2)
|
||||||
|
//! GPIO33 (esp32)
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use esp_hal::{
|
use esp_hal::{
|
||||||
dma::{Dma, DmaChannel0, DmaPriority},
|
dma::{Dma, DmaPriority},
|
||||||
gpio::Io,
|
gpio::Io,
|
||||||
i2s::{asynch::*, DataFormat, I2s, I2sTx, Standard},
|
i2s::{asynch::*, DataFormat, I2s, I2sTx, Standard},
|
||||||
peripheral::Peripheral,
|
peripheral::Peripheral,
|
||||||
@ -23,6 +23,17 @@ use esp_hal::{
|
|||||||
};
|
};
|
||||||
use hil_test as _;
|
use hil_test as _;
|
||||||
|
|
||||||
|
cfg_if::cfg_if! {
|
||||||
|
if #[cfg(any(
|
||||||
|
feature = "esp32",
|
||||||
|
feature = "esp32s2",
|
||||||
|
))] {
|
||||||
|
use esp_hal::dma::Spi2DmaChannel as DmaChannel0;
|
||||||
|
} else {
|
||||||
|
use esp_hal::dma::DmaChannel0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const BUFFER_SIZE: usize = 2000;
|
const BUFFER_SIZE: usize = 2000;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -91,7 +102,14 @@ mod tests {
|
|||||||
let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
let mut io = Io::new(peripherals.GPIO, peripherals.IO_MUX);
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
let dma_channel = dma.channel0;
|
|
||||||
|
cfg_if::cfg_if! {
|
||||||
|
if #[cfg(any(feature = "esp32", feature = "esp32s2"))] {
|
||||||
|
let dma_channel = dma.spi2channel;
|
||||||
|
} else {
|
||||||
|
let dma_channel = dma.channel0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let (tx_buffer, tx_descriptors, rx_buffer, rx_descriptors) =
|
let (tx_buffer, tx_descriptors, rx_buffer, rx_descriptors) =
|
||||||
esp_hal::dma_circular_buffers!(BUFFER_SIZE, BUFFER_SIZE);
|
esp_hal::dma_circular_buffers!(BUFFER_SIZE, BUFFER_SIZE);
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! It's assumed GPIO2 is connected to GPIO3
|
//! It's assumed GPIO2 is connected to GPIO3
|
||||||
//! (GPIO9 and GPIO10 for esp32s2 and esp32s3)
|
//! (GPIO9 and GPIO10 for esp32s2 and esp32s3)
|
||||||
|
//! (GPIO26 and GPIO27 for esp32)
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Connect MISO and GPIO pins.
|
//! Connect MISO and GPIO pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Connect MOSI and PCNT pins.
|
//! Connect MOSI and PCNT pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Connect MOSI/MISO and GPIO pins.
|
//! Connect MOSI/MISO and GPIO pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! It's assumed GPIO2 is connected to GPIO3
|
//! It's assumed GPIO2 is connected to GPIO3
|
||||||
//! (GPIO9 and GPIO10 for esp32s2 and esp32s3)
|
//! (GPIO9 and GPIO10 for esp32s2 and esp32s3)
|
||||||
|
//! (GPIO26 and GPIO27 for esp32)
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
//% CHIPS: esp32 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3
|
||||||
|
|
||||||
@ -59,11 +60,16 @@ mod tests {
|
|||||||
};
|
};
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
if #[cfg(any(feature = "esp32", feature = "esp32s2"))] {
|
if #[cfg(feature = "esp32")] {
|
||||||
let rx_channel = {
|
let rx_channel = {
|
||||||
use esp_hal::rmt::RxChannelCreator;
|
use esp_hal::rmt::RxChannelCreator;
|
||||||
rmt.channel1.configure(rx, rx_config).unwrap()
|
rmt.channel1.configure(rx, rx_config).unwrap()
|
||||||
};
|
};
|
||||||
|
} else if #[cfg(feature = "esp32s2")] {
|
||||||
|
let rx_channel = {
|
||||||
|
use esp_hal::rmt::RxChannelCreator;
|
||||||
|
rmt.channel1.configure(rx, 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;
|
||||||
@ -101,11 +107,12 @@ mod tests {
|
|||||||
|
|
||||||
let rx_transaction = rx_channel.receive(&mut rcv_data).unwrap();
|
let rx_transaction = rx_channel.receive(&mut rcv_data).unwrap();
|
||||||
let tx_transaction = tx_channel.transmit(&tx_data);
|
let tx_transaction = tx_channel.transmit(&tx_data);
|
||||||
tx_transaction.wait().unwrap();
|
|
||||||
rx_transaction.wait().unwrap();
|
|
||||||
|
|
||||||
// the last two pulse-codes are the ones which wait for the timeout so they
|
rx_transaction.wait().unwrap();
|
||||||
// can't be equal
|
tx_transaction.wait().unwrap();
|
||||||
|
|
||||||
|
// the last two pulse-codes are the ones which wait for the timeout so
|
||||||
|
// they can't be equal
|
||||||
assert_eq!(&tx_data[..18], &rcv_data[..18]);
|
assert_eq!(&tx_data[..18], &rcv_data[..18]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! SCLK GPIO0
|
//! SCLK GPIO0
|
||||||
//! MISO GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! MISO GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//! MOSI GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! MOSI GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//! CS GPIO8
|
|
||||||
//!
|
//!
|
||||||
//! Connect MISO and MOSI pins.
|
//! Connect MISO and MOSI pins.
|
||||||
|
|
||||||
@ -37,16 +36,14 @@ mod tests {
|
|||||||
let peripherals = esp_hal::init(esp_hal::Config::default());
|
let peripherals = esp_hal::init(esp_hal::Config::default());
|
||||||
|
|
||||||
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, mosi) = hil_test::common_test_pins!(io);
|
let (miso, mosi) = hil_test::common_test_pins!(io);
|
||||||
let cs = io.pins.gpio8;
|
|
||||||
|
|
||||||
let spi = Spi::new(peripherals.SPI2, 1000u32.kHz(), SpiMode::Mode0).with_pins(
|
let spi = Spi::new(peripherals.SPI2, 1000u32.kHz(), SpiMode::Mode0)
|
||||||
Some(sclk),
|
.with_sck(sclk)
|
||||||
Some(mosi),
|
.with_mosi(mosi)
|
||||||
Some(miso),
|
.with_miso(miso);
|
||||||
Some(cs),
|
|
||||||
);
|
|
||||||
|
|
||||||
Context { spi }
|
Context { spi }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! SCLK GPIO0
|
//! SCLK GPIO0
|
||||||
//! MISO GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! MISO GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//! MOSI GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! MOSI GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//! CS GPIO8
|
|
||||||
//!
|
//!
|
||||||
//! Connect MISO and MOSI pins.
|
//! Connect MISO and MOSI pins.
|
||||||
|
|
||||||
@ -57,7 +56,6 @@ 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, mosi) = hil_test::common_test_pins!(io);
|
let (miso, mosi) = hil_test::common_test_pins!(io);
|
||||||
let cs = io.pins.gpio8;
|
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
|
|
||||||
@ -70,7 +68,9 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let spi = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0)
|
let spi = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0)
|
||||||
.with_pins(Some(sclk), Some(mosi), Some(miso), Some(cs))
|
.with_sck(sclk)
|
||||||
|
.with_mosi(mosi)
|
||||||
|
.with_miso(miso)
|
||||||
.with_dma(dma_channel.configure(false, DmaPriority::Priority0));
|
.with_dma(dma_channel.configure(false, DmaPriority::Priority0));
|
||||||
|
|
||||||
Context { spi }
|
Context { spi }
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
//! SCLK GPIO0
|
//! SCLK GPIO0
|
||||||
//! MOSI GPIO3 / GPIO10 (esp32s3)
|
//! MOSI GPIO3 / GPIO10 (esp32s3)
|
||||||
//! MISO GPIO4
|
//! MISO GPIO4
|
||||||
//! CS GPIO8
|
|
||||||
//!
|
//!
|
||||||
//! PCNT GPIO2 / GPIO9 (esp32s3)
|
//! PCNT GPIO2 / GPIO9 (esp32s3)
|
||||||
//! OUTPUT GPIO5 (helper to keep MISO LOW)
|
//! OUTPUT GPIO5 (helper to keep MISO LOW)
|
||||||
@ -14,7 +13,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Connect PCNT and MOSI, MISO and GPIO5 pins.
|
//! Connect PCNT and MOSI, MISO and GPIO5 pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c6 esp32h2 esp32s3
|
//% CHIPS: esp32c6 esp32h2 esp32s3
|
||||||
//% FEATURES: generic-queue
|
//% FEATURES: generic-queue
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@ -78,7 +77,6 @@ mod tests {
|
|||||||
|
|
||||||
let (mosi_mirror, mosi) = hil_test::common_test_pins!(io);
|
let (mosi_mirror, mosi) = hil_test::common_test_pins!(io);
|
||||||
let miso = io.pins.gpio4;
|
let miso = io.pins.gpio4;
|
||||||
let cs = io.pins.gpio8;
|
|
||||||
let mosi_mirror = mosi_mirror.degrade();
|
let mosi_mirror = mosi_mirror.degrade();
|
||||||
|
|
||||||
let mut out_pin = Output::new(io.pins.gpio5, Level::Low);
|
let mut out_pin = Output::new(io.pins.gpio5, Level::Low);
|
||||||
@ -100,7 +98,9 @@ mod tests {
|
|||||||
let dma_rx_buf = DmaRxBuf::new(rx_descriptors, rx_buffer).unwrap();
|
let dma_rx_buf = DmaRxBuf::new(rx_descriptors, rx_buffer).unwrap();
|
||||||
|
|
||||||
let spi = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0)
|
let spi = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0)
|
||||||
.with_pins(Some(sclk), Some(mosi), Some(miso), Some(cs))
|
.with_sck(sclk)
|
||||||
|
.with_mosi(mosi)
|
||||||
|
.with_miso(miso)
|
||||||
.with_dma(dma_channel.configure_for_async(false, DmaPriority::Priority0))
|
.with_dma(dma_channel.configure_for_async(false, DmaPriority::Priority0))
|
||||||
.with_buffers(dma_tx_buf, dma_rx_buf);
|
.with_buffers(dma_tx_buf, dma_rx_buf);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! SCLK GPIO0
|
//! SCLK GPIO0
|
||||||
//! MOSI GPIO3 / GPIO10 (esp32s3)
|
//! MOSI GPIO3 / GPIO10 (esp32s3)
|
||||||
//! CS GPIO8
|
|
||||||
//! PCNT GPIO2 / GPIO9 (esp32s3)
|
//! PCNT GPIO2 / GPIO9 (esp32s3)
|
||||||
//! OUTPUT GPIO5 (helper to keep MISO LOW)
|
//! OUTPUT GPIO5 (helper to keep MISO LOW)
|
||||||
//!
|
//!
|
||||||
@ -12,7 +11,7 @@
|
|||||||
//!
|
//!
|
||||||
//! Connect MISO and MOSI pins.
|
//! Connect MISO and MOSI pins.
|
||||||
|
|
||||||
//% CHIPS: esp32 esp32c6 esp32h2 esp32s3
|
//% CHIPS: esp32c6 esp32h2 esp32s3
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
@ -70,7 +69,6 @@ mod tests {
|
|||||||
let sclk = io.pins.gpio0;
|
let sclk = io.pins.gpio0;
|
||||||
let (mosi_mirror, mosi) = hil_test::common_test_pins!(io);
|
let (mosi_mirror, mosi) = hil_test::common_test_pins!(io);
|
||||||
let miso = io.pins.gpio4;
|
let miso = io.pins.gpio4;
|
||||||
let cs = io.pins.gpio8;
|
|
||||||
|
|
||||||
let dma = Dma::new(peripherals.DMA);
|
let dma = Dma::new(peripherals.DMA);
|
||||||
|
|
||||||
@ -83,7 +81,9 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let spi = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0)
|
let spi = Spi::new(peripherals.SPI2, 100.kHz(), SpiMode::Mode0)
|
||||||
.with_pins(Some(sclk), Some(mosi), Some(miso), Some(cs))
|
.with_sck(sclk)
|
||||||
|
.with_mosi(mosi)
|
||||||
|
.with_miso(miso)
|
||||||
.with_dma(dma_channel.configure(false, DmaPriority::Priority0));
|
.with_dma(dma_channel.configure(false, DmaPriority::Priority0));
|
||||||
|
|
||||||
let pcnt = Pcnt::new(peripherals.PCNT);
|
let pcnt = Pcnt::new(peripherals.PCNT);
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! SCLK GPIO0
|
//! SCLK GPIO0
|
||||||
//! MISO GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! MISO GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//!
|
//!
|
||||||
//! GPIO GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! GPIO GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//!
|
//!
|
||||||
//! Connect MISO and GPIO pins.
|
//! Connect MISO and GPIO pins.
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
//!
|
//!
|
||||||
//! Following pins are used:
|
//! Following pins are used:
|
||||||
//! SCLK GPIO0
|
//! SCLK GPIO0
|
||||||
//! MOSI GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! MOSI GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//!
|
//!
|
||||||
//! PCNT GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! PCNT GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//!
|
//!
|
||||||
//! Connect MOSI and PCNT pins.
|
//! Connect MOSI and PCNT pins.
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
//! TWAI test
|
//! TWAI test
|
||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! TX GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//! RX GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! RX GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//!
|
//!
|
||||||
//! Connect TX and RX pins.
|
//! Connect TX and RX pins.
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
//! UART Test
|
//! UART Test
|
||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! TX GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//! RX GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! RX GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//!
|
//!
|
||||||
//! Connect TX and RX pins.
|
//! Connect TX and RX pins.
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
//! UART Test
|
//! UART Test
|
||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! TX GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//! RX GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! RX GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//!
|
//!
|
||||||
//! Connect TX and RX pins.
|
//! Connect TX and RX pins.
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
//! UART TX/RX Test
|
//! UART TX/RX Test
|
||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! TX GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//! RX GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! RX GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//!
|
//!
|
||||||
//! Connect TX and RX pins.
|
//! Connect TX and RX pins.
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
//! UART TX/RX Async Test
|
//! UART TX/RX Async Test
|
||||||
//!
|
//!
|
||||||
//! Folowing pins are used:
|
//! Folowing pins are used:
|
||||||
//! TX GPIO2 / GPIO9 (esp32s2 and esp32s3)
|
//! TX GPIO2 / GPIO9 (esp32s2 / esp32s3) / GPIO26 (esp32)
|
||||||
//! RX GPIO3 / GPIO10 (esp32s2 and esp32s3)
|
//! RX GPIO3 / GPIO10 (esp32s2 / esp32s3) / GPIO27 (esp32)
|
||||||
//!
|
//!
|
||||||
//! Connect TX and RX pins.
|
//! Connect TX and RX pins.
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user