SSD1306 with SPI1 on Espruino Wifi

Posted on
  • @Gordon, I'll return to the ESP8266 thread soon-ish, and respond to your last question. Thanks for the help. For now I'm making use of the Espruino Wifi so I can ignore the ESP issue.

    I got some of these: adafruit.com/product/661 SSD1306 displays. I can't get them working using SPI on my Espruino Wifi. I've tried a variety of connection arrangements. It should be simple but it seems every page has different instructions. I was using the table labeled "SPI" at the top of this page, but I now conclude it must be wrong: espruino.com/SSD1306

    Table says: D0/SCK/SCLK => B5

    I assume B5 means SPI1 MOSI (like Pico or Espruino Board). Why would I connect clock to master out / slave in?

    So I'm reading the pins from this table according to the Pico pinout, checking if it makes sense, and connecting to the A pins for the same function on the Espruino Wifi. If they don't make sense, I'm trying to connect like pins to like pins. From what I see online, MOSI goes to MOSI, SCK goes to SCK, etc.

    GND => `GND`
    3.3V => `3.3V`
    CLK => `A5` (`A5` = `SPI1 SCK`, a.k.a. `clock`)
    DATA => `A7` (D1/MOSI/SDIN = `DATA`? `DATA` = MOSI? `A7` = `SPI1 MOSI`)
    DC => `A1` (Internet says any GPIO, and `A8` is inaccessible. Assuming DC = `D/C`)
    RST => `A0` (Internet says any GPIO, and `B7` is not an A pin)
    CS => `GND`
    
    

    Because all the example snippets I find use software SPI, so do I. Here's my test code that doesn't work:

    function start(){
      g.on();
      // write some text
      g.drawString("Hello World!",2,2);
      // write to the screen
      g.flip(); 
    }
    
    // SPI
    var s = new SPI();
    s.setup({mosi:A7, sck:A5});
    
    var g = require("SSD1306").connectSPI(s, A1/*DC*/, A0/*RST*/, start, { height : 32 });
    
  • The example does say it's using software SPI as well - so the fact that B5/B6 are swapped doesn't matter as it's not using the underlying hardware.

    What you've got looks ok - but can you remove g.on();? That function was added recently and shouldn't be needed since the display will already be on.

    Can you also try adding g.fillRect(0,0,128,32) before g.flip()? It's possible that the display is doing something but the pixels are all offset so the text doesn't appear.

    I'm pretty sure I've seen people use that Adafruit display before, so I'm not sure what the issue could be.

    Please could you also try s.setup({mosi:A7,miso:A6,sck:A5});

    Software SPI is actually pretty fast, and the WiFi's chip is faster than the Pico's. It could be it's driving the display too quickly! Making it read from a pin as well as writing should slow it down.

    Perhaps you could try using hardware SPI as well? Just in case, as that will be better at lower speed stuff.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

SSD1306 with SPI1 on Espruino Wifi

Posted by Avatar for CriscoCrusader @CriscoCrusader

Actions