public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] LCD on EP7211
@ 2001-01-31 14:43 Wilson Kwan
  2001-01-31 14:49 ` Lewin A.R.W. Edwards
  0 siblings, 1 reply; 7+ messages in thread
From: Wilson Kwan @ 2001-01-31 14:43 UTC (permalink / raw)
  To: ecos-discuss

Hi,

Has anyone been able to get the cirrus 72xx LCD code sample to work
recently? I recompiled the code and checked the values for all of the
control registers in the Cirrus documentation. It looks correct but when I
initialize the ALPS LCD on my EP7211 board I get alot of garbage on the
screen. When I try to clear the screen by writing zeroes to 0xc0000000 my
program just hangs. Any ideas anyone?

Funny thing is that if I try to fill that memory region using cygmon I am
able to do it.

Thanks in advance...

Wilson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] LCD on EP7211
  2001-01-31 14:43 [ECOS] LCD on EP7211 Wilson Kwan
@ 2001-01-31 14:49 ` Lewin A.R.W. Edwards
  2001-01-31 15:10   ` Wilson Kwan
  0 siblings, 1 reply; 7+ messages in thread
From: Lewin A.R.W. Edwards @ 2001-01-31 14:49 UTC (permalink / raw)
  To: Wilson Kwan; +Cc: ecos-discuss

Hi Wilson,

>Has anyone been able to get the cirrus 72xx LCD code sample to work
>recently? I recompiled the code and checked the values for all of the
>control registers in the Cirrus documentation. It looks correct but when I
>initialize the ALPS LCD on my EP7211 board I get alot of garbage on the
>screen. When I try to clear the screen by writing zeroes to 0xc0000000 my
>program just hangs. Any ideas anyone?

The sample code in eCos works A-OK for me (I am using the 7212, but it's 
the same board). Are you 100% certain you have initialized your pointer 
correctly? I tested initially using the Alps grayscale 640x240 LCD and now 
I've interfaced a color QVGA LCD, which is working great! (with tweaking, 
of course).

However I did see some weird behavior with the lcd_printf routine (bad 
characters, garbage characters). Try commenting out all the places in the 
LCD test source that write to display memory; just call that file to init 
the LCD registers. Then try your manual memory write.

=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/

"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] LCD on EP7211
  2001-01-31 14:49 ` Lewin A.R.W. Edwards
@ 2001-01-31 15:10   ` Wilson Kwan
  2001-01-31 15:19     ` Lewin A.R.W. Edwards
  0 siblings, 1 reply; 7+ messages in thread
From: Wilson Kwan @ 2001-01-31 15:10 UTC (permalink / raw)
  To: Lewin A.R.W. Edwards; +Cc: ecos-discuss

Hi Lewin,

Thanks for the quick response.


> The sample code in eCos works A-OK for me (I am using the 7212, but it's
> the same board). Are you 100% certain you have initialized your pointer
> correctly? I tested initially using the Alps grayscale 640x240 LCD and now
> I've interfaced a color QVGA LCD, which is working great! (with tweaking,
> of course).

Do you mean the pointer to the lcd base address? It is set to 0xc0000000.

> However I did see some weird behavior with the lcd_printf routine (bad
> characters, garbage characters). Try commenting out all the places in the
> LCD test source that write to display memory; just call that file to init
> the LCD registers. Then try your manual memory write.

That is exactly what I did. I initialized the LCD and then I wrote a byte to
the display buffer. Result: HANG. I even tried to write to the display
buffer before doing the LCD init and still HANG. Could you send me your init
routine so that I can compare it with mine.

Thanks...
Wilson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] LCD on EP7211
  2001-01-31 15:10   ` Wilson Kwan
@ 2001-01-31 15:19     ` Lewin A.R.W. Edwards
  2001-01-31 16:20       ` Wilson Kwan
  0 siblings, 1 reply; 7+ messages in thread
From: Lewin A.R.W. Edwards @ 2001-01-31 15:19 UTC (permalink / raw)
  To: Wilson Kwan; +Cc: ecos-discuss

Hi Wilson,

The function below is all you should need to turn on the LCD controller. 
For the Alps display, you should define:

#define EP_LCD_WIDTH 640
#define EP_LCD_HEIGHT 240

Also make sure that LCD support was enabled in your eCos config before you 
built the library. I'm not sure what happens if it's not, but I suspect the 
memory allocation for the frame buffer will be screwed, which could easily 
explain why writing to that area hangs the system! Possibly c0000000 
mirrors 00000000 under that case, which means you've just trashed the 
vector table. Nasty :)


/*
	Enable display hardware.
*/
void GDI_Screen_On(void)
{
     cyg_int32 ctl_word = 0;

	// Set up EP7212 LCD controller
	*(volatile cyg_int32 *)PALLSW = 0x76543210;
	*(volatile cyg_int32 *)PALMSW = 0xFEDCBA98;

	// Set LCD controller for grayscale (4bpp) operation
	ctl_word = LCDCON_GSEN | LCDCON_GSMD;

     // Video buffer size
     ctl_word |= ((EP_LCD_WIDTH * EP_LCD_HEIGHT * 4) / 128 - 1) << 
LCDCON_BUFSIZ_S;

     // Line length
     ctl_word |= ((EP_LCD_WIDTH / 16) - 1) << LCDCON_LINE_LENGTH_S;

     // Pixel prescale
     ctl_word |= ((526628 / (EP_LCD_WIDTH * EP_LCD_HEIGHT)) - 1) << 
LCDCON_PIX_PRESCALE_S;

     // AC frequency bias
     ctl_word |= 0 << LCDCON_AC_PRESCALE_S;

	// Write control word
     *(volatile cyg_int32 *)LCDCON = ctl_word;

	#define LCD_DCDC      0x02
	#define LCD_ENABLE    0x04
	#define LCD_BACKLIGHT 0x08
	#define LCD_INIT (LCD_DCDC|LCD_ENABLE|LCD_BACKLIGHT)

	*(volatile cyg_uint8 *)PDDDR   = 0x40;      // 1's are inputs (backwards 
from A/B/E)
	*(volatile cyg_uint8 *)PDDR    = LCD_INIT;  // Enable video + backlight + 
DC-DC converter

	*(volatile cyg_uint8 *)FRBADDR = 0x0C;  // Highest order nibble of LCD 
frame address

	// Enable LCD controller
     *(volatile cyg_uint32 *)SYSCON1 |= SYSCON1_LCDEN;
}
=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/

"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] LCD on EP7211
  2001-01-31 15:19     ` Lewin A.R.W. Edwards
@ 2001-01-31 16:20       ` Wilson Kwan
  2001-01-31 19:01         ` Lewin A.R.W. Edwards
  0 siblings, 1 reply; 7+ messages in thread
From: Wilson Kwan @ 2001-01-31 16:20 UTC (permalink / raw)
  To: Lewin A.R.W. Edwards; +Cc: ecos-discuss

Lewin,

Thanks for the code. I compared it to what I have and it is basically the
same. I put your routine in and I still have the same problem. I get a bunch
of horizontal lines on the screen when I execute the line

*(volatile cyg_uint8 *)PDDR    = LCD_INIT;

When the line

*(volatile cyg_uint32 *)SYSCON1 |= SYSCON1_LCDEN;

runs I end up with alot of garbage on the screen. At this point when I try
to write to the display memory it seems to hang. GDB never returns and I
have to kill the process.

I also tried this with out 7212 board and the same problem occurs. Is there
something in particular I need to set in my eCos configuration to make this
work? I have enabled CYGHWR_HAL_ARM_EDB7XXX_LCD_INSTALLED.

Thanks again for your help...

Wilson

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] LCD on EP7211
  2001-01-31 16:20       ` Wilson Kwan
@ 2001-01-31 19:01         ` Lewin A.R.W. Edwards
  2001-02-01 22:26           ` Wilson Kwan
  0 siblings, 1 reply; 7+ messages in thread
From: Lewin A.R.W. Edwards @ 2001-01-31 19:01 UTC (permalink / raw)
  To: Wilson Kwan; +Cc: ecos-discuss

>same. I put your routine in and I still have the same problem. I get a bunch
>of horizontal lines on the screen when I execute the line
>
>*(volatile cyg_uint8 *)PDDR    = LCD_INIT;

At this point the LCD and backlight are powered and enabled but the 
controller isn't DMAing.

>When the line
>
>*(volatile cyg_uint32 *)SYSCON1 |= SYSCON1_LCDEN;
>
>runs I end up with alot of garbage on the screen. At this point when I try

At this point, the LCD controller starts generating sync and squirting data.

>to write to the display memory it seems to hang. GDB never returns and I
>have to kill the process.

For interest's sake, try doing memcmp(0, 0xc0000000, 0x60). If these bytes 
are all the same then my theory is right about mem being mirrored.

>I also tried this with out 7212 board and the same problem occurs. Is there
>something in particular I need to set in my eCos configuration to make this
>work? I have enabled CYGHWR_HAL_ARM_EDB7XXX_LCD_INSTALLED.

Well, I'm using the Windows graphical config tool. All I did was enable 
this option. Note also that I am using eCos 1.3.1, ie the latest "full 
release" rather than a snapshot. LCD might be broken in the latest version.

Also check that the amount of installed RAM known to eCos is the same as 
that installed on your board. (I don't know if there are multiple versions 
of the board).

=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/

"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ECOS] LCD on EP7211
  2001-01-31 19:01         ` Lewin A.R.W. Edwards
@ 2001-02-01 22:26           ` Wilson Kwan
  0 siblings, 0 replies; 7+ messages in thread
From: Wilson Kwan @ 2001-02-01 22:26 UTC (permalink / raw)
  To: Lewin A.R.W. Edwards; +Cc: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 857 bytes --]

Hi Lewin,

Thanks for the hints and code sample.

> For interest's sake, try doing memcmp(0, 0xc0000000, 0x60). If these bytes
> are all the same then my theory is right about mem being mirrored.

I tried the memcmp and the memory is different, so its not mapped to the
vector table.

After doing a complete rebuild of the cygmon stub and default config I was
able to get the clear screen to work periodically. But now things seems to
not be working once again. The sample program is so simple that I cannot
understand what is wrong. I've attached my code and makefile if you would
like to give it a try. It seems to never get to line 67 in lcd_test.c. Your
GDI_Screen_On() function seems to work perfectly but when I call lcd_clear()
to clear the screen sometimes it works for a while and sometimes it just
hangs. Any ideas?

Thanks for the help...
Wilson

[-- Attachment #2: lcdtest.ZIP --]
[-- Type: application/zip, Size: 8209 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-02-01 22:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-31 14:43 [ECOS] LCD on EP7211 Wilson Kwan
2001-01-31 14:49 ` Lewin A.R.W. Edwards
2001-01-31 15:10   ` Wilson Kwan
2001-01-31 15:19     ` Lewin A.R.W. Edwards
2001-01-31 16:20       ` Wilson Kwan
2001-01-31 19:01         ` Lewin A.R.W. Edwards
2001-02-01 22:26           ` Wilson Kwan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).