Skip to content

Use GPIO expander

Driving an e-paper display through the EXT3 extension board requires a minimum of 8 signals, and up to 18 signals with touch, SD-card and external memory.

Signal Minimal Touch Optional
Power +3.3V, Ground
SPI bus Clock, Data in Data out
Panel Select, Reset, Busy, Data/Command Second select
Flash Select, Second select
SD-card Select, Detect
I²C bus Clock, Data
Touch Reset, Interrupt
Total 8 4 6

Large screens require a Panel:Second select signal. The Flash:Select signal drives the external SPI Flash memory populated on the EXT3.1 extension board. The Flash:Second select signal drives the optional external SPI Flash or SRAM on the EXT3.1 extension board.

Seven signals are shared: Power, SPI and I²C buses.

If the MCU doesn’t offer enough GPIOs, up to eight signals can be relayed by an expander, driven through the existing SPI or I²C bus.

Signal Direct Expander
Power +3.3V, Ground
SPI bus Clock, Data in, Data out
Panel Busy Select, Reset, Data/Command, Second select
Flash Select, Second select
I²C bus Clock, Data
SD-card Detect Select
Touch Interrupt Reset
Total 10 8

Only three signals remain connected to the MCU as inputs: Panel:Busy, Touch:Interrupt and SD-card:Detect.

Configure

The option for using a GPIO expander is set on the configuration header file.

#define EXPANDER_MODE USE_I2C_PCF8574 ///< Selected option

By default, the EXPANDER_MODE parameter is set to USE_EXPANDER_NONE. It needs to be set to one of the supported expanders, for example USE_I2C_PCF8574 for the I² PCF8574 with 8 ports.

Depending on the option, the GPIO expander adds up to 8 GPIOs labelled EXPANDER_P0 to EXPANDER_P7.

Use them into the definition of the main controller board as normal GPIOs for outputs. However, it is recommended to keep MCU GPIOs for inputs.

const pins_t boardLaunchPadExpander =
{
    .panelBusy = 6, // input
    .panelDC = EXPANDER_P0,
    .panelReset = EXPANDER_P1,
    .flashCS = EXPANDER_P2,
    .panelCS = EXPANDER_P3,
    .panelCSS = NOT_CONNECTED,
    .flashCSS = NOT_CONNECTED,
    .touchInt = 8, // input
    .touchReset = EXPANDER_P4,
    .cardCS = NOT_CONNECTED,
    .cardDetect = NOT_CONNECTED, // input
};

Use

Screen_EPD_EXT3_Fast myScreen(eScreen_EPD_271_CS_09,
    boardLaunchPadExpander);

The declaration and initialisation of the screen use the new board definition boardLaunchPadExpander as parameter in the constructor according to the configuration procedure.