Display

cocasitc4 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Customers using Gumstix OpenEmbedded should go to gumstix.net and the related user wiki

Note: all gumstix verdex motherboards available at gumstix.com are pre-flashed with OpenEmbedded.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Hopefully other people will add some content here, but I'll kick off the fun. I am using gumstix hooked up to two different types of display controllers, which in turn drive a variety of active matrix E Ink displays. One of the controllers uses the framebuffer and LCD peripheral of the pxa, so getting it set up is much like setting up an LCD. The other controller has its own framebuffer and I only had to write userspace software to interface to it.

04/11/2005 - Today I finally got going and spent a few hours getting a small Sony reflective TFT LCD working (mostly) on gumstix. My original plan was to put a connector for this display on a future rev of a little interface board I have, but I just couldn't take looking at that little LCD sitting on my desk with no images on it. What it should really have is a penguin. So anyway, I spent about 2 hours hacking a connector onto the board and soldering it up using wire wrap wires. Then I spent a few hours on the software. Now it mostly works to view PPMs, thought I think I have some bit inversion or something since the colors look funny in a gray scale image, although the white, black, red, green, and blue images look fine.

04/12/2005 - Indeed, the MSB and LSB were swapped on all three colors. I rewired the connector and it works great now. This fix, plus some other minor changes are included in the new tar.gz attached.

11/23/2005 - I've received permission to release the design of a display capable gumstix daughterboard. You can find it here. Hope it is useful for you. It can run an EPD display via an apollo based control board (in case you don't have one of those, you can order one at eInk, plus the reflective Sony display, as well as do some other tricks.

-hgates

Note: more on setting up LCD screens

Setting up the framebuffer on gumstix
You should first do a full build of the buildroot, so that everything is setup, configured, and built to a default state. Then cd into build_arm/linux-2.6.9-rc1-gum and do a

make menuconfig

I usually have previously done an

export ARCH=arm export DEPMOD=/bin/true

so that I dont' have to put those on the make command line.

Device Drivers-> Graphics Support In Graphics Support -> enable: Support for frame buffer device Enable Video Mode Handling Helpers PXA LCD framebuffer support PXA LCD command line parameters

Save your changes, then do a

make clean

There is probably a better way to do this without making clean, but that worked for me. Then cd ../../ and do a make of the whole buildroot. Now either load up the full root_fs_arm or just the uImage to your gumstix and boot to uboot.

The minimum requirements for getting the fb up is to have the kernel set up the right block of memory for it, which needs to be aligned, contiguous, non-cached, etc. On arm, the only way I have seen this work is by having the kernel set it up at boot time. In 2.4 kernels, there were a bunch of files to be changed in the kernel to get the fb set up correctly, but in recent 2.6 kernels on gumstix I have only had to change arch/arm/mach-pxa/generic.c and gumstix.c. Even better, on recent buildroots I have been able to not modify the kernel source at all, instead relying on options setup and the kernel command line. So anyway, the easiest way to tell the kernel how much memory you want for the fb is on the kernel command line, which you can set in uboot. For example:

GUM> setenv bootargs console=ttyS0,115200n8 root=1f02 rootfstype=jffs2 reboot=cold,hard video=pxafb:mode:800x600-16,active GUM> saveenv GUM> reset

Note that later buildroots should set root=1f01

This doesn't set the timing or signal parameters for the LCD controller, it just gets the fb running with an appropriately sized area of memory. I have a shell script which runs on bootup that sets the LCCR registers directly using the pxaregs command line program; something like this:

/root/pxaregs LCCR1_HSW 25 /root/pxaregs LCCR2_EFW 0 /root/pxaregs LCCR3_PCD 10 /root/pxaregs LCCR3_PCP 1
 * 1) !/bin/sh

...etc..

So this doesn't get you a nice bootup screen, but I haven't figured out a great way to setup those registers in the kenel reliably. I'm sure its easy, but I'm a dumbass when it comes to the kernel so what can you do.

See UserPagehgates for pxaregs info.

Setting up the Sony ACX705AKM on gumstix
This is a cute little TFT which seems to be available in volume for cheap. I got a couple from Earth LCD, but I also heard on the mailing list you can get them from electronics goldmine for even less.

GUM> setenv bootargs console=ttyS0,115200n8 root=1f02 rootfstype=jffs2 reboot=cold,hard video=pxafb:mode:240x160-16,active GUM> saveenv GUM> reset
 * First thing to do is set up the hardware. The display uses a 22 pin 0.5mm FPC tail. You can get a connector for it from digikey, part number OR690CT-ND. I sort of glommed it onto a gumstix daughterboard I had around, according to the schematic included in the tar.gz. I modified the voltages of my DC/DC chip to put out 4V and 3V for the display. I haven't hooked up the frontlight yet, but it should probably be driven from a FET instead of straight off the pxa. I used GPIO 81 to be the master enable signal, since I was using it for a similar purpose on another display.
 * Next step is the kernel, which you can read about above.
 * Then comes non-kernel setup. In uboot, set up the pxafb driver to be 240x160 like this:

Note that later buildroots should set root=1f01

I'm sure there is a great way to set up the display timings using the kernel or the bootargs, but I usually just run a shell script at boot time which uses pxaregs to set the LCCRs directly. I've put this script in /etc/init.d/S99sony_init:

/root/pxaregs GPCR2_81 1 /root/pxaregs GPDR2_81 1 /root/pxaregs LCCR1_HSW 6 /root/pxaregs LCCR1_ELW 15 /root/pxaregs LCCR1_BLW 4 /root/pxaregs LCCR2_VSW 1 /root/pxaregs LCCR2_EFW 19 /root/pxaregs LCCR2_BFW 19 /root/pxaregs LCCR3_PCD 10 /root/pxaregs LCCR3_VSP 0 /root/pxaregs LCCR3_HSP 0 /root/pxaregs LCCR3_PCP 1
 * 1) !/bin/sh

These timings and signal polarities are not what I expected from reading the display's data sheet. But after fiddling with the settings a bit, these look way better than my original estimates. In particular, vsync and hsync polarities are different than I thought and the HSW, ELW, and BSW are different as well. With these set as I originally thought they should be, there is a large offset to the image and it runs off the bottom right corner of the active area.

Running this script should get the display ready. Before you can actually show anything, you need to enable the display, which if you set up your hardware like mine would be done like this:

/root/pxaregs GPSR2_81 1


 * Of course this only gets you to the point of having the LCD show whatever is in /dev/fb0; something still needs to put some pixels in the framebuffer so we can see the screen change. Hopefully one of you smart hackers out there will get X or a browser or something going to render into this 240x160 fb, but in the meantime I've written a very simple program to view a binary ppm image. The source is included in the gumstix_acx705akm.tar.gz tarball.


 * The current status:

4/20/2005

6/19/2007: I found that to make the ACX705AKM display properly, I had to set LCCR1_HSW to 17, rather than the value of 6 shown above. At 6, the right edge of the display (viewed with the connector at the bottom) was not properly shown. 17 fixed this for me. --- mark heilpern

Setting the LCCR registers from Kernel
Holly has done all the tough job for interfacing this LCD, including figuring out the timing parameters (it can be real tough sometimes). Here is the u-boot bootargs I use to get the same settings as above but do not run the init script.

console=ttyS0,115200n8 root=1f01 rootfstype=jffs2 reboot=cold,hard video=pxafb:mode:240x160-16,active,hsynclen:7,right:16,left:5,upper:19,lower:19,vsynclen:2,hsync:1,vsync:1,pixclockpol:0,pixclock:216363

that is all. follow Holly's instructions and add this to the u-boot parameters. no need for the init script anymore. You may need to assign a GPIO pin for the SHUTDOWN signal of the LCD if you are not using a hardware button. In that case use pxaregs to specify direction and then set or reset the pin from command line. Cool low level LCD control. I have also interfaced a passive display, please let me know on the mailing list if someone needs information for that. For any other information please read Documentation/fb/pxafb.txt (and framebuffer.txt</tt>, internals.txt</tt> in same directory).

- Bhaskar M

6/8/05 - Another interesting LCD display to try with a simpler hardware interface

Haltedexternal link has an Alps color LCD PDA size display (model LFH8P4032B) with touchpad on sale for 2/$60. The display pinout matches very well with the Gumstix extender board. The bias generator is included too. The only thing missing is the EL inverter for the backlight. See their ad hereexternal link and note that its already been successfully interfaced to a StrongARM running Debianexternal link. I've ordered a couple of these to try with my Gumstix, using the software tips noted above.

- tonedeaf

7/23/2005 -

Connecting a Sharp LQ9D011 LCD to a gumstix
I had a broken Compaq LTE 4/33c laptop sitting around waiting to get pitched, and a gumstix breakout-TH board leftover from a prototype of some other display project. I wasn't losing any sleep with those things sitting next to each other on a shelf, until someone asked a question about how some LCD display intensive software (Qt embedded free) would be compiled for the gumstix. A couple of days later, I had scraped together (literally) a working system, and I thought that someone might find some of the info I pulled together useful. I'm not encouraging this method of hacking together a display if you value your time, but the info here can be extended to almost any display in the parts pile.

I googled for the display pinout, and found it here ( Maltepoeggelexternal link ). This guy had connected the LCD to a VESA connector on a standard PC video card. The page is in German, which I have a passing familiarity with, but the pinouts are in English. Since I had the laptop housing and flexible flat cables, I was able to solder to the FFC (with some scraping of the insulation in key places), but it was quite time consuming. There were some resistors soldered to the FFC that I was able to solder to, so I only had a few places were scraping was necessary, but even then it was a big time user. I'm too embarrassed to take pictures of the mess I made, but I got it working. I also used info from that page to connect the backlight inverter. I powered that by the 12V line from a disk drive power connector, while the LCD and the gumstix breakout board were powered from the 5V line. So, here are the connections that I made to the LCD and inverter board:

Inverter Board --> Power Supply: 1, 2, 4, 5 --> 12V 3 --> GND

LCD small connector (CN2) --> Power Supply: 1, 2 --> 5V 3, 4 --> GND 5 --> (Data Enable, future connection to a GPIO line, currently unconnected)

LCD large connector (CN1) --> Gumstix breakout-TH: 1 --> PCLK (X1-3, Pixel Clock) 2 --> GND 3 --> LCLK (X1-6, Horiz. Sync) 4 --> FCLK (X1-2, Vert. Sync) 5 --> LDD13 (X2-4, Red LSB or R0 on panel to R2 on gumstix) 6 --> LDD14 (X2-5, R1 on panel to R3 on gumstix) 7 --> LDD15 (X2-7, Red MSB or R2 on panel to R4 on gumstix) 8 --> GND 9 --> LDD08 (X2-6, Green LSB or G0 on panel to G3 on gumstix) 10 --> LDD09 (X2-10, G1 on panel to G4 on gumstix) 11 --> LDD10 (X2-1, Green MSB or G2 on panel to G5 on gumstix) 12 --> GND 13 --> LDD02 (X1-9, Blue LSB or B0 on panel to B2 on gumstix) 14 --> LDD03 (X2-8, B1 on panel to B3 on gumstix) 15 --> LDD04 (X1-8, Blue MSB or B2 on panel to B4 on gumstix)

When I soldered to the resistors, all of the pixel data pins were available, as well as the pixel clock line. The resistors weren't in the order that I expected, so I'll list them here, as well. Going from Resistor 1 to Resistor 10, the were connected to pins 1, 7, 5, 6, 11, 9, 10, 13, 14, 15 on CN1. If anyone can see an ordering there, they are better at pattern recognition than I am.

Anyway, once I got the display hooked up, I had to mess around with the parameters I passed to the pxafb module a bit to get the display to settle down. I ended up with this (the options are all on one line) in my /etc/modules file:


 * Enable the framebuffer

pxafb options=mode:640x480-16,active,hsynclen:120,vsynclen:1,left:100,right:10,upper:34,lower:2,pixclock:26000,hsync:1,vsync:1,outputen:1,pixclockpol:0

After getting a couple of little shocks from touching the inverter board while it was running by mistake, I mounted the whole thing back in the display shell from the laptop and glued it to an old SCSI housing that I was using for it's power supply. I glued the gumstix to the front of the box because I made the wires too short to mount inside the box (Doh!) and it seems to be stable enough to put back on the shelf. Enjoy!

-jwalters30

12/5/2005 -

Connecting a Panasonic EDMGRB8KJF LCD to a gumstix
Before I outline anything, I think it is worth mentioning several times that the pxafb driver doesn't work in any mode except 16-bit color. Or at least that was my experience, and I tried multiple screens with no results. No monochrome LCDs will work, and no matter how you set it up, setting pxafb to 8-bit color produces nothing. So this is a 8-bit screen, but put the driver in 16-bit mode. Now that we're clear on that...

Electrical Connections:

LCD 5,15,17,19 : GND LCD 10,11,13,18 : 3.3V (from separate regulator

LCD : PXA 1,D7 : LDD15 2,D6 : LDD14 3,D5 : LDD13 4,D4 : LDD10

6,D3 : LDD9 7,D2 : LDD8 8,D1 : LDD4 9,D0 : LDD3

12,CP : PCLK

14,LOAD : LCLK

16, DISP : GPIO16 (PWM0)

20, FRM : FCLK

Driver settings - some of these may not be necessary, but they work (enter this at the uboot prompt followed by saveenv to save these settings): setenv bootargs console=ttyS0,115200n8 root=1f02 rootfstype=jffs2 reboot=cold,hard video=pxafb:mode:640x480-16,passive,color,hsynclen:3,right:5,left:7,vsynclen:39,pixclock:80000,hsync:1,vsync:1,pixclockpol:1

After it boots, I run this script:

pxaregs GPCR0_16 1 pxaregs GPDR0_16 1 pxaregs GPSR0_16 1

to bring up the DISP line to enable the LCD.

Here is the result of `pxaregs lccr`</tt> after it is all set up: pxaregs LCCR LCD Controller Control Register 0 (7-23) LCCR0 0x00300879 00000000 00110000 00001000 01111001 LCCR0_ENB 1 LCD controller enable LCCR0_CMS 0 LCD monochrome operation enable LCCR0_SDS 0 LCD dual panel display enable LCCR0_LDM 1 LCD disable done IRQ disable LCCR0_SFM 1 LCD start of frame IRQ disable LCCR0_IUM 1 LCD fifo underrun error IRQ disable LCCR0_EFM 1 LCD end of frame IRQ disable LCCR0_PAS 0 LCD active display enable LCCR0_DPD 0 LCD send 8 pixel on L_DD7:0external link at each clock LCCR0_DIS 0 LCD controller disable LCCR0_QDM 1 LCD quick disable IRQ disable LCCR0_PDD 0 LCD palette DMA request delay LCCR0_BM 1 LCD branch start IRQ disable LCCR0_OUM 1 LCD fifo underrun IRQ disable LCD Controller Control Register 1 (7-26) LCCR1 0x06040a7f 00000110 00000100 00001010 01111111 LCCR1_PPL 639 LCD pixels per line (+1) LCCR1_HSW 2 LCD horizontal sync pulse width (+1) LCCR1_ELW 4 LCD end of line pixel clock wait count (+1) LCCR1_BLW 6 LCD beginning of line pixel clock wait count (+1) LCD Controller Control Register 2 (7-28) LCCR2 0x000099df 00000000 00000000 10011001 11011111 LCCR2_LPP 479 LCD lines per panel (+1) LCCR2_VSW 38 LCD vertical sync pulse width (+1) LCCR2_EFW 0 LCD end of frame line clock wait count (+1) LCCR2_BFW 0 LCD beginning of frame line clock wait count (+1) LCD Controller Control Register 3 (7-31) LCCR3 0x04400003 00000100 01000000 00000000 00000011 LCCR3_PCD 3 LCD pixel clock divisor (+1) LCCR3_ACB 0 LCD AC bias pin frequency (+1) LCCR3_API 0 LCD AC bias pin transitions per interrupt LCCR3_VSP 0 LCD L_FCLK vertical sync polarity active low LCCR3_HSP 0 LCD L_LCLK horizontal sync polarity active low LCCR3_PCP 1 LCD data sampled on falling edge of L_PCLK LCCR3_OEP 0 LCD L_BIAS output enable active low LCCR3_BPP 16 LCD bits per pixel LCCR3_DPC 0 LCD double pixel clock rate at L_PCLK

Holly's code for displaying ppm files wouldn't compile for me unfortunately, so I hacked it up into a stripped-down version that compiled - I'll try to attach it.

It works, but there is either some noise in the line or something is soldered together because I've got some funny vertical lines of pure red, green or blue staggered through the display.

I'm new to this TikiWiki? thing, so if this post violates some etiquette or rules, please feel free to edit or remove it.

-zwheeler

Hi, I compiled the ppmv program, and discovered the pnm file had to be the same horiz resolution as the screen. i.e. a narrower pnm picture would get scattered across the screen. I hacked the program a little to make it display smaller horiz res pictures, and put in on the frame buffer memory at (x,y) coordinates args. Its set up here for a 16 bit display && an LCD of 320*240 (but these are #defines so change them as you will)

-robin48gx

08/6/2006 -

Connecting a Panasonic EDMGRB8KJF LCD to a gumstix
(another setup)

Hi, just so noone is confused again like me with the Panasonic LCD here are the connections i did on my setup and it works pretty well.

LCD 5,15,17,19 : GND LCD 10,11,13,18 : 3.3V (from separate regulator)

LCD Gumstix > 1, D7 LDD7 2, D6 LDD6 3, D5 LDD5 4, D4 LDD4

6, D3 LDD3 7, D2 LDD2 8, D1 LDD1 9, D0 LDD0

12, CP PCLK

14, LOAD LCLK

16, DISP GPIO 16 (PWM0)

20,FRM FCLK

Here is the bootargs setup i have.

console=tty0 console=ttyS0,115200n8 root=1f01 rootfstype=jffs2 video=pxafb:mode:640x480-16,passive,color,hsynclen:3,right:5,left:10,vsynclen:39,pixclock:100000,hsync:1,vsync:1,pixclockpol:0

After all this just run the lines that "zwheeler" descibed

pxaregs GPCR0_16 1 pxaregs GPDR0_16 1 pxaregs GPSR0_16 1

If you don't want to enter any "pxaregs" lines at all in order to enable the LCD follow the procedure below to enable these pins from U-Boot.

First of all turn on Gumstix and as soo as the U-boot count down begins press any key to enter into the command prompt of U-Boot.

Type the following

setenv enable_lcd "mw 40e00024 00010000; mw 40e0000c c183b9f8; mw 40e00018 00010000"

These lines will create a new variable and put in that variable the commands needed in order to enable the LCD. If you want to learn in more detail how these lines are created then follow the tutorial that Dave Hylands has prepared on the following link : robostix uboot.

After these lines you will have to envoke the "enable_lcd" from "bootcmd", so type the following

setenv linux "fsload a2000000 boot/uImage;bootm a2000000"

Which will define "linux" as the booting variable.

Then as the final step type

setenv bootcmd "run enable_lcd; run linux"

And save the environment by entering

saveenv

Now you should have the LCD going ON even before Linux starts to Boot.

I hope that this helps someone.

(the info was given to me by Jean-Francois? Richard) from the Gumstix Mailing list.

-acroman