Skip to content

gz_lcd_driver waveform

campbellsan edited this page Sep 27, 2014 · 13 revisions

This core interfaces a touch screen LCD to the Raspberry Pi. To do this, we once again leverage the SPI pins of the Raspberry Pi. Some LCD touchscreen modules use SPI to communicate with the host controller. If you have one of these, then you don't need a Guzunty. You can just wire it up directly to the SPI pins on the Raspberry Pi. All the lower cost LCD modules expose only a sixteen bit parallel interface, however, and this requires more pins than are available on the Raspberry Pi GPIO.

This core works with the wonderful linux framebuffer driver work by notro. You'll find his site [here] (https://github.com/notro/fbtft).

We used the [Sainsmart 3.2 Touchscreen LCD module] (http://www.sainsmart.com/arduino-compatibles-1/lcd-module/sainsmart-3-2-tft-lcd-display-touch-panel-pcb-adapter-sd-slot-for-arduino-2560.html), but there are many LCD modules that have the same pinouts and can be made to work using either a dedicated driver from notro's impressive list or else using his generic flexible framebuffer driver. For the generic driver, you do need to figure out the initialization codes for your display controller.

The waveform shows the clocking in of the 16 bits to be sent to the display. When the last bit (bit zero) has been clocked in, the write signal goes high which causes the display to latch the 16 data bits. The display chip select is simply the SPI CS0 signal inverted.

There are two additional signals required to drive the display, Command/Data (CD or RS) and Reset. These are allocated to two additional Raspberry Pi GPIO pins and do not pass through the Guzunty. For this reason, you must build your Guzunty in its [hybrid] (https://github.com/Guzunty/Pi/wiki/Standard-build-configurations#hybrid) configuration to get easy access to the additional signals. You tell the driver which pins with parameters when you start it using the modprobe command.

Here is the /etc/modules entries which are used at boot time to automatically start the LCD display driver:


ads7846

ads7846_device swap_xy=1 cs=1 speed=2000000 model=7846 x_min=300 x_max=3800 y_min=700 y_max=3400 x_plate_ohms=60 pressure_max=255 gpio_pendown=25 keep_vref_on=1

fbtft_device name=sainsmart32_spi gpios=reset:22,dc:27 rotate=90 verbose=0 speed=32000000 fps=30 txbuflen=65535


The Sega Genesis emulator in the gallery page shot is DGen which is found [here] (http://dgen.sourceforge.net). The Sonic the Hedgehog ROM image is copyright Sega corporation. If you already own a copy, Google is your friend. If you do not, please do not steal game images.

You may notice that the gallery photograph shows a daughter board (see here for more detail) which allows the display to be connected via a 40 way ribbon cable. I can supply these for as long as there is demand. If you would like one, please let me know before ordering a kit so that we can ship everything at once.