Skip to content

Instantly share code, notes, and snippets.

@a13x
Created November 6, 2022 12:08
Show Gist options
  • Save a13x/cb465ca0b66a3222230fbd76c924ea63 to your computer and use it in GitHub Desktop.
Save a13x/cb465ca0b66a3222230fbd76c924ea63 to your computer and use it in GitHub Desktop.
Testing the Waveshare Epaper 5.65f with epd-waveshare rust package
use anyhow;
use embedded_hal::prelude::*;
use esp_idf_hal::gpio;
use esp_idf_hal::prelude::*;
use esp_idf_hal::spi;
use esp_idf_hal::delay::FreeRtos;
use epd_waveshare::{epd5in65f::Epd5in65f, prelude::*};
fn main() -> anyhow::Result<()> {
// Temporary. Will disappear once ESP-IDF 4.4 is released, but for now it is necessary to call this function once,
// or else some patches to the runtime implemented by esp-idf-sys might not link properly.
esp_idf_sys::link_patches();
#[allow(unused)]
let peripherals = Peripherals::take().unwrap();
#[allow(unused)]
let pins = peripherals.pins;
let sclk = pins.gpio18;
let sdo = pins.gpio19;
let cs = pins.gpio5.into_output().unwrap();
let busy_in = pins.gpio35.into_input().unwrap();
let dc = pins.gpio32.into_output().unwrap();
let rst = pins.gpio16.into_output().unwrap();
let mut delay = FreeRtos {};
println!("Hello, world!");
let config = <spi::config::Config as Default>::default().baudrate(20.MHz().into());
let mut my_spi = spi::Master::<spi::SPI2, _, _, _, _>::new(
peripherals.spi2,
spi::Pins {
sclk,
sdo,
sdi: Option::<gpio::Gpio23<gpio::Unknown>>::None,
cs: Option::<gpio::Gpio5<gpio::Unknown>>::None,
},
config,
).unwrap();
println!("Epaper init");
let mut epd = Epd5in65f::new(&mut my_spi, cs, busy_in, dc, rst, &mut delay)?;
println!("Epaper finished");
epd.clear_frame(&mut my_spi, &mut delay)?;
println!("Epaper cleared");
Ok(())
}
I (226) cpu_start: Pro cpu up.
I (226) cpu_start: Starting app cpu, entry point is 0x40081e20
0x40081e20 - call_start_cpu1
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/esp_system/port\cpu_start.c:160
I (0) cpu_start: App cpu up.
I (240) cpu_start: Pro cpu start user code
I (240) cpu_start: cpu freq: 160000000
I (240) cpu_start: Application information:
I (245) cpu_start: Project name: libespidf
I (250) cpu_start: App version: 1
I (254) cpu_start: Compile time: Nov 5 2022 18:23:05
I (260) cpu_start: ELF file SHA256: 0000000000000000...
I (266) cpu_start: ESP-IDF: v4.4.2-dirty
I (272) heap_init: Initializing. RAM available for dynamic allocation:
I (279) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (285) heap_init: At 3FFB2E68 len 0002D198 (180 KiB): DRAM
I (291) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (298) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (304) heap_init: At 4008BF28 len 000140D8 (80 KiB): IRAM
I (311) spi_flash: detected chip: generic
I (315) spi_flash: flash io: dio
I (320) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (331) gpio: GPIO[5]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (341) gpio: GPIO[35]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (351) gpio: GPIO[32]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
I (361) gpio: GPIO[16]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0
Hello, world!
Epaper init
Epaper finished
E (5681) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (5681) task_wdt: - IDLE (CPU 0)
E (5681) task_wdt: Tasks currently running:
E (5681) task_wdt: CPU 0: main
E (5681) task_wdt: CPU 1: IDLE
E (5681) task_wdt: Print CPU 0 (current core) backtrace
Backtrace:0x401079AE:0x3FFB0CA00x4008344D:0x3FFB0CC0 0x400D497D:0x3FFB6740 0x400D4F88:0x3FFB6770 0x400D4C7B:0x3FFB67A0 0x4011594B:0x3FFB6810 0x400D4DDC:0x3FFB6830 0x400E95AA:0x3FFB6850 0x400D4DCC:0x3FFB6880 0x400D4D2F:0x3FFB68B0 0x400D5787:0x3FFB68D0 0x40116A00:0x3FFB68F0
0x401079AE - task_wdt_isr
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/esp_system\task_wdt.c:183
0x4008344D - _xt_lowint1
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/freertos/port/xtensa\xtensa_vectors.S:1111
0x400D497D - epd_waveshare::interface::DisplayInterface<SPI,CS,BUSY,DC,RST,DELAY>::wait_until_idle
at C:\Users\alex\src\epd-waveshare\src\interface.rs:137
0x400D4F88 - epd_waveshare::epd5in65f::Epd5in65f<SPI,CS,BUSY,DC,RST,DELAY>::wait_busy_low
at C:\Users\alex\src\epd-waveshare\src\epd5in65f\mod.rs:237
0x400D4C7B - espap::main
at C:\Users\alex\src\espap\src\main.rs:45
0x4011594B - core::ops::function::FnOnce::call_once
at C:\Users\alex\.rustup\toolchains\esp\lib\rustlib\src\rust\library\core\src\ops\function.rs:248
0x400D4DDC - std::rt::lang_start::{{closure}}
at C:\Users\alex\.rustup\toolchains\esp\lib\rustlib\src\rust\library\std\src\rt.rs:166
0x400E95AA - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at C:\Users\alex\.rustup\toolchains\esp\lib\rustlib\src\rust\library\core\src\ops\function.rs:283
0x400D4DCC - std::rt::lang_start
at C:\Users\alex\.rustup\toolchains\esp\lib\rustlib\src\rust\library\std\src\rt.rs:165
0x400D4D2F - main
at ??:??
0x400D5787 - app_main
at C:\Users\alex\.cargo\registry\src\github.com-1ecc6299db9ec823\esp-idf-sys-0.31.10\src\start.rs:46
0x40116A00 - main_task
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/freertos/port\port_common.c:141
E (5681) task_wdt: Print CPU 1 backtrace
Backtrace:0x40084C71:0x3FFB12A00x4008344D:0x3FFB12C0 0x4000BFED:0x3FFB7710 0x40088312:0x3FFB7720 0x40107C17:0x3FFB7740 0x40107C23:0x3FFB7770 0x401032EA:0x3FFB7790 0x40086AFC:0x3FFB77B0
0x40084C71 - esp_crosscore_isr
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/esp_system\crosscore_int.c:92
0x4008344D - _xt_lowint1
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/freertos/port/xtensa\xtensa_vectors.S:1111
0x4000BFED - _xtos_set_intlevel
at ??:??
0x40088312 - vPortClearInterruptMaskFromISR
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/freertos/port/xtensa/include/freertos\portmacro.h:571
0x40107C17 - esp_task_wdt_reset
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/esp_system\task_wdt.c:330
0x40107C23 - idle_hook_cb
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/esp_system\task_wdt.c:80
0x401032EA - esp_vApplicationIdleHook
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/esp_system\freertos_hooks.c:51
0x40086AFC - prvIdleTask
at C:\Users\alex\src\espap\target\xtensa-esp32-espidf\debug\build\esp-idf-sys-be5c862fbac50229\out\build\C:/Espressif/esp-idf-ae062fbba3ded0aa/v4.4.2/components/freertos\tasks.c:3973
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment