How to output resolution other than 1024x768 using VGA board

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

How to output resolution other than 1024x768 using VGA board

Post by itouch » Tue Oct 06, 2009 4:49 pm

Hi folks,

I just bought a VGA board to display at 1024x768 just fine. My question is, does the board handle any other resolution? If so, how do you programmatically change that resolution? Thanks in advance.

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

Re: How to output resolution other than 1024x768 using VGA board

Post by itouch » Tue Oct 06, 2009 5:25 pm

PS:

I found the following LCD initialization procedure for the VGA card at 1024x768. It initializes the LCD controller registers. What values should I use to drive the VGA card at a different resolution? Merely changing the LCD width and height values does not change the VGA mode.

#define LCD_WIDTH 1024
#define LCD_HEIGHT 768
#define LCD_PIXCLOCK 2

#define LCD_RIGHT_MARGIN 15
#define LCD_LEFT_MARGIN 199
#define LCD_HSYNC_LEN 15

#define LCD_UPPER_MARGIN 1
#define LCD_LOWER_MARGIN 1
#define LCD_VSYNC_LEN 1
#define LCD_CON5 ( (1 << 11)| (1<<0)

#define M5D(n) ((n)&0x1fffff)
#define LCD_ADDR ((U32)LCD_BUFFER)

rLCDCON1 = (LCD_PIXCLOCK << 8) | (3 << 5) | (12 << 1);
rLCDCON2 = (LCD_UPPER_MARGIN << 24) | ((LCD_HEIGHT - 1) << 14) | (LCD_LOWER_MARGIN << 6) | (LCD_VSYNC_LEN << 0);
rLCDCON3 = (LCD_RIGHT_MARGIN << 19) | ((LCD_WIDTH - 1) << 8) | (LCD_LEFT_MARGIN << 0);
rLCDCON4 = (13 << 8) | (LCD_HSYNC_LEN << 0);

#if !defined(LCD_CON5)
# define LCD_CON5 ((1<<11) | (1 << 9) | (1 << 8) | (1 << 3) | (1 << 0))
#endif
rLCDCON5 = LCD_CON5;

nicolas
Posts: 162
Joined: Sun Jun 07, 2009 4:32 pm

Re: How to output resolution other than 1024x768 using VGA board

Post by nicolas » Tue Oct 06, 2009 6:46 pm

Linux or win ce?

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

Re: How to output resolution other than 1024x768 using VGA board

Post by itouch » Tue Oct 06, 2009 6:50 pm

Linux or win-ce? Actually, stand alone...

nicolas
Posts: 162
Joined: Sun Jun 07, 2009 4:32 pm

Re: How to output resolution other than 1024x768 using VGA board

Post by nicolas » Tue Oct 06, 2009 7:11 pm

Are you looking at the 'sample code without OS' folder ?
Because the code you posted I cant find anywhere.

Anyways, for the sample code without OS, if you check the lcd.c file it has compile time conditionals for the various lcd's.
Part of those defines are the LCD_XSIZE/LCD_YSIZE and SCR_XSIZE and SCR_YSIZE.
These are what define the resolution in that sample code.

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

Re: How to output resolution other than 1024x768 using VGA board

Post by itouch » Tue Oct 06, 2009 7:15 pm

Nicolas,

Thanks for the response. Yes, I am using the source files in the code without os folders. However, merely changing the resolution values of the LCD does nothing but simply clip the display to that resolution. For example, I tried 1024x600 (my LCD resolution) and the lower portion of the display was clipped to 600. In other words, the VGA card still was outputting at 1024x768.

I want to be able to display a picture (1024x600) and have it take up the full display.

Someone a while ago asked about some missing dip switches on the board, which perhaps could have been used to set the VGA resolution. He never got an answer, however.

It is ironic that the mini2440 is such an open system, except for this bloody board!

nicolas
Posts: 162
Joined: Sun Jun 07, 2009 4:32 pm

Re: How to output resolution other than 1024x768 using VGA board

Post by nicolas » Tue Oct 06, 2009 7:52 pm

When you change those two defines, did you also go thru the lcd.c and change the other drawing code to adjust accordingly ?

For example,

Code: Select all

void TFT_LCD_Init(void)
{

    LCD_Init();
	LcdBkLtSet( 70 ) ;
	Lcd_PowerEnable(0, 1);
    Lcd_EnvidOnOff(1);		//turn on vedio

    Lcd_ClearScr( (0x00<<11) | (0x00<<5) | (0x00) );  

#if LCD_TYPE==LCD_TYPE_N35
	Paint_Bmp(0, 0, 240, 320, sunflower_240x320);
#elif LCD_TYPE==LCD_TYPE_A70
	Paint_Bmp(0, 0, 800, 480, sunflower_800x480);
#elif LCD_TYPE==LCD_TYPE_VGA1024x768
    Paint_Bmp(0, 0, 1024, 768, sunflower_1024x768);
#endif    
}
If you didnt make a new LCD_TYPE or adjust the code, then it would continue to draw the BMP outside your resolution; and thus outside the LCD buffer.

The clipping is because the buffer isnt simply written out for the bigger resolution space defined, as this would be invalid for the screen defined.
Since this is drawing directly to the LCD buffer, you wont get any scaling. The most you can do is limit where the output is made.


Side Note: I see the code does make use of the X/Y resolution defines in some places. Wonder why they didnt make use of the defines everywhere, like in the above posted code.

itouch
Posts: 54
Joined: Mon Jul 27, 2009 5:20 am

Re: How to output resolution other than 1024x768 using VGA board

Post by itouch » Tue Oct 06, 2009 8:00 pm

Nicolas writes "When you change those two defines, did you also go thru the lcd.c and change the other drawing code to adjust accordingly ?"

Yes, I did. I changed the LCD_WIDTH and LCD_HEIGHT in option.h to 1024 and 600. I then tried to output a bitmap 1024x600. The bitmap only took up a portion of the screen. The VGA board is stuck at 1024x768. Changing the display resolution in software does not change that even though the new resolution values are being used in setting up the LCD controller registers. An explanation on how to setup those registers would help.

nicolas
Posts: 162
Joined: Sun Jun 07, 2009 4:32 pm

Re: How to output resolution other than 1024x768 using VGA board

Post by nicolas » Tue Oct 06, 2009 8:43 pm

I fully understand now.

It comes down to the VGA expansion board.
From what Ive been able to find - its a closed source FPGA doing the conversion.
Unless the makers built into it the possibility for other resolutions, I cant find any reference to controlling it.

All the initialization done in software, via the rLCDCON registers is for controlling the LCD driver on the S3C2440 none of it seems to deal with the VGA adapter board. At most, the software simply changes the address at which the buffer is written to.
And since it is the VGA adapter board that truly sets up the resolution on the monitor, unless there is some extra commands that can be sent to the board - i dont see the custom resolution happening.

To find what/how the LCDCON registers are used and setup, see the S3C2440 datasheet.
Chapter 15 deals with the LCD Controller.

Im sorry I cant be of any further help. Ill keep looking around to see if I find anything.

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: How to output resolution other than 1024x768 using VGA board

Post by buserror » Tue Oct 06, 2009 11:09 pm

The vga board was designed to be more powerful, it has DIP switches footprint to change the resolution. Unfortunately in this 'cheap' version it has been cut down and won't work. Even by soldering a new block of DIP (I tried).

So no the VGA board is /fixed/ to 1024x768!

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests