micropython / micropython/micropython-lib

ssd1306 might need to send SET_IREF_SELECT(0xad) <-- 0x30 during init_display.

Open
#1,025 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.9k
Forks
1.1k
Avg merge
7d 6h
Merged PRs (30d)
3

Description

G'day, All.

I have been trying to find some solid evidence of this but have not managed to find a data sheet with the command. Given that I haven't found any solid evidence I'm not sure if this is a real issue or not.

I recently downloaded a ssd1306 micropython from the Sunfounder website and then I looked at Peter Hinch's micro python-nano-gui and saw a difference between the two drivers.

Specifically their init_display() method has one extra command, the SET_IREF_SELECT, 0x30. As I said this new command is NOT mentioned in the 2008 Solomon ssd1306 chip data sheet and I have been unable to find any other reference in any newer data sheet. But both the Sunfounder and Adafruit drivers do set this. I did find one discussion while googling around that this field clears up a flicker problem for atleast one person.

I'm happy to create a pull request for this myself. if you feel it is a good idea to pick up the change. My issue is I only have a few cheap knockoff ssd1306 so I'm not sure how thoroughly I can test the change.

SET_IREF_SELECT = const(0xAD)
...
    def init_display(self):
        for cmd in (
            SET_DISP,  # display off
            # address setting
            SET_MEM_ADDR,
            0x00,  # horizontal
            # resolution and layout
            SET_DISP_START_LINE,  # start at line 0
            SET_SEG_REMAP | 0x01,  # column addr 127 mapped to SEG0
            SET_MUX_RATIO,
            self.height - 1,
            SET_COM_OUT_DIR | 0x08,  # scan from COM[N] to COM0
            SET_DISP_OFFSET,
            0x00,
            SET_COM_PIN_CFG,
            0x02 if self.width > 2 * self.height else 0x12,
            # timing and driving scheme
            SET_DISP_CLK_DIV,
            0x80,
            SET_PRECHARGE,
            0x22 if self.external_vcc else 0xF1,
            SET_VCOM_DESEL,
            0x30,  # 0.83*Vcc
            # display
            SET_CONTRAST,
            0xFF,  # maximum
            SET_ENTIRE_ON,  # output follows RAM contents
            SET_NORM_INV,  # not inverted
            SET_IREF_SELECT,
            0x30,  # enable internal IREF during display on
            # charge pump
            SET_CHARGE_PUMP,
            0x10 if self.external_vcc else 0x14,
            SET_DISP | 0x01,  # display on
        ):  # on
            self.write_cmd(cmd)
        self.fill(0)
        self.show()

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the SSD1306 driver’s init_display() entry point and compare its command sequence with the Sunfounder and Adafruit drivers cited in the issue. Verify SET_IREF_SELECT and 0x30 against reliable SSD1306 documentation and available hardware evidence. Done means establishing whether the command is required and documenting a clear decision, with validation on compatible displays if a change is justified.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.