Wrong pins on sh1106 spi example
See original GitHub issueBeen trying for 2h+, and finally discovered the SPI wiring pins on the comments are wrong.
Instructions goes as (wrong): ` Sample code sections ------------ SPI ------------------ Pin Map SPI
- 3v - xxxxxx - Vcc
- G - xxxxxx - Gnd
- D7 - GPIO 13 - Din / MOSI fixed *1
- D5 - GPIO 14 - Clk / Sck fixed *2
- D8 - GPIO 4 - CS (optional, if the only connected device)
- D2 - GPIO 5 - D/C
- D1 - GPIO 2 - Res `
But only works if you use (right): ` Pin Map SPI
- GPIO 11 - Din / MOSI fixed *1
- GPIO 10 - Clk / Sck fixed *2 `
Also may include a suggestion to use a logic level adapter, because there are 5v sh1106 displays.
Link to photo of working set, also using lg. lvl. adap. 5v
The mistake is located at: https://github.com/raspberrypi/pico-micropython-examples/blob/master/i2c/1106oled/sh1106.py
Thanks 4 the great work.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Trouble connecting to SPI display sh1106
I was able to get external OLED displays working with a Heltec wifi ESP8266 over SPI with SH1106 as follows: from machine import...
Read more >SH1106 SPI Displays not turning on at all - Arduino Forum
I've diligently connected CLK to 13, MOSI to 11, CS to 10, DC to 9, and RES to the 8 pins of my...
Read more >Sh1106 SPI in Breakout Garden - can't get it working
I've installed the software as described: sudo pip install git+git://github.com/rm-hull/luma.oled.git#egg=luma.oled but can't get the bounce ...
Read more >Recalcitrant SH1106 OLED [Solved: SCK & MOSI were ...
Then I realized the bootloader menu configured hardware SPI which I had to turn off (SPCR = 0) for bitbanging the SPI pins...
Read more >Teensy 3.x and SH1106 OLED via SPI
Note: the CS pin on the OLED is attached to a 10k resistor which is not ... a bit more about SPI and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
About the suggestion of note on 5V devices. That’s not needed since:
ping @robert-hh (whose name appears in
sh1106.py
)Took me a little while to figure out what was going on here, as https://github.com/raspberrypi/pico-micropython-examples/tree/master/i2c/1106oled only shows an I2C wiring-example. But then I figured out that this issue is referring to the code comments in sh1106.py rather than any actual example code? So then I managed to figure out that the SPI pins used are actually “allocated” by the line:
# spi = SPI(1, baudrate=1000000)
. So then I found up https://github.com/micropython/micropython/blob/master/ports/rp2/machine_spi.c#L44 which confirms that for SPI interface 1, the default MOSI pin used by MicroPython is GPIO11 and the default SCK pin is GPIO10.Which matches up with what @Garfius has written above 😁
I’ll give it a couple of days to see if Robert responds, and if he doesn’t I’ll fix up the SPI-related pin-number code-comments in https://github.com/raspberrypi/pico-micropython-examples/blob/master/i2c/1106oled/sh1106.py myself 🙂