
320x240 LCD with integrated SSD1289 controller is the most viewed non HDMI/RCA thread in the Screens and displays forum.
I have wanted to add support for this controller to my project for a long time. But I wanted a different interface circuit than the one used in that thread.
Two reasons for this
* Using SPI for the control signals cuts the bandwidth in half.
* The circuit uses CS to latch the data into the LCD controller. Other LCD controllers doesn't support this.
Another benfit is that my circuit gives a completed transfer. Spritemods circuit needs the next byte to latch in the current data.
So, I started small and tested the circuit on the ITDB02-2.8 display which has an 8-bit bus, and that worked fine at 32Mhz.
The plan was to make an 8-bit protoboard, do some more testing and write documentation, but then my soldering iron died on me. So I'm awaiting a new one.
Well, documentation isn't really that much fun, so I skipped ahead and extended the breadboard circuit to try it with my Sainsmart 3.2" display which has a 16-bit bus.
I really get into trouble when there's alot of wires on the breadboard, so I had to write a script to test the circuit.
I needed to know that the circuit worked before I went on with the driver. And yes there was some miswiring

It took me some time to find out that after the script had used the SPI bus lines as GPIOs, I couldn't just reload the SPI controller driver spi_bcm2708.
I had to reboot the computer! I haven't done any investigation into why it behaves like this.
So with a reboot the SPI bus was working properly.
Spritemods had already made a framebuffer driver for this LCD controller, so I copied the initialization sequence from him.
The flexfb driver was extended to support the SSD1289, and in minutes I had a working display.
It was a bit disappointing that I couldn't drive the display at 32MHz. I had to step down to 16MHz. This resulted in ~10fps.
This post indicates that we could use speeds between 16 and 32MHz: http://www.raspberrypi.org/phpBB3/viewt ... 44&t=43442
I will look more into this later, when I'm done documenting what I've done so far.
The next step was to make a dedicated driver for this display: sainsmart32fb. This was a breeze.
Just copy the itdb28fb driver, change all occurences of itdb28fb to sainsmart32fb, add initialization sequence and set_addr_win function. Add section to Kconfig and Makefile and finally add the device to fbtft_device.
A little fight with the init code to get rotation working though.
Commercial
I encourage people writing framebuffer drivers for these small displays, to try the FBTFT project.
With the FBTFT SD-image it is very easy to do driver development: https://github.com/notro/fbtft/wiki/Development
And the flexfb driver can handle a lot of displays without the need for a dedicated driver: https://github.com/notro/fbtft/wiki/flexfb
Touchpanel
The last step was to get the touchpanel to work. I already had some experience with the ITDB02-2.8 display which had a TSC7846 touch controller.
The Sainsmart display had an ADS7843 controller, which is supported by the same Linux driver: ads7846.
Earlier I had extended the FBTFT SD-image with a modified ads7846 driver that can add it's own device. This makes it ideal for testing different setups.
The touch controller has a SPI interface and an IRQ line that signals when pressure is detected. This makes it easy to hook up, and luckily there's two Chip Select lines on the Pi.
Sadly this touchpanel didn't behave as good as the ITDB02-2.8 display. The x values increased as I moved the stylus along the y-axis. The y values was much better.
I got these values when dragging a stylus from edge to edge:
X
Top 350-2800
Middle 750-3200
Bottom 1500-3800
Y
Left 750-3250
Middle 750-3300
Right 750-3250
A quick test with X server proved it hard to use. Hopefully I have received a bad apple or that better calibration can yield a better result.
Testing
I write small test scripts for my displays, making it easy to test them all before each release. So I made one for this as well.
But wait, looking at the test running it was as if the display was out of focus! Escpecially when having the console on screen.
What caused this? Maybe the init sequence had something to do with it. I went to the Sainsmart product page and downloaded the example code.
It was an old version of Henning Karlsen's library. But, no. The display looked the same. The other displays I have is quite sharp, so this wasn't good.
Maybe quality and price goes together here, the display is really cheap: $15.99.
Having fun
Even though this display was a bit disappointing, the joy of getting this to work is reward enough for me.
Now, it's back to that protoboard soldering.
Signal timing
I'm really interested in responses on the interface circuit, escpecially on the timing calculations I have done on the wiki page.
I have tried to find where the timing bottlenecks are. But why can't I drive the SSD1289 at 32MHz as I could with the ILI9325?
I haven't found an answer in the datasheets at least.
Maybe it will be better on a protoboard...
If I only had access to a professional Logic Analyzer...
References
Step-by-step guide and SD-image download: https://github.com/notro/fbtft/wiki
Interface circuit: https://github.com/notro/fbtft/wiki/SPI ... ce-circuit
Display info: https://github.com/notro/fbtft/wiki/LCD-Modules
Touch info: https://github.com/notro/fbtft/wiki/Touchpanel
Driver code: https://github.com/notro/fbtft/blob/mas ... mart32fb.c
Test script: https://github.com/notro/fbtft_test/blo ... pi_test.py