Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    [SOLVED] SSD1306 with SPI?

    Scheduled Pinned Locked Moved WiPy 2&3
    wipyspissd1306lcd
    8 Posts 3 Posters 3.3k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O Offline
      Olias
      last edited by ficofer

      Hi,

      It appears the ssd1306 driver (https://github.com/micropython/micropython/blob/master/drivers/display/ssd1306.py) isn't working for WiPy. I've had to modify the driver to change pin.high() -> pin.value(1) and pin.low() -> pin.value(0) but clearly there is something else going on.

      I have an Adafruit 128x32 OLED SSD1306 display wired to my WiPy 2.0 (via Expansion Board) as follows:

      WiPy->SSD1306
      P5->D/C
      P6->RST
      P7->CS
      P10->CLK
      P11->DATA
      3V3->VIN
      GND->GND

      This is the code I am using to test. I get nothing - no errors, nothing on the screen. Is it wired correctly? Something else messed up?

      from machine import SPI, Pin
      from ssd1306 import SSD1306_SPI as ssd
      spi = SPI(0, SPI.MASTER, baudrate=100000, polarity=0, phase=0)
      o = ssd(128,32,spi,Pin('P5'),Pin('P6'),Pin('P7'))
      o.fill(1)
      o.show()

      The OLED is good as I've used it with the Pyboard and it works. Just not with the WiPy.

      I may be able to figure out what is wrong with the driver if I had a working SPI driver to compare. Anyone know of an SPI that actually works with the WiPy? Of any kind?

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jmarcelino @Olias
        last edited by

        @Olias said in SSD1306 with SPI?:

        P12->DATA

        DATA should be connected to MOSI which is P11

        sorenS 1 Reply Last reply Reply Quote 0
        • O Offline
          Olias
          last edited by

          Yep, tried that too. Still doesn't work. Have verified it (still) works with Pyboard.

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jmarcelino @Olias
            last edited by

            @Olias
            It does work for me but I use different pins than yours as I don't own any WiPy and on the SiPy/LoPy the signalling pins you use are reserved.

            I setup mine as disp = ssd(128,32,spi,Pin('P9'),Pin('P8'),Pin('P22'))

            0_1500679433061_IMG_2566.jpg

            O sorenS 2 Replies Last reply Reply Quote 0
            • O Offline
              Olias @jmarcelino
              last edited by

              @jmarcelino

              Hi,

              Thanks for the tip and confirming it works! I have fixed the problem by upgrading the firmware to 1.9.1 and it fixed the problem. Aaahhh...better. :)

              Chuck

              1 Reply Last reply Reply Quote 0
              • sorenS Offline
                soren @jmarcelino
                last edited by

                @jmarcelino is it totally out of the question to use pin 5, 6 and 7 for any I/O purpose at all?

                1 Reply Last reply Reply Quote 0
                • sorenS Offline
                  soren @jmarcelino
                  last edited by

                  @jmarcelino i was thinking more generally, using P5, 6 and 7 on a LoPy - if it is OK to use these pins? On the official pinout sheet, they have exclamation marks and no pin names like the rest.. but it seems to work when I control an LED with one of them, I just had some strange behaviour while trying to use a color sensor

                  J 1 Reply Last reply Reply Quote 0
                  • J Offline
                    jmarcelino @soren
                    last edited by

                    @soren
                    Those pins are connected to the LoRa chip (SX1272) using SPI so you may see unexpected behaviour

                    1 Reply Last reply Reply Quote 1

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • 1 / 1
                    • First post
                      Last post

                    Pycom on Twitter

                    Pycom