Skip to content

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

Open
@gvdl

Description

@gvdl

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions