Microchip Graphics Suite (MGS) External Controller Driver User Guide

Last modified by Microchip on 2024/05/28 10:58

Introduction

Microchip Graphics Suite (MGS) Harmony provides an External Controller Driver generator that can be used to generate a base driver for most smart display modules that have onboard display controllers. 

Display Controller Requirements

The External Controller Driver generator may be able to generate a custom driver for external controllers that have the following features:

  • Use 4-line Serial Peripheral Interface (SPI) or parallel 8080 (16- or 8-bit).
  • Use [command] + [data] writes for setup and frame data.
  • Write frame data using column/row addressing.
  • Support 16-bit RGB565 color mode.

Example External Controller Initialization Command and Pixel Data Write

Examples of these controllers are the ILI9488, SSD1963, ST7796s and SSD1351.

For other display controllers, the driver generator can be used to create a stub or skeleton driver that needs to be completed by the user.

MCC Harmony Project Graph

The accompanying image shows typical project graphs for MPLAB® Code Configurator (MCC) Harmony projects that use the External Controller Driver generator.

SAME54 Project Graph for parallel 8080

SAME54 Curiosity Ultra + maXTouch® Curiosity Pro display with 8-bit parallel 8080

SAME54 Project Graph for 4-line SPI

SAME54 Curiosity Ultra + maXTouch Curiosity Pro display with 4-line SPI

The main components for the display driver interface include:

  1. External Controller Driver
    • Driver generator for the external controller
  2. Display Interface Driver
    • Interface-specific driver (4-line or parallel 8080)
  3. Peripheral Driver and Library

Back to Top

Driver Configuration

External Controller Driver

Here are the main configuration options for the External Controller Driver Generator component.

External controller configuration options

Configuration OptionDescriptionSub-optionsDescription
Base Driver

Configures the driver generator for commonly used external controllers like the ILI9488, SSD1963 or SSD1309 as a starting point.

Select a base driver if the target external controller works like one of these controllers. Otherwise, select custom to fully customize the driver generator.

Controller NameSet to target controller name. This will be used as part of the function names in the generated code.
Display Interface TypeSpecify the display interface - 4-line SPI or parallel 8080.
Passive Driver?

Set to generate a passive driver. A passive driver will only send the initialization commands. It will not attach to the graphics library and will not write pixel data to the display controller.

Display SettingsConfigures the resolution of the display. These settings must match the size specified in the GFX Core LE Component.WidthThe width of the display in pixels.
HeightThe height of the display in pixels.
Reset SettingsDriver options for driving the reset pin to the external controller.Enable Reset?Enabling Reset will generate code that will toggle (active low) the reset pin to the device. The reset pin must be defined in the Pin Settings as GFX_DISP_INTF_PIN_RESET.
Pre Reset Delay(ms)The delay added before the reset signal is pulled low (deasserted). Set this to create a delay between pin control and reset. If 0, the deassart will not be generated.
Reset Duration (ms)The duration of the active low reset signal.
Post Reset Delay(ms)The delay added after the reset signal is pulled high (deasserted). Set this to create a delay between controller reset and initialization.
Initialization SettingsDriver options for writing the initialization commands to the external controller.Use D/C pin for Command Parameters

Configure D/C pin control during initialization.

If TRUE, D/C = 0 when command is being written, and D/C = 1 when parameters are being sent.

If FALSE, D/C = 0 while initialization command and parameters are being sent.

Max Number of Commands

Maximum number of initialization commands. This value is hardcoded.

If more commands are needed, set 'numCommands' in gfx\middleware\legato\driver\controller\external_controller\config\controller.py.

More commands will cause component to load longer in MHC.

Max Number of Parameters

Maximum number of parameters per command. 

If more parameters are needed, set 'numParms' in gfx\middleware\legato\driver\controller\external_controller\config\controller.py. 

More parameters will cause component to load longer in MHC. 

Number of Init Commands

The number of initialization commands to generate.

CMD[x]Value of command in hex.
CommentDescription of command. Will be added as a code comment above the command.
Delay (ms)Delay before next command. 
Number of ParametersNumber of parameters for command.
PARM[y]Value of parameter in hex.
Blit Buffer Function SettingsDriver options for writing the frame buffer data to the external controller.Blit Buffer Function Generation Mode

Set to generate a blit buffer function. This function is called by the library to write a subsection of the frame to the display controller".

Use Bulk Write will generate a function that sets the UL and LR points of the subframe, then write the pixel data in burst.

Stub will generate an empty blit function or a predefined blit function for the base driver, if applicable. 

  Blit Transfer Type

Set the blit transfer type:

Synchronous - blocking transfer. The blit function will block until the buffer is completely written to the display.

Driver Asynchronous - non-blocking transfer. The blit function will not block, and will return immediately. Buffer blits will be managed thru the display driver task. Interface driver must be non-blocking.

Interface Asynchronous - non-blocking transfer. The blit function will not block, and will return immediately. Buffer blits will be managed by the display interface, thru the interface callback. Make sure that the interface driver is non-blocking.

  Pixel Data Settings

Driver options for the pixel data size and format

Pixel FormatPixel Format (RGB565)
Pixel Data Write Size (bits)

Size of data bus in bits.

16 - Data0[15:0] = [r4|r3|r2|r1|r0|g5|g4|g3|g2|g1|g0|b4|b3|b2|b1|b0]

- refer to Pixel Data Transfer Size below.

Pixel Data Transfer Size (Bytes)

Number of bytes to transfer pixel data thru 8-bit data bus.

'2 (Normal)' will transfer upper byte first."

Data0[7:0] = [r4|r3|r2|r1|r0|g5|g4|g3], Data1[7:0] = [g2|g1|g0|b4|b3|b2|b1|b0]

'2 (Little-Endian)' will transfer lower byte first"

Data0[7:0] = [g2|g1|g0|b4|b3|b2|b1|b0], Data1[7:0] = [r4|r3|r2|r1|r0|g5|g4|g3]

'3' will transfer each color in separate bytes (3)

Data0[7:0] = [r4|r3|r2|r1|r0|x|x|x], Data1[7:0] = [g5|g4|g3|g2|g1|g0|x|x], Data2[7:0] = [b4|b3|b2|b1|b0|x|x|x]

  X/Y Address SizeThe size of the X and Y coordinates of the address in the frame where the buffer will be written to.
  Set Column/X Command

The command sent to the controller to write the column or X address.

OffsetX offset
  Set Page/Y Command

The command sent to the controller to write the page or Y address.

OffsetY offset
  Memory Write CommandThe command sent to the controller to start the memory write operation.

Back to Top

Usage Example

The accompanying image shows an example driver configuration that will toggle the reset signal and send the initialization commands and write the pixel data based on the display parameters specified on the right side of the diagram.

External Controller configuration example

Back to Top

Display Interface Driver

The display interface driver provides an abstraction for the actual interface and peripheral used by the external controller driver. 

Back to Top

4-line SPI Interface

The 4-line SPI interface driver talks to the Harmony Core SPI driver to write the initialization commands and pixel data through the SPI peripheral. The 4-line SPI interface driver provides the following configuration options.

Configuration OptionDescription
SPI IndexThe Core SPI Instance number
Transfer Mode Settings

Options for the blit buffer write

BlockingBuffer write API calls will block
SPI Speed in HzConfiguration options for Core SPI instance
SPI Clock Phase Valid Edge Detect
SPI Clock Polarity
Data Bits
Chip Select Polarity

Back to Top

Parallel 8080 Interface

The configuration options for the parallel 8080 interface driver are unique to the underlying parallel port peripheral used to communicate with the external display controller. Refer to the user guide or quickstart application example for the target device being used for more information.

Back to Top

Peripheral Driver and Library

The configuration options for the peripheral driver and library are unique to the underlying parallel port peripheral used to communicate with the external display controller. Refer to the user guide or quickstart application example for the target device being used for more information.

Back to Top

Generated Code

The generated driver code will be in the following location in the MCC Harmony project

generated code location

Back to Top

External Controller Driver Code

If further modifications are needed to customize the driver for the target external controller, the generated external controller driver code will be in the drv_gfx_external_controller.c source file.

The core configuration of the driver are generated in the following functions:

FunctionDescription
DRV_<name>_ResetCalled to control the reset signal to the controller at bootup.
DRV_<name>_Configure

Called at startup to send the initialization commands to configure the controller.

The series of initialization commands and their parameters are defined in initCmdParm.

DRV_<name>_BlitBuffer

Called to write/blit the frame buffer updates to controller.

If the driver is configured to generate a stub blit buffer function, this function must be completed with the appropriate code to write the frame buffer data to the controller.

Back to Top

Application Examples

External ControllerInterfaceExample
Ilitek ILI94884-line SPISAME54 Curiosity Ultra Legato Quickstart
 8-bit Parallel 8080
Solomon Systech SSD19638-bit Parallel 8080SAME54 Curiosity Ultra Legato Quickstart
 16-bit Parallel 8080SAME70 Xplained Ultra Legato Quickstart
Solomon Systech SSD13094-line SPIPIC32CM LE00 Curiosity Pro Legato Quickstart

Back to Top