Example: confidence

Using PIC32 MCUs to Develop Low-Cost …

2011-2014 Microchip Technology 1AN1387 INTRODUCTIONAs the demand for Graphical Embedded Applicationsbecomes more popular, so does the need fordeveloping cost effective solutions. Today, manycompanies offer solutions involving an additionalinternal or external graphics controller as part of asystem, which may result in higher costs and morecomplicated designs. In most cases, for a simpleembedded Graphical User Interface (GUI), thesegraphics controllers are not necessary, but a suitablesolution may not be available. One solution that isbecoming more popular is to use a controllerlesssolution. This solution uses microcontroller (MCU)peripherals to create a virtual graphics controller forgraphics rendering without taking up large amounts ofCPU time (in this solution less than 5%).

2011-2014 Microchip Technology Inc. DS00001387C-page 1 AN1387 INTRODUCTION As the demand for Graphical Embedded Applications becomes more …

Tags:

  Introduction

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Using PIC32 MCUs to Develop Low-Cost …

1 2011-2014 Microchip Technology 1AN1387 INTRODUCTIONAs the demand for Graphical Embedded Applicationsbecomes more popular, so does the need fordeveloping cost effective solutions. Today, manycompanies offer solutions involving an additionalinternal or external graphics controller as part of asystem, which may result in higher costs and morecomplicated designs. In most cases, for a simpleembedded Graphical User Interface (GUI), thesegraphics controllers are not necessary, but a suitablesolution may not be available. One solution that isbecoming more popular is to use a controllerlesssolution. This solution uses microcontroller (MCU)peripherals to create a virtual graphics controller forgraphics rendering without taking up large amounts ofCPU time (in this solution less than 5%).

2 The Low-Cost Controllerless Graphics PICtail PlusDaughter Board (referred to as the LCC GraphicsBoard) was designed to showcase a technique offeredby Microchip that utilizes this Low-Cost controllerlessmethod and is designed to work with many existingPIC32 starter application note describes the LCC GraphicsBoard that enables the implementation of a low-costcontrollerless graphic method Using a Graphics DefinitionsPixel One dot of color data on a Rate Defined in Hertz (Hz), the rate atwhich the LCD panel frame is being redrawn Defined in horizontal by verticaldimensions, the number of pixels a certain displaypanel contains. For example, a QVGA LCD panel thatis 320x240 pixels has a horizontal pixel count of 320and a vertical pixel count of Clock (PCLK) LCD panels use this signal tosynchronize the sampling of incoming color data.

3 Theclock signal needs to be faster for higher resolutions sothat all pixels of a frame can be Buffer Volatile memory where pixel color datais stored for the purposes of refreshing an LCD screenof a certain Throughput Speed at which a pixel can beredrawn. The time to draw an entire frame would bepixel throughput multiplied by the LCD Depth Defines how many possible colors apixel can be drawn. Commonly represented in bits perpixel (BPP), a common color depth is 16 BPP, where thecolor data is represented in a 565 RGB color format. Inthis format, 565 represents 5 red, 6 green, and 5 bluecolor UP A CONTROLLERLESS GRAPHICS SYSTEMIn general, a controllerless graphics system needs tosend a frame of pixel information to a display glass ata certain rate.

4 This refresh rate is usually around 60 do this, the system must constantly send frame datato the LCD panel. At first inspection, it seems like thistask would take up most of the CPU time in an , this is not the case for PIC32 MCUs thatcontain a Direct Memory Access (DMA) peripheral fordata transfer. With a DMA transferring the pixel data,less than 5% of CPU time can be used to achieve a virtual graphics controller. PIC32 MCUs have a built-in DMA peripheral. Thisperipheral can transfer data from one location toanother without CPU intervention. In a controllerlessgraphics method, the DMA is set up to transfer one lineof frame data at a time through the Parallel Master Port(PMP).

5 Each line consists of many pixels. The DMAsends a portion of the frame buffer during one PMP or Timer interrupt request is used to trigger thenext DMA transfer until a line is transferred. In PIC32devices with non-persistent interrupts, a timer is usedas the DMA trigger PIC32 devices with an External Bus Interface(EBI), this module can be used for a pixel clock addition, this clock source can achieve faster pixelclock speeds than the PMP peripheral, still the EBIshares the same pins as the :Adam Folts,Microchip Technology PIC32 MCUs to Develop Low-Cost Controllerless (LCC) Graphics SolutionsAN1387DS00001387C-page 2 2011-2014 Microchip Technology data transfers, the PMP/EBI strobes a read orwrite signal after each pixel transfer.

6 The read/writestrobes act as the pixel clock for the display glass. Aftereach line of pixel data is transferred, the CPU isinterrupted by the DMA and certain timing signals ( ,HSYNC, VSYNC, and DEN) necessary for LCD panelsare updated. This is repeated continuously until anentire frame has been drawn. The frame is stored involatile memory so the image can be dynamic. In thissetup, SRAM memory is used. This configuration is thefoundation for a controllerless graphics system. Thesystem can be set up to use internal SRAM memory orexternal SRAM memory. The system diagram isillustrated in Figure 1 and Figure color to an TFT LCD display is done by usingthe PMP/EBI data lines. Depending on the color formatused, the 16 data lines can be configured to transmitthe color data.

7 In 8 BPP Color mode only eight PMPdata lines are needed. When Using external memoryfor 16 BPP Color mode, eight or 16 data lines can beused. If eight data lines are used, the external memorydata lines still get mapped to the TFT LCD in 16 BPPmode; however, the PIC32 MCU only connects to thememory through eight bits. When a write needs to beperformed, the PIC32 MCU can then use the low/highbyte pins on the external memory to send 16-bit colorvalues to the the EBI peripheral is available, it can achieve betterframe update rates than the PMP peripheral, since bothmodules can be shared. This is discussed further in the"Rendering New Pixels On the Frame" 1:EXTERNAL MEMORY METHODFIGURE 2:INTERNAL MEMORY METHODD isplay Glass(Glass updated in parallel with DMA Read)FrameBufferPixel WriteDMA Read from PMP(SRAM)Display Glass(Data sent to glass during DMA PMP write)PMP/EBIDMA WriteSRAMI nternal 2011-2014 Microchip Technology 3AN1387 DMA AND PMP INITIALIZATION ROUTINEM icrochip Library of Applications (MLA) Code to set upand initialize the DMA and PMP is provided inExample 1.

8 This code is a snippet from the LCC driversoftware, and is being provided as a reference to showhow easy it is to set up a system for controllerlessgraphics. It is not intended for copy and 1:DMA AND PMP INITIALIZATION SOURCE CODE//Suspend ALL DMA =1;#define PMP_CONTROL(PMP_ON|PMP_MUX_OFF|PMP_READ_ WRITE_EN|\PMP_CS2_EN|PMP_CS2_POL_LO|PMP_ WRITE_POL_LO|PCLK_POLARITY)#define PMP_MODE(PMP_DATA_LENGTH|PMP_MODE_MASTER 2|\PMP_WAIT_BEG_1|PMP_WAIT_MID_1|PMP_WAI T_END_1) // Set up the PMP // PMP is setup to use data and address lines, in 16 bit PMP mode // PMP wait states are set to fastestmPMPOpen(PMP_CONTROL, PMP_MODE, PMP_ADDRESS_LINES, PMP_INT_ON); // Set PMP address to 0 PMADDR = 0x0000; // Open the desired DMA channelDmaChnOpen(1, 0, DMA_OPEN_DEFAULT).

9 // Set the transfer event control: what event is to start the DMA transferDmaChnSetEventControl(1, DMA_EV_START_IRQ(_TIMER_2_IRQ)); // Set the transfer parameters: source & destination address, source & destination size, // number of bytes per event source is the PMP, destination is a dummy array, source size is // 2 for 16-bit color, first destination size is the backporch, transfers per event is (1, (void*)&PMDIN ,&GraphicsFrame[0] , 2, HBackPorch, 2); // Set INT controller priority to 7 for highest priorityINTSetVectorPriority(INT_VECTOR_ DMA(1), INT_PRIORITY_LEVEL_7); // Set INT controller sub-priorityINTSetVectorSubPriority(INT_ VECTOR_DMA(1), INT_SUB_PRIORITY_LEVEL_3); // Enable the transfer done interrupt, when all buffer transferredDmaChnSetEvEnableFlags(1, DMA_EV_BLOCK_DONE); // Enable the interrupt in the INT controllerINTE nable(INT_SOURCE_DMA(1), INT_ENABLED); // Once configured, enable the DMA channelDmaChnEnable(1); // Turn on Timer2 to act as a "trigger" for the pixel clock (DMA transfer)OpenTimer2(T2_ON | T2_SOURCE_INT | T2_PS_1_1, 10); // Start ALL DMA = 0;AN1387DS00001387C-page 4 2011-2014 Microchip Technology OF THIN-FILM TRANSISTOR (TFT) LCD PANELST here are different types of LCD glass to choose fromin the marketplace.

10 The controllerless graphics methodwas designed to work with TFT LCD panels, but canwork with CSTN or MSTN glass with minormodifications. Figure 3 shows a typical timing of a TFTdisplay data lines consist of the pixel color LCD panels can have 8 to 24 color data linesdepending on the color depth of the LCD panel. Thesedata lines supply the LCD panel with the raw color dataof each clock signals HSYNC, VSYNC, DEN and PCLKare used to synchronize the pixel data with the graphicsframe and the LCD panel. The sync lines tell the LCDpanel when the data is at the start or end of a line(HSYNC) or a frame (VSYNC). The data enable line(DEN) lets the LCD panel know when valid pixel data isbeing sent to the LCD panel.


Related search queries