I am not able to clear the screen of the LCD.I am using sitara AM3352 ARMcortex A8 family.
I have interfaced STN(LCD) screen with AM3352 processor.
I have written the code for sending string on LCD using graphics library in CCScode composer studio IDE on windows platform.
But i am not able to clear string the LCD.It is overwriting when i write on the same location.
Please can you help me?int main(void)
{
MMUConfigAndEnable();
ConsoleUtilsPrintf("StarterWare AM335x RTC Application1232.\r\n");
//rtcClock();
//Mitesh Added
/* Enabling functional clocks for GPIO0 instance. */
GPIO0ModuleClkConfig();
/* Enabling functional clocks for GPIO1 instance. */
GPIO1ModuleClkConfig();
/* Enabling functional clocks for GPIO2 instance. */
GPIO2ModuleClkConfig();
/* Enabling functional clocks for GPIO1 instance. */
GPIO3ModuleClkConfig();
/* Selecting GPIO1[23] pin for use. LED1*/
GpioPinMuxSetup(GPIO_1_30,15);
/* Selecting GPIO1[30] pin for use.LED2 */
GpioPinMuxSetup(GPIO_2_0,15);
/* Selecting GPIO1[25] pin for use.LCD_PWR_EN */
GpioPinMuxSetup(GPIO_1_25,15);
/* Selecting GPIO2[22] pin for use.LCD_CLKSEL */
GpioPinMuxSetup(GPIO_2_22,15);
/* Selecting GPIO1[22] pin for use.LCD_DPS */
GpioPinMuxSetup(GPIO_1_22,15);
/* Selecting GPIO1[23] pin for use.LCD_FRC */
GpioPinMuxSetup(GPIO_1_23,15);
/* Selecting GPIO1[23] pin for use.LCD_SHTDN- */
GpioPinMuxSetup(GPIO_2_23,15);
/* Resetting the GPIO module. */
GPIOModuleReset(SOC_GPIO_0_REGS);
/* Resetting the GPIO module. */
GPIOModuleReset(SOC_GPIO_1_REGS);
/* Resetting the GPIO module. */
GPIOModuleReset(SOC_GPIO_2_REGS);
/* Resetting the GPIO module. */
GPIOModuleReset(SOC_GPIO_3_REGS);
/* Enabling the GPIO module. */
GPIOModuleEnable(SOC_GPIO_0_REGS);
/* Enabling the GPIO module. */
GPIOModuleEnable(SOC_GPIO_1_REGS);
/* Enabling the GPIO module. */
GPIOModuleEnable(SOC_GPIO_2_REGS);
/* Enabling the GPIO module. */
GPIOModuleEnable(SOC_GPIO_3_REGS);
/* Setting the GPIO pin as an output pin.LED2 */
GPIODirModeSet(SOC_GPIO_2_REGS,
0,
GPIO_DIR_OUTPUT);
/* Setting the GPIO pin as an output pin.RMII1_RST- */
GPIODirModeSet(SOC_GPIO_3_REGS,
9,
GPIO_DIR_OUTPUT);
/* Setting the GPIO pin as an output pin.RMII2_RST- */
GPIODirModeSet(SOC_GPIO_1_REGS,
18,
GPIO_DIR_OUTPUT);
/* Setting the GPIO pin as an output pin.LED1 */
GPIODirModeSet(SOC_GPIO_1_REGS,
GPIO_INSTANCE_PIN_NUMBER,
GPIO_DIR_OUTPUT);
/* Setting the GPIO pin as an output pin.LCD_PWR_EN */
GPIODirModeSet(SOC_GPIO_1_REGS,
25,
GPIO_DIR_OUTPUT);
/* Setting the GPIO pin as an output pin.LCD_CLKSEL */
GPIODirModeSet(SOC_GPIO_2_REGS,
22,
GPIO_DIR_OUTPUT);
/* Setting the GPIO pin as an output pin.LCD_DPS */
GPIODirModeSet(SOC_GPIO_1_REGS,
22,
GPIO_DIR_OUTPUT);
/* Setting the GPIO pin as an output pin.LCD_FRC */
GPIODirModeSet(SOC_GPIO_1_REGS,
23,
GPIO_DIR_OUTPUT);
/* Setting the GPIO pin as an output pin.LCD_SHTDN- */
GPIODirModeSet(SOC_GPIO_2_REGS,
23,
GPIO_DIR_OUTPUT);
/* Driving a logic HIGH on the GPIO pin.RMII1_RST- */
GPIOPinWrite(SOC_GPIO_3_REGS,
9,
GPIO_PIN_HIGH);
/* Driving a logic HIGH on the GPIO pin.RMII2_RST- */
GPIOPinWrite(SOC_GPIO_1_REGS,
18,
GPIO_PIN_HIGH);
/* Driving a logic HIGH on the GPIO pin.LCD_PWR_EN- */
GPIOPinWrite(SOC_GPIO_1_REGS,
25,
GPIO_PIN_HIGH);
/* Driving a logic HIGH on the GPIO pin.LCD_CLKSEL */
GPIOPinWrite(SOC_GPIO_2_REGS,
22,
GPIO_PIN_HIGH);
/* Driving a logic LOW on the GPIO pin.LCD_DPS - NORMAL SCAN */
GPIOPinWrite(SOC_GPIO_1_REGS,
22,
GPIO_PIN_LOW);
/* Driving a logic HIGH on the GPIO pin.LCD_FRC */
GPIOPinWrite(SOC_GPIO_1_REGS,
23,
GPIO_PIN_HIGH);
/* Driving a logic HIGH on the GPIO pin.LCD_SHTDN-*/
GPIOPinWrite(SOC_GPIO_2_REGS,
23,
GPIO_PIN_HIGH);
PWMSSModuleClkConfig(0);
j = EPWM2PinMuxSetup();
/* Enable Clock for EHRPWM in PWM sub system */
EHRPWMClockEnable(SOC_PWMSS0_REGS);
/* Enable Timer Base Module Clock in control module */
PWMSSTBClkEnable(0);
/* EHRPWM is configured to generate PWM waveform on EPWMAxA Pin*/
EHRPWMConfigure0();
//Code from Haptics_END
/* Enable Data Cache */
CacheEnable(CACHE_ALL);
ConsoleUtilsSetType(CONSOLE_UART);
ConsoleUtilsPrintf("\n\nUSB Mass Storage Host program\n");
ConsoleUtilsPrintf("Type \'help\' for help.\n\n");
DelayTimerSetup();
SetUpLCD();
/* configuring the base ceiling */
RasterDMAFBConfig(SOC_LCDC_0_REGS,
(unsigned int)(g_pucBuffer+PALETTE_OFFSET),
(unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 -
PALETTE_OFFSET, FRAME_BUFFER_0);
RasterDMAFBConfig(SOC_LCDC_0_REGS,
(unsigned int)(g_pucBuffer+PALETTE_OFFSET),
(unsigned int)(g_pucBuffer+PALETTE_OFFSET) + sizeof(g_pucBuffer) - 2 -
PALETTE_OFFSET, FRAME_BUFFER_1);
src = (unsigned char *) palette_32b;
dest = (unsigned char *) (g_pucBuffer+PALETTE_OFFSET);
// Copy palette info into buffer
for( i = PALETTE_OFFSET; i < (PALETTE_SIZE+PALETTE_OFFSET); i++)
{
*dest++ = *src++;
}
GrOffScreen24BPPInit(&g_s35_800x480x24Display, g_pucBuffer, LCD_WIDTH, LCD_HEIGHT);
// GrOffScreen24BPPInit(&g_s35_800x480x24Display, g_pucBuffer, LCD_WIDTH, LCD_HEIGHT);
// Initialize a drawing context.
GrContextInit(&g_sContext, &g_s35_800x480x24Display);
/* enable End of frame interrupt */
RasterEndOfFrameIntEnable(SOC_LCDC_0_REGS);
/* enable raster */
RasterEnable(SOC_LCDC_0_REGS);
GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG );
GrRectFill(&g_sContext, &sRect);
GrContextFontSet(&g_sContext, &g_sFontCm30b);
ConsoleUtilsPrintf("Start.\n\n");
i=j=0;
GrStringDraw(&g_sContext,&Name1,-1,j,i,0);
CacheDataCleanBuff((unsigned int) &g_pucBuffer[0]+PALETTE_OFFSET,
GrOffScreen24BPPSize(LCD_WIDTH, LCD_HEIGHT, PIXEL_24_BPP_UNPACKED));
CacheDataCleanBuff((unsigned int) &g_pucBuffer[1]+PALETTE_OFFSET,
GrOffScreen24BPPSize(LCD_WIDTH, LCD_HEIGHT, PIXEL_24_BPP_UNPACKED));
// LCD_CLEAR_SCREEN();
GrFlush(&g_sContext);
GrStringDraw(&g_sContext,&Name2,-1,j,i,0);
CacheDataCleanBuff((unsigned int) &g_pucBuffer[0]+PALETTE_OFFSET,
GrOffScreen24BPPSize(LCD_WIDTH, LCD_HEIGHT, PIXEL_24_BPP_UNPACKED));
CacheDataCleanBuff((unsigned int) &g_pucBuffer[1]+PALETTE_OFFSET,
GrOffScreen24BPPSize(LCD_WIDTH, LCD_HEIGHT, PIXEL_24_BPP_UNPACKED));
ConsoleUtilsPrintf("After B clear\n\n");
while(1);
}