AnsweredAssumed Answered

LCDC 16bpp question and frame buffer structure

Question asked by Peter Ilsoe Nielsen on May 7, 2014
Latest reply on May 23, 2014 by Peter Ilsoe Nielsen

Hi

 

I am trying to get 800x480 display to run in 16bpp mode, and can also make it work. But It seems like the frame buffer has to be interleaved after each Hsync. Meaning that I have to make my frame buffer twice the size.

Can that be the case our is the DMA settings not correct?

 

I have modified the lcdc example from SC to the following setting:

lcdc.h (buffer size adjusted + screen resolution):

 

#define SCREEN_XSIZE 800 //PEILNI: changed to 800x480
#define SCREEN_YSIZE 480
#define GW_XSIZE (SCREEN_XSIZE/2)
#define GW_YSIZE (SCREEN_YSIZE/2)

#define FRAME_START_ADDRESS 0x80400000 //Screen in DDR
#define GW_START_ADDRESS 0x80200000

#define FRAME_BUFFER_SIZE (SCREEN_XSIZE * SCREEN_YSIZE * 2) //4 bytes per pixel for 24bpp //PEILNI: changed to 2 bytes since we use 16 bpp
#define GW_BUFFER_SIZE (GW_XSIZE * GW_YSIZE * 2) //4 bytes per pixel for 24bpp //PEILNI: changed to 2 bytes since we use 16 bpp



 

And some in lcdc.c, this is timing for the display and from 24bpp to 16bpp:

 

// set LCD panel configuration. Use endianess to work with TWR-LCD-RGB lines.
  LCDC_LPCR =
  LCDC_LPCR_TFT_MASK | //TFT Screen
  LCDC_LPCR_COLOR_MASK | //Color
  LCDC_LPCR_BPIX(0x5) | //24 bpp //PEILNI:changed to 16bpp
  LCDC_LPCR_FLMPOL_MASK | //first line marker active low (VSYNC)
  LCDC_LPCR_LPPOL_MASK | //line pulse active low (HSYNC)
  LCDC_LPCR_END_SEL_MASK | //Use big-endian mode (0xFFAA5500 means R=AA,G=55,B=00).
  //LCDC_LPCR_SWAP_SEL_MASK | //Set if needed for LCD data lines match up correctly with the LCD
  LCDC_LPCR_SCLKIDLE_MASK | //Enalbe LSCLK when vsync is idle
  LCDC_LPCR_SCLKSEL_MASK | //Always enable clock
  LCDC_LPCR_PCD(3); //PEILNI: changed from 11 to 3 to 30MHz clock//Divide 120 PLL0 clock (default clock) by (11+1)=12 to get 10MHz clock



  LCDC_LPCR |= LCDC_LPCR_CLKPOL_MASK; //In TFT mode, active on negative edge of LSCLK.

  // set LCD horizontal configuration based on panel data (Figure 3-3 in Seiko datasheet)
  LCDC_LHCR =
  LCDC_LHCR_H_WIDTH(0) | //(41+1)=42 SCLK period for HSYNC activated//PEILNI: changed to fit display timing
  LCDC_LHCR_H_WAIT_1(191) | //(1+1)=2 SCLK period between end of OE and beginning of HSYNC //PEILNI: changed to fit display timing
  LCDC_LHCR_H_WAIT_2(0); //(0+3)=3 SCLK periods between end of HSYNC and beginning of OE

  // set LCD vertical configuration based on panel data (Figure 3-3 in Seiko datasheet)

  LCDC_LVCR =
  LCDC_LVCR_V_WIDTH(0) | //2 lines period for VSYNC activated //PEILNI: changed to fit display timing
  LCDC_LVCR_V_WAIT_1(20) | //1 line period between end of OE and beginning of VSYNC //PEILNI: changed to fit display timing
  LCDC_LVCR_V_WAIT_2(1); //1 line periods between end of VSYNC and beginning of OE

 

And aldo lcdc_color.c. In order to  fit the new 16bpp color scheme. see the comment in line 06 and line 25

 

uint16_t *pointer16;
  int i,n;

pointer16=(uint16_t *)FRAME_START_ADDRESS;
//Loop through top half of screen
  for(i=0;i<SCREEN_YSIZE/1;i++) //PEILNI: in order to get to work this size has to double then expected?
  {
  //One half will be white
  for(n=0;n<SCREEN_XSIZE/2;n++)
  {
  *pointer16=0xFFFF; //White
  pointer16++;
  }

  //One half will be blue
  for(n=0;n<SCREEN_XSIZE/2;n++)
  {
  *pointer16=0x001F; //Blue

  pointer16++;
  }
  }

  //Loop through bottom half of screen
  for(i=0;i<SCREEN_YSIZE/1;i++)  //PEILNI: in order to get to work this size has to double then expected?
  {
  //One half will be blue
  for(n=0;n<SCREEN_XSIZE/2;n++)
  {
  //*pointer32=0x000000FF; //Blue
  *pointer16=0x07e0; //Green
  pointer16++;
  }

  // One half will be white
  for(n=0;n<SCREEN_XSIZE/2;n++)
  {
  *pointer16=0xf800; //Red
  pointer16++;
  }
  }

  /* Create a graphic window filled with the color black*/
  pointer16=(uint16_t *)GW_START_ADDRESS;
  for(i=0;i<GW_BUFFER_SIZE/2;i++)
  {
  *pointer16= 0x2B50; //something
  pointer16++;
  }

 

If I do not add twice as many bytes in the frame buffer (see line 06 and 25 above) I only get half the display see picture(halfScreen.jpg) and if I make the buffer double size (fullScreen.jpg) :

 

Hope for some help.

 

Br. Peter Ilsoe

Attachments

Outcomes