This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to set tft 8pp pallet mode in am335x starterware?

Other Parts Discussed in Thread: AM1808

hello,

My project is using a 800*600 's TFT screen, and intend to use 8pp pallet mode ,and output 565 16bit in lcd pin.

My setting is as following:

static void SetUpLCD(void) {  /* Enable clock for LCD Module */  LCDModuleClkConfig();

 LCDPinMuxSetup();

 /*  **Clock for DMA,LIDD and for Core(which encompasses  ** Raster Active Matrix and Passive Matrix logic)  ** enabled.  */

 RasterClocksEnable(SOC_LCDC_0_REGS);

 /* Disable raster */  

RasterDisable(SOC_LCDC_0_REGS);

 /* Configure the pclk */  

RasterClkConfig(SOC_LCDC_0_REGS, 33000000, 192000000);

 /* Configuring DMA of LCD controller */

RasterDMAConfig(SOC_LCDC_0_REGS, RASTER_SINGLE_FRAME_BUFFER,                                 RASTER_BURST_SIZE_16,

RASTER_FIFO_THRESHOLD_512,                 

RASTER_BIG_ENDIAN_DISABLE);

 /* Configuring modes(ex:tft or stn,color or monochrome etc) for raster controller */ 

 RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT,                   RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_EXTRAPOLATE);

  /* Configuring the polarity of timing parameters of raster controller */  

RasterTiming2Configure(SOC_LCDC_0_REGS, RASTER_FRAME_CLOCK_HIGH |                                          RASTER_LINE_CLOCK_HIGH  |   RASTER_PIXEL_CLOCK_HIGH |                                          RASTER_SYNC_EDGE_FALLING |   RASTER_SYNC_CTRL_INACTIVE |                                          RASTER_AC_BIAS_HIGH     , 0, 255);  

/* Configuring horizontal timing parameter */

 RasterHparamConfig(SOC_LCDC_0_REGS, 800, 20, 210, 46); 

 /* Configuring vertical timing parameters */ 

 RasterVparamConfig(SOC_LCDC_0_REGS, 600, 10, 50, 23);

 RasterFIFODMADelayConfig(SOC_LCDC_0_REGS, 12);

 }

 

#define PALETTE_SIZE   512    // 8PP mode

#define PALETTE_OFFSET  4

unsigned char GraphWaveBuf[PALETTE_OFFSET+PALETTE_SIZE+800*600];

 

void LCDRasterInit(void) {  

unsigned short int *palettebuf=(U16 *)&GraphWaveBuf[0];  

unsigned int i;

 palettebuf = (unsigned short int *)&GraphWaveBuf[0];  

for ( i=0; i<(PALETTE_SIZE)/sizeof(unsigned short int); i++ )

 {   palettebuf[i+2] = Palette256[i];  } 

for ( i=0; i<(LCD_XSIZE*LCD_YSIZE); i++ )  

{   GraphWaveBuf[i+PALETTE_OFFSET+PALETTE_SIZE] = 128;  }

 LCDAINTCConfigure();

 LCDBackLightEnable();

//  UPDNPinControl();

 SetUpLCD();

 /* Configuring the base ceiling */  RasterDMAFBConfig(SOC_LCDC_0_REGS,            (U32)&GraphLcdBuf[0]+PALETTE_OFFSET ,            (U32)&GraphLcdBuf[0]+PALETTE_OFFSET+800*600-1,            FRAME_BUFFER_0);

#if 0  RasterDMAFBConfig(SOC_LCDC_0_REGS,            (U32)&GraphLcdBuf[0] + PALETTE_OFFSET,            (U32)&GraphLcdBuf[0] + PALETTE_OFFSET + LCD_SIZE,            0); #endif

#if 0  /* Enable End of frame0/frame1 interrupt */  RasterIntEnable(SOC_LCDC_0_REGS, RASTER_END_OF_FRAME0_INT |                                   RASTER_END_OF_FRAME1_INT); #endif

 /* Enable raster */  RasterEnable(SOC_LCDC_0_REGS);

}

------------------------------------------------------

With this setting, the screen showing only steady white color.

please help me .

 

 

 

  • Hi Ge Shuihuan,

    Have you tried testing with pixel formats other than 8BPP?

    For 8BPP, the frame buffer should contain 512 bytes of palette data followed by pixel data and for all the other formats (1, 2, 4, 12, 16, 24 BPP Modes)  frame buffer should contain 32 bytes of palette data followed by pixel data.

    If the display is working fine for other modes and issue is with only 8-BPP, then please check whether frame buffer data is correct (palette data and pixel data is in correct position).

    If the display is not working for other modes also, then please check the timing parameters of the LCD panel.

    Regards,

    M.Jyothi Kiran

     

     

     

  • Hi Madana Jyothi,

    On the AM335X EVM, i have testing the 24BPP ,and it works well.

    But when i change configutation to 16BPP mode and change the image(800X480X2,added by 32 bytes), only yellow color comes up on the lcd.

    #if 0 // 24bit  

    RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT_UNPACKED,

                        RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);

    #endif

    #if 1 // 16bit  

    RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT_PACKED,

                       RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);

    #endif

    I wonder why and how to config that.

  •  

    Hi Madana Jyothi, sorry for wrong type.

    On the AM335X EVM, i have testing the 24BPP ,and it works well.

    But when i change configutation to 16BPP mode and change the image(800X480X2,added by 32 bytes), only yellow color comes up on the lcd.

    #if 0 // 24bit  

    RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT_UNPACKED,

                        RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);

    #endif

    #if 1 // 16bit  

    RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT,

                       RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);

    #endif

    I wonder why and how to config that.

  • Hi,

    I have made the change as following: (RASTER_PALETTE_DATA-->RASTER_DATA)

    #if 1 // 16bit  

    RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT,

                       RASTER_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);

    #endif

    then, the image displays well.

    Can you explain that? And what can i do ?

  • Hi Ge Shuihuan,

    The above setting indicates the palette loading mode. It supports three modes  i) Palette and data mode - Where both palette and data will be loaded . ii) Palette mode - Where only palette is loaded and data is not loaded  iii) Data mode - This mode is applicable for raw formats, which does not support palette. (12, 16, 24 BPP).

    12-, 16-, and 24-BPP modes do not need a palette; i.e., the pixel data is the desired RGB value. However, the first 32 bytes are still considered a palette. The first entry should be 4000h  while the remaining entries must be filled with 0.

    So for 16BPP, the first 32 bytes of frame buffer should be defined as mentioned above and the palette load mode should be 'data only mode' or 'palette and data mode'.

    If the first 32 bytes have palette data differenet from the above mentioned data then the image will not be displayed correctly.

    Please refer the section 13.3.5.2 of AM335x TRM for better understanding of frame buffer.

    Regards,

    M.Jyothi Kiran

     

     

  • Thanks for reply, M.Jyothi Kiran

    I have set the palette as following in the first 32 bytes for 16bpp:

    unsigned char gImage_800X480X16[768032] =

    { 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, (raw data --800*480*2 )  };

    If i config as following for 16bpp , it goes wrong:

    ---------------------------start-----------------------------------

    #if 1 // 16bit  

    RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT,                  

    RASTER_PALETTE_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);

    #endif

     RasterDMAFBConfig(SOC_LCDC_0_REGS,                      

     (unsigned int)gImage_800X480X16,                      

    (unsigned int)gImage_800X480X16 + sizeof(gImage_800X480X16) - 1,                      

     0);

    ---------------------------end-------------------------------

     

    but if i make change as following , it goes well:

    --------------------------start--------------------------------

    #if 1 // 16bit  

    RasterModeConfig(SOC_LCDC_0_REGS, RASTER_DISPLAY_MODE_TFT,                  

    RASTER_DATA, RASTER_COLOR, RASTER_RIGHT_ALIGNED);

    #endif

     RasterDMAFBConfig(SOC_LCDC_0_REGS,                      

     (unsigned int)gImage_800X480X16+32,                      

    (unsigned int)gImage_800X480X16 + sizeof(gImage_800X480X16) - 1,                      

     0);

    ---------------------------end-------------------------------

    It makes me confused.

    What is going wrong?

     

     

     

     

  • Hi Ge Shuihuan,

    The configuration in case 1 is also seem to be correct. I don't find any issue in the configuration.

    The configuration for case 1 will work, unless there is some issue in the frame buffer. Even if the palette load mode is 'palette and data', if the first 32 bytes of frame buffer are correct, then  there should not be any issue.

    Regards,

    M.Jyothi Kiran

     

  • Thanks for reply.

    Can you send me an example of 16bpp with palette data, and an example of 8bpp mode  with 565 output mode?

    And  I can check what i had missed.

    Regards,

    Ge Shuihuan

  • Hi Ge Shuihuan,

    For the use case of 16bpp, please refer the following raster example in startereware version 01.00.03.03  (AM1808)

    examples\evmAM1808\raster.

    Currently, no example is present for the use case of 8bpp.

    Regards,

    M.Jyothi Kiran