Expand description

LCD interface using the Flexible Memory Controller (FMC) / Flexible Static Memory Controller (FSMC)

This module is only available if the fsmc_lcd feature is enabled and the target microcontroller has an FMC or FSMC

This driver is compatible with many LCD driver chips that support the Intel 8080 interface (also called Display Bus Interface (DBI) type B) with a 16-bit data bus.

Here are some examples of compatible LCD drivers:

  • Sitronix ST7735S
  • Sitronix ST7789VI
  • Ilitek ILI9327
  • Ilitek ILI9320
  • Himax HX8357-B

Higher-level driver code can add support for specific LCD driver integrated circuits.

For an overview of how this interface works, see application note AN2790.

Pins

To interface with 1-4 LCDs, you will need:

  • 16 data pins (0 through 15), shared among all the LCDs
  • One NEx (chip select) pin per LCD (up to 4)
  • One Ax (address) pin, shared among all the LCDs. This pin is used to select data or command mode.
    • You can also supply up to 4 address pins, but they will always have the same output.
    • Caution: Due to hardware limitations, address line A25 cannot be used.
  • One NOE (read enable) pin, shared among all the LCDs
  • One NWE (write enable) pin, shared among all the LCDs

Timing

Because the correct timing depends on the specific LCD controller and the wiring between the microcontroller and LCD controller, this driver does not try to calculate the correct timing settings. Instead, it exposes the access modes and timing options that the STM32F4 hardware supports.

The default access mode is mode C. For an example timing diagram, refer to reference manual RM0090, figures 443 and 444 (on page 1562), or your microcontroller reference manual.

Access modes A, B, and D are also supported.

Basic operation

  1. Create an LcdPins object containing the pins used to communicate with the LCD

  2. Create default Timing objects for the write and read timing

    a. (Optional) Adjust the timing to make read and write operations faster, within the limits of the wiring and LCD controller

  3. Pass the FSMC peripheral object, pins, read timing, and write timing to FsmcLcd::new. This function will return an FsmcLcd and one or more Lcd objects.

  4. Use the returned Lcd object(s) to configure the controller(s) and display graphics

Structs

Wrapper for a pin that implements PinChipSelect1

Wrapper for a pin that implements PinChipSelect2

Wrapper for a pin that implements PinChipSelect3

Wrapper for a pin that implements PinChipSelect4

An FMC or FSMC configured as an LCD interface

An interface to an LCD controller using one sub-bank

A set of pins used to interface with an LCD

Sub-bank 1

Sub-bank 2

Sub-bank 3

Sub-bank 4

Timing configuration for reading or writing

Enums

Memory access modes

Traits

One, two, three, or four address pins

One, two, three, or four chip select pins

A set of data pins

A pin that can be used as one bit of the memory address

A pin that can be used to enable a memory device on sub-bank 1

A pin that can be used to enable a memory device on sub-bank 2

A pin that can be used to enable a memory device on sub-bank 3

A pin that can be used to enable a memory device on sub-bank 4

A pin that can be used for data bus 0

A pin that can be used for data bus 1

A pin that can be used for data bus 2

A pin that can be used for data bus 3

A pin that can be used for data bus 4

A pin that can be used for data bus 5

A pin that can be used for data bus 6

A pin that can be used for data bus 7

A pin that can be used for data bus 8

A pin that can be used for data bus 9

A pin that can be used for data bus 10

A pin that can be used for data bus 11

A pin that can be used for data bus 12

A pin that can be used for data bus 13

A pin that can be used for data bus 14

A pin that can be used for data bus 15

A pin that can be used for the output enable (read enable, NOE) signal

A pin that can be used for the write enable (NOE) signal

A set of pins that can be used with the FSMC

A sub-bank of bank 1, with its own chip select output