Microchip Graphics Suite (MGS) External Controller Driver User Guide
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.
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.
The main components for the display driver interface include:
- External Controller Driver
- Driver generator for the external controller
- Display Interface Driver
- Interface-specific driver (4-line or parallel 8080)
- Peripheral Driver and Library
Driver Configuration
External Controller Driver
Here are the main configuration options for the External Controller Driver Generator component.
Configuration Option | Description | Sub-options | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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 Name | Set to target controller name. This will be used as part of the function names in the generated code. | ||||||||
Display Interface Type | Specify 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 Settings | Configures the resolution of the display. These settings must match the size specified in the GFX Core LE Component. | Width | The width of the display in pixels. | ||||||||
Height | The height of the display in pixels. | ||||||||||
Reset Settings | Driver 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 Settings | Driver 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.
| ||||||||||
Blit Buffer Function Settings | Driver 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". 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
| ||||||||||
X/Y Address Size | The 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.
| ||||||||||
Set Page/Y Command | The command sent to the controller to write the page or Y address.
| ||||||||||
Memory Write Command | The command sent to the controller to start the memory write operation. |
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.
Display Interface Driver
The display interface driver provides an abstraction for the actual interface and peripheral used by the external controller driver.
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 Option | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
SPI Index | The Core SPI Instance number | ||||||||
Transfer Mode Settings | Options for the blit buffer write
|
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.
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.
Generated Code
The generated driver code will be in the following location in the MCC Harmony project
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:
Function | Description |
---|---|
DRV_<name>_Reset | Called 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. |
Application Examples
External Controller | Interface | Example |
---|---|---|
Ilitek ILI9488 | 4-line SPI | SAME54 Curiosity Ultra Legato Quickstart |
8-bit Parallel 8080 | ||
Solomon Systech SSD1963 | 8-bit Parallel 8080 | SAME54 Curiosity Ultra Legato Quickstart |
16-bit Parallel 8080 | SAME70 Xplained Ultra Legato Quickstart | |
Solomon Systech SSD1309 | 4-line SPI | PIC32CM LE00 Curiosity Pro Legato Quickstart |