Epd4in2::new() waits forever
Opened this issue · 0 comments
Ben-Lichtman commented
I'm trying to use the 4.2in monochrome display with a black pill dev board, however when I call Epd4in2::new
it seems to be waiting forever for the display to become ready.
I am getting the following backtrace when I halt the program.
Running `probe-run --chip STM32F401CCUx --probe 55C3BF6C0648C2865050275915C287 /mnt/Storage/cargo_target/thumbv7em-none-eabihf/debug/black_pill`
(HOST) INFO flashing program (17 pages / 17.00 KiB)
(HOST) INFO success!
────────────────────────────────────────────────────────────────────────────────
^C────────────────────────────────────────────────────────────────────────────────
stack backtrace:
0: epd_waveshare::interface::DisplayInterface<SPI,CS,BUSY,DC,RST,DELAY>::wait_until_idle
at /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/epd-waveshare-0.5.0/src/interface.rs:140:15
1: epd_waveshare::epd4in2::Epd4in2<SPI,CS,BUSY,DC,RST,DELAY>::wait_until_idle
at /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/epd-waveshare-0.5.0/src/epd4in2/mod.rs:364:42
2: epd_waveshare::epd4in2::Epd4in2<SPI,CS,BUSY,DC,RST,DELAY>::cmd_with_data
at /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/epd-waveshare-0.5.0/src/epd4in2/mod.rs:361:3
3: <epd_waveshare::epd4in2::Epd4in2<SPI,CS,BUSY,DC,RST,DELAY> as epd_waveshare::traits::InternalWiAdditions<SPI,CS,BUSY,DC,RST,DELAY>>::init
at /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/epd-waveshare-0.5.0/src/epd4in2/mod.rs:126:3
4: <epd_waveshare::epd4in2::Epd4in2<SPI,CS,BUSY,DC,RST,DELAY> as epd_waveshare::traits::WaveshareDisplay<SPI,CS,BUSY,DC,RST,DELAY>>::new
at /home/ben/.cargo/registry/src/index.crates.io-6f17d22bba15001f/epd-waveshare-0.5.0/src/epd4in2/mod.rs:178:3
5: black_pill::__cortex_m_rt_main
at src/main.rs:50:16
6: main
at src/main.rs:27:1
7: Reset
(HOST) INFO device halted by user
This seems to be looping forever on the wait_until_idle
function while the display never becomes idle
The code I'm using is
#![no_std]
#![no_main]
use cortex_m_rt::entry;
use defmt_rtt as _;
use epd_waveshare::{epd4in2::Epd4in2, prelude::WaveshareDisplay, SPI_MODE};
use panic_probe as _;
use stm32f4xx_hal::{pac, prelude::*, time::Hertz};
#[entry]
fn main() -> ! {
let dp = pac::Peripherals::take().unwrap();
// Set up the system clock. We want to run at 48MHz for this one.
let rcc = dp.RCC.constrain();
let clocks = rcc.cfgr.use_hse(25.MHz()).sysclk(48.MHz()).freeze();
let mut delay = dp.TIM5.delay_us(&clocks);
let gpioa = dp.GPIOA.split();
let mut spi = dp.SPI1.spi(
(
gpioa.pa5.into_push_pull_output(),
gpioa.pa6.into_pull_down_input(),
gpioa.pa7.into_push_pull_output(),
),
SPI_MODE,
Hertz::MHz(4),
&clocks,
);
let mut epd = Epd4in2::new(
&mut spi,
gpioa.pa4.into_push_pull_output(),
gpioa.pa3.into_pull_down_input(),
gpioa.pa2.into_push_pull_output(),
gpioa.pa1.into_push_pull_output(),
&mut delay,
)
.unwrap();
unimplemented!();
}
This is running via probe-run through the SWD port on the device