ssd1331
ssd1331 copied to clipboard
Example code for the Adafruit ESP32
I've been struggling to use the driver with an Adafruit Feather ESP32 MCU for a few days. Could you give me a pointer for this pinout diagram? I'd happily PR an example once I verify it works.

Hey there, this display uses SPI so it looks like you'll need to use the pins labelled SCK/MOSI/MISO (pins 5, 18 and 19 respectively in the image you posted). The Adafruit docs also mention this. The reset and DC pins can be any other pin your like, as they're just GPIOs.
Thanks! I'll give that a try. Closing this for now.
I attempted to get this working, but I'm getting this error when create a new instance of the driver:
let peripherals = Peripherals::take().unwrap();
let spi = peripherals.spi2;
let dc = PinDriver::output(peripherals.pins.gpio26)?;
let mut rst = PinDriver::output(peripherals.pins.gpio25)?;
let sclk = peripherals.pins.gpio5;
let sda = peripherals.pins.gpio23;
let sdi = peripherals.pins.gpio8;
let cs = peripherals.pins.gpio10;
let mut delay = Ets;
let config = Config::new().baudrate(24.MHz().into());
let device =
SpiDeviceDriver::new_single(spi, sclk, sda, Some(sdi), Dma::Disabled, Some(cs), &config)?;
let mut display = Ssd1331::new(device, dc, Rotate0); // Exception triggers on this line
I (0) cpu_start: Starting scheduler on APP CPU.
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x40082e9d PS : 0x00060c33 A0 : 0x80082f5c A1 : 0x3ffb2c20
0x40082e9d - heap_caps_malloc_base
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/heap/heap_caps.c:135
A2 : 0x00000054 A3 : 0x00001800 A4 : 0x3ffb2e78 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000005 A8 : 0x3ffb2d40 A9 : 0x3ffb2d10
A10 : 0x3ffb0214 A11 : 0xffffffff A12 : 0x00000004 A13 : 0x00000000
A14 : 0x00000005 A15 : 0x00000001 SAR : 0x00000010 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000021 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
0x4000c2e0 - memcpy
at ??:??
0x4000c2f6 - memcpy
at ??:??
Backtrace: 0x40082e9a:0x3ffb2c20 0x40082f59:0x3ffb2c50 0x40082f86:0x3ffb2c70 0x4008acf1:0x3ffb2c90 0x40085c39:0x3ffb2cb0 0x40085ed8:0x3ffb2cd0 0x40083ce4:0x3ffb2cf0 0x40083d12:0x3ffb2d10 0x40083e79:0x3ffb2d40 0x401074a2:0x3ffb2d60 0x401067c7:0x3ffb2d80 0x4010645d:0x3ffb2da0 0x4000bd83:0x3ffb2dc0 0x4000117d:0x3ffb2de0 0x400592fe:0x3ffb2e00 0x4005937a:0x3ffb2e20 0x40058bbf:0x3ffb2e40 0x4010a34f:0x3ffb2e70 0x4010a3b1:0x3ffb2eb0 0x400d4eab:0x3ffb2ed0 0x400d4e8a:0x3ffb2ef0 0x400ffa05:0x3ffb2f10 0x400d4e23:0x3ffb2f60 0x400d4fba:0x3ffb2fa0 0x400d569d:0x3ffb3020 0x400d4a04:0x3ffb3090 0x4011789b:0x3ffb60e0 0x400d4918:0x3ffb6100 0x400d8ba2:0x3ffb6120 0x400d4908:0x3ffb6150 0x400d4b33:0x3ffb6180 0x400d552f:0x3ffb61a0 0x40118824:0x3ffb61c0
0x40082e9a - heap_caps_malloc_base
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/heap/heap_caps.c:110
0x40082f59 - heap_caps_malloc
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/heap/heap_caps.c:174
0x40082f86 - heap_caps_malloc_default
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/heap/heap_caps.c:199
0x4008acf1 - malloc
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/newlib/heap.c:24
0x40085c39 - xQueueGenericCreate
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/freertos/queue.c:447
0x40085ed8 - xQueueCreateMutex
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/freertos/queue.c:564
0x40083ce4 - lock_init_generic
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/newlib/locks.c:73
0x40083d12 - lock_acquire_generic
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/newlib/locks.c:127
0x40083e79 - _lock_acquire_recursive
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/newlib/locks.c:167
0x401074a2 - uart_write
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/vfs/vfs_uart.c:200
0x401067c7 - console_write
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/vfs/vfs_console.c:73
0x4010645d - esp_vfs_write
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/vfs/vfs.c:431
0x4000bd83 - roundup2
at ??:??
0x4000117d - __swrite
at ??:??
0x400592fe - __sflush_r
at ??:??
0x4005937a - _fflush_r
at ??:??
0x40058bbf - __sfvwrite_r
at ??:??
0x4010a34f - _fwrite_r
at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/fwrite.c:137
0x4010a3b1 - fwrite
at /builds/idf/crosstool-NG/.build/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/fwrite.c:177
0x400d4eab - <esp_idf_svc::log::EspStdout as core::fmt::Write>::write_str
at /home/jose/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-svc-0.45.0/src/log.rs:19
0x400d4e8a - <&mut W as core::fmt::Write>::write_str
at /home/jose/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:199
0x400ffa05 - core::fmt::write
at /home/jose/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:1233
0x400d4e23 - core::fmt::Write::write_fmt
at /home/jose/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/fmt/mod.rs:192
0x400d4fba - <esp_idf_svc::log::EspLogger as log::Log>::log
at /home/jose/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-svc-0.45.0/src/log.rs:163
0x400d569d - log::__private_api_log
at /home/jose/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.17/src/lib.rs:1597
0x400d4a04 - hello_esp::main
at /home/jose/Code/hello-esp/src/main.rs:54
0x4011789b - core::ops::function::FnOnce::call_once
at /home/jose/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/ops/function.rs:251
0x400d4918 - std::rt::lang_start::{{closure}}
at /home/jose/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:166
0x400d8ba2 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /home/jose/.rustup/toolchains/esp/lib/rustlib/src/rust/library/core/src/ops/function.rs:286
0x400d4908 - std::rt::lang_start
at /home/jose/.rustup/toolchains/esp/lib/rustlib/src/rust/library/std/src/rt.rs:165
0x400d4b33 - main
at ??:??
0x400d552f - app_main
at /home/jose/.cargo/registry/src/github.com-1ecc6299db9ec823/esp-idf-sys-0.32.1/src/start.rs:46
0x40118824 - main_task
at /home/jose/Code/hello-esp/.embuild/espressif/esp-idf/release-v4.4/components/freertos/port/port_common.c:141
```
Hey, I'm afraid this is beyond me as I don't use ESPs. I've posted a link to this issue in the ESP RS Matrix room which will hopefully get some attention.
@jfernandez Could you please post this against https://github.com/esp-rs/esp-idf-hal instead? If possible, could you link your project (if its open source), along with compiler versions etc, thanks!