rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
315 stars 70 forks source link

Newbie: No signs of life from SSD1306 atmega32u4 SPI 128x64 #170

Closed alexmadeathing closed 1 year ago

alexmadeathing commented 1 year ago

Description of the problem/feature request/other

I'm unable to get any signs of life from my display.

I've tried multiple 128x64 and 128x32 displays, so I don't think the display is dead.

My wiring is as follows:

    GND                -> Display CS
    VCC                -> Display RES
    Pro Micro 15 (PB1) -> Display CLK (D0)
    Pro Micro 16 (PB2) -> Display MOSI (D1)
    Pro Micro 3        -> Display DC

My code is as follows:

    let spi = dp.SPI;
    let dc = pins.d3.into_output();
    let sclk = pins.sck.into_output();
    let mosi = pins.mosi.into_output();
    let miso = pins.miso.into_pull_up_input(); // Not wired
    let cs = pins.led_rx.into_output(); // Not wired, display RES wired to VCC

    let spi_settings = Settings {
        data_order: DataOrder::MostSignificantFirst,
        clock: SerialClockRate::OscfOver4,
        mode: spi::MODE_1,
    };

    let (spi, cs) = Spi::new(
        spi,
        sclk,
        mosi,
        miso,
        cs,
        spi_settings,
    );

    let spi_interface = SPIInterface::new(spi, dc, cs);

    let mut display = Ssd1306::new(
        spi_interface,
        DisplaySize128x64,
        DisplayRotation::Rotate0,
    ).into_buffered_graphics_mode();
    display.init().unwrap();

    let text_style = MonoTextStyleBuilder::new()
        .font(&FONT_6X10)
        .text_color(BinaryColor::On)
        .build();

    Text::with_baseline("Hello world!", Point::zero(), text_style, Baseline::Top)
    .draw(&mut display)
    .unwrap();

    Text::with_baseline("Hello Rust!", Point::new(0, 16), text_style, Baseline::Top)
        .draw(&mut display)
        .unwrap();

    display.flush().unwrap();

Any ideas?

alexmadeathing commented 1 year ago

Ok, I've got a panic somewhere... I really need to work out how to enable debugging on this thing

alexmadeathing commented 1 year ago

I'm going to close this issue as I don't think it's relevant to your library.