epd-waveshare
epd-waveshare copied to clipboard
epd2in13_v4 support?
Hello,
I have a new e-paper HAT (which I believe is EPD 2.13" V4) -- which the documentation claim is compatible with the V3 (but has a fast refresh feature):
(Ref: https://www.waveshare.com/wiki/2.13inch_Touch_e-Paper_HAT_Manual#Version_Description)
However, when attempting to run the epd2in13_v2 example (with the epd2in13_v3 feature enabled) on the new board I'm running into several problems.
The first is PIN configuration. I attempted to update the epd2in13_v2 example to use the pins listed here:
(Ref: https://www.waveshare.com/wiki/2.13inch_Touch_e-Paper_HAT_Manual#Hardware_Connection)
However this results in an "invalid argument" error just naively using the pin numbers. Some references online suggest that there may be an offset for enabling/exporting GPIO pins? Using this information I was able to find that my GPIO device has an offset of 512:
$ cat /sys/class/gpio/gpiochip512/base
512
This avoids the "invalid argument" errors and the example runs, but nothing is displayed on the epd2in13_v4 device:
iff --git a/examples/epd2in13_v2.rs b/examples/epd2in13_v2.rs
index b3cb64e..cff6c88 100644
--- a/examples/epd2in13_v2.rs
+++ b/examples/epd2in13_v2.rs
@@ -36,25 +36,25 @@ fn main() -> Result<(), SPIError> {
spi.configure(&options).expect("spi configuration");
// Configure Digital I/O Pin to be used as Chip Select for SPI
- let cs = SysfsPin::new(26); //BCM7 CE0
+ let cs = SysfsPin::new(512 + 24);
cs.export().expect("cs export");
while !cs.is_exported() {}
cs.set_direction(Direction::Out).expect("CS Direction");
cs.set_value(1).expect("CS Value set to 1");
- let busy = SysfsPin::new(24); // GPIO 24, board J-18
+ let busy = SysfsPin::new(512 + 18);
busy.export().expect("busy export");
while !busy.is_exported() {}
busy.set_direction(Direction::In).expect("busy Direction");
//busy.set_value(1).expect("busy Value set to 1");
- let dc = SysfsPin::new(25); // GPIO 25, board J-22
+ let dc = SysfsPin::new(512 + 22);
dc.export().expect("dc export");
while !dc.is_exported() {}
dc.set_direction(Direction::Out).expect("dc Direction");
dc.set_value(1).expect("dc Value set to 1");
- let rst = SysfsPin::new(17); // GPIO 17, board J-11
+ let rst = SysfsPin::new(512 + 11);
rst.export().expect("rst export");
while !rst.is_exported() {}
rst.set_direction(Direction::Out).expect("rst Direction");
Do you have any advice on how I can debug things further. Does this offset thing even make sense? I'm happy to do the work to update the library to work with the device, but some pointers on where to start would be very helpful. Thank you!