Microchip Graphics Controller

Microchip Graphics Library

Microchip Graphics Library
Microchip Graphics Controller

The Microchip Graphics Controller has several advanced features that can be enabled by declaring macros in the Graphics Config (GraphicsConfig.h) and Hardware Profile (HardwareProfile.h) of the project. Below is a summary of all macros that pertains to the Microchip Graphics Controller driver. 

 

Macro Name 
Description 
Location 
Defines the starting address of the display buffer. 
Hardware Profile 
Defines the size of the display buffer. This macro is used to map memory in RAM when:
  1. Double buffering is enabled. This is enabled by the macro USE_DOUBLE_BUFFERING
  2. IPU module is used. This is enabled by the macro USE_COMP_IPU
If the application is designed to fit into the internal memory, and with the If the double buffering and/or IPU module is enabled, the memory required must fit into the internal memory.

NOTE: If the display buffer is located in external memory (i.e in PIC24FJ256DA210) then GFX_DISPLAY_BUFFER_LENGTH must be less than or equal to the chip select region size  
Hardware Profile 
Macro that enables the palette mode in Graphics Library and the Microchip Graphics Controller. 
Graphics Config 
Optional feature. This enables the double buffering feature. Memory required for display buffer will double in size. There will be two display buffers used and these buffers are swapped automatically by the library draw operations or application can manage the swapping. See Double Buffering for details.
Buffer Location (Mapping):
Display Buffer 1 = GFX_DISPLAY_BUFFER_START_ADDRESS
Display Buffer 2 = GFX_DISPLAY_BUFFER_START_ADDRESS + GFX_DISPLAY_BUFFER_LENGTH

NOTE: If the display buffers are located in external memory (i.e in PIC24FJ256DA210) then the total display buffer memory needed must be less than or equal to the chip select region size  
 
Optional feature. This enables the usage of the IPU module in the Microchip Graphics Controller. Memory required for IPU is dictated by the location of the compressed data:

When compressed data is from external memory or program memory:
GFX_COMPRESSED_BUFFER_SIZE - defines the memory cache size needed for compressed data
GFX_DECOMPRESSED_BUFFER_SIZE - defines the memory cache size needed for decompressed data
GFX_IPU_TEMP_DATA_TRANSFER_ARRAY_SIZE - defines the memory cache size needed for transferring the compressed data from external memory (not mapped to EDS) or program memory to RAM location. This cache memory is created at initialization and will automatically be mapped. The size cannot not be greater than 32K.

Buffer Location (Mapping) (double buffering enabled):
Display Buffer = GFX_DISPLAY_BUFFER_START_ADDRESS
Decompressed Data Buffer = GFX_DISPLAY_BUFFER_START_ADDRESS + (GFX_DISPLAY_BUFFER_LENGTH*2)
Compressed Data Buffer = Decompressed Data Buffer + GFX_DECOMPRESSED_BUFFER_SIZE

Buffer Location (Mapping) (double buffering disabled):
Display Buffer = GFX_DISPLAY_BUFFER_START_ADDRESS
Decompressed Data Buffer = GFX_DISPLAY_BUFFER_START_ADDRESS + GFX_DISPLAY_BUFFER_LENGTH
Compressed Data Buffer = Decompressed Data Buffer + GFX_DECOMPRESSED_BUFFER_SIZE

When compressed data is Extended Data Space (RAM or external memory mapped in EDS):
GFX_DECOMPRESSED_BUFFER_SIZE - defines the memory cache size needed for decompressed data

Buffer Location (Mapping) (double buffering enabled):
Display Buffer = GFX_DISPLAY_BUFFER_START_ADDRESS
Decompressed Data Buffer = GFX_DISPLAY_BUFFER_START_ADDRESS + (GFX_DISPLAY_BUFFER_LENGTH*2)

Buffer Location (Mapping) (double buffering disabled):
Display Buffer = GFX_DISPLAY_BUFFER_START_ADDRESS
Decompressed Data Buffer = GFX_DISPLAY_BUFFER_START_ADDRESS + GFX_DISPLAY_BUFFER_LENGTH

NOTE: If the display buffers are located in external memory (i.e in PIC24FJ256DA210) then the total display, compressed and uncompressed buffers needed must be less than or equal to the chip select region size
External CS Memory Requirement  
Graphics Config 
For PIC Device Families with Enhanced Parallel Master Port (EPMP) (example PIC24FJ256DA210 Family of Devices).
Defines the location of the EPMP Chip Select 1 base address. When this macro is defined, the driver automatically enables the EPMP. The GFX_EPMP_CS1_MEMORY_SIZE macro determines how many address lines of the EPMP will be enabled.
Use this macro together with GFX_EPMP_CS1_MEMORY_SIZE to map external memory to EPMP Chip Select 1 for use by the Microchip Graphics Controller. 
Hardware Profile 
Defines the size of the memory mapped to EPMP Chip Select 1. Always used with GFX_EPMP_CS1_BASE_ADDRESS macro.

NOTE: Refer to GFX_DISPLAY_BUFFER_LENGTH, USE_DOUBLE_BUFFERING and USE_COMP_IPU description for the relationship between GFX_EPMP_CS1_MEMORY_SIZE and the total memory requirements when external memory is used for display buffers. 
Hardware Profile 
For PIC Device Families with Enhanced Parallel Master Port (EPMP) (example PIC24FJ256DA210 Family of Devices).
Defines the location of the EPMP Chip Select 2 base address. 
Hardware Profile 
Defines the size of the memory mapped to EPMP Chip Select 2. Always used with GFX_EPMP_CS2_BASE_ADDRESS macro.

NOTE: Refer to GFX_DISPLAY_BUFFER_LENGTH, USE_DOUBLE_BUFFERING and USE_COMP_IPU description for the relationship between GFX_EPMP_CS1_MEMORY_SIZE and the total memory requirements when external memory is used for display buffers. 
Hardware Profile 
GFX_COMPRESSED_BUFFER_SIZE 
Macro used with USE_COMP_IPU to define the memory cache size needed for compressed data.
The value chosen is based on the largest compressed data when multiple compressed images/data are used. 
Hardware Profile 
GFX_DECOMPRESSED_BUFFER_SIZE 
Macro used with USE_COMP_IPU to define the memory cache size needed for decompressed data.
The value chosen is based on the largest decompressed data when multiple compressed images/data are used. 
Hardware Profile 
GFX_IPU_TEMP_DATA_TRANSFER_ARRAY_SIZE 
Macro used with USE_COMP_IPU to define the memory cache size needed for transferring the compressed data from external memory (not mapped to EDS) or program memory to RAM location.
The size chosen must not exceed 32Kbytes. Allowed size is further reduced by application variables and dynamic memory requirements. 
Hardware Profile 

 

Enabling Internal/External Memory 

The Microchip Graphics Controller can use internal memory or external memory for the display buffers. The driver decides on the location of the buffers based on the GFX_DISPLAY_BUFFER_START_ADDRESS macro. For the PIC24FJ256DA210 device family, there are two variants for internal memory sizes, 96 Kbytes and 24 Kbytes. For the 96 Kbytes variants, the external memory can be immediately mapped after the internal RAM address. for the 24KBytes variants, the external memory cannot be mapped after the internal RAM address. Refer to the PIC24FJ256DA210 Family Data Sheet for details on the mapping of external memory (Section 4.2 Data Memory Space). 

External Memory Example:

// Settings for Hardware Profile to use External Memory
// on PIC24FJ256DA210 Development Board

// Microchip Development Board Specific macros
  #define PIC24FJ256DA210_DEV_BOARD                    // development board used
  #define GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E // display panel used

// Microchip Graphics Controller specific macros
  // PMP port data bus width (for Microchip Graphics Controller only 16bit is allowed)
  #define USE_16BIT_PMP
  // Use Microchip Display Controller
  #define GFX_USE_DISPLAY_CONTROLLER_MCHP_DA210
  // Microchip Graphics Controller pixel clock divider
  // The value used is derived from display's refresh rate requirement (usually 60 Hz)
  #define GFX_GCLK_DIVIDER 61

  // Display Buffer start address
  // Note that the value is mapped to external memory location
  // see  PIC24FJ256DA210 Family Data Sheet for details
  #define GFX_DISPLAY_BUFFER_START_ADDRESS 0x00020000ul
  // Display Buffer size
  #define GFX_DISPLAY_BUFFER_LENGTH 0x00025800ul

  // Since Display Buffer is mapped to external memory
  // EPMP needs to be enabled
  #define GFX_EPMP_CS1_BASE_ADDRESS 0x00020000ul
  #define GFX_EPMP_CS1_MEMORY_SIZE 0x80000ul

  // EPMP CS2 can also be used as an external memory resource
  #define GFX_EPMP_CS2_BASE_ADDRESS (0x00020000ul + GFX_EPMP_CS1_MEMORY_SIZE )
  #define GFX_EPMP_CS2_MEMORY_SIZE 0x80000ul

Internal Memory Example:

// Settings for Hardware Profile to use Internal Memory
// on PIC24FJ256DA210 Development Board

// Hardware Profile
// Microchip Development Board Specific macros
  #define PIC24FJ256DA210_DEV_BOARD                    // development board used
  #define GFX_USE_DISPLAY_PANEL_TFT_G240320LTSW_118W_E // display panel used

// Microchip Graphics Controller specific macros
  // Use Microchip Display Controller
  #define GFX_USE_DISPLAY_CONTROLLER_MCHP_DA210
  // Microchip Graphics Controller pixel clock divider
  // The value used is derived from display's refresh rate requirement (usually 60 Hz)
  #define GFX_GCLK_DIVIDER 61

  // Display Buffer start address
  // Note that the value is mapped to external memory location
  // see  PIC24FJ256DA210 Family Data Sheet for details
  #define GFX_DISPLAY_BUFFER_START_ADDRESS 0x00004B00ul
  // Display Buffer size
  #define GFX_DISPLAY_BUFFER_LENGTH 0x0004B000ul

 

Enabling Double Buffering 

See Double Buffering

 

Enabling Color Look Up Table 

The Graphics Controller Module can be set to operate on 1, 2, 4, 8 and 16 bpp. Color depths 1, 2, 4, and 8 can be used with the 256 entries Color Look Up Table (CLUT). When using external memory, only the 8bpp mode can be used with the CLUT enabled. When using internal memory, 1,2,4 and 8 bpp can be used. 

Enabling Color Look Up Table Example:

// Settings for GraphicsConfig.h to use the CLUT at 8BPP mode.

  // enable the palette mode
  #define USE_PALETTE

  // set the color depth
  #define COLOR_DEPTH    8

 

Enabling the IPU Module 

Currently, the IPU module is an option to reduce memory external or internal flash memory when storing images for the Graphics Library. The Graphics Resource Converter tool provides an option to convert images to be saved in compressed format for IPU decompression. 

Enabling IPU Decompression Example:

// Settings for GraphicsConfig.h to use the IPU Module.

  // enable the use of IPU module
  #define USE_COMP_IPU

 

// Settings for Hardware Profile to use IPU Module
// on PIC24FJ256DA210 Development Board
// Use this when compressed data is from memory not mapped to EDS

  // define the size of the compressed buffer
  #define GFX_COMPRESSED_BUFFER_SIZE              (13950)

  // define the size of the decompressed buffer
  #define GFX_DECOMPRESSED_BUFFER_SIZE            (19216)

  // define the size of the temporary buffer to transfer compressed
  // data from memory not mapped in EDS
  // (example: External SPI memory, Program Flash)
  #define GFX_IPU_TEMP_DATA_TRANSFER_ARRAY_SIZE   (1024)

 

// Settings for Hardware Profile to use IPU Module
// on PIC24FJ256DA210 Development Board
// Use this when compressed data is from memory mapped to EDS

  // define the size of the decompressed buffer
  #define GFX_DECOMPRESSED_BUFFER_SIZE            (19216)
Module
Topics
Name 
Description 
The following APIs are used move blocks of data from one memory location to another. 
The Microchip Graphics Controller features a decompression module for data compressed using the DEFLATE algorithm. Compressed data are limited to fixed huffman codes. Compressed data with dynamic huffman codes are not supported. 
The Microchip Graphics Controller features a palette mode for a smaller frame buffer requirement. This option uses the built-in 256 entry Color Look-up Table (CLUT) to represent pixels from the display buffer in memory. If the CLUT is enabled, each pixel in the display buffer is assumed to contain the color index. This color index is used as the address of the CLUT entry that contains the color value that will be used for the given pixel. 
 
This section shows examples on how to set up applications using external memory, internal memory or use palettes for Microchip Graphics Module.  
Links
Microchip Graphics Library Version 3.06.02 - October 15, 2012
Copyright © 2012 Microchip Technology, Inc.  All rights reserved