Do you like my hacking? If so, please consider leaving something in the
Fediverse (Mastodon etc): @Sprite_tm@social. spritesmods.com
With an added keyboard, my Carambola now is an interactive, graphical Linux machine.
As stated before, you can download patches to add ssd1289 support to the kernel, plus a supporting patch for the Carambola kernel source. Both are licensed under the GPLv2, like the rest of the Linux kernel.
Happy hacking!
46 commentsVery late to the party, I know, but you could've used a MCP23S17 (SPI) to expand your IO ports. Maybe worth a look on some next project ;) https://www.microchip.com/wwwproducts/en/mcp23017 Cheers!
Awesome hacking! I got this bit of a question: The interface for LCD looks like an intel 8080, which writes/reads data on the edge of the nWR/nRD signals. However according to your hardware design, all data and ctrl signals are carried out at the same time, won't that make the actual data written to the LCD unpredictable?
Haven't you needed some provision not to get out-of-sync (e.g. if you would've missed one or more of the 32 pulses, in which case the video data would've shifted by the same amount of bits, making your video output unreadable) ?
Looking at documentation for the Sainsmart TFT_320QVT board and the 1289 chip. Why can't the 1289's onboard shift registers be used?
hi . i use your circuit for convert spi to parallel .an my lcd use ili9320 controller .what driver can i use for my lcd?
Which kernel options have you enabled for using the framebuffer and the ssd1289 driver ?
Thanks for this wonderful article. I am trying to use this schematic in my 8bit microcontroller circuit. Unfortunatelly it doesn't work. I am not able to deep dive into the linux kernel and understand its spi, therefore i have some questions: 1. The comment in the code says that the spi is using 16bit mode, right? Is this MSB or LSB first? I asume MSB first 2.There are 2 functions for writing the spi in your patch with 2 different buffer sizes. Please correct if I am wrong but one command/data access is 0x00XXYYYY X= values for RD/WR/RESET/..., lowest shift register Y= values for D15..D0 Is this correct? Many thanks!
The electrical circuit is a little bit strange. CD4020 will count 32 cycles and then it will RISE UP its Q5. The LCD CS is active LOW. I wonder how this will work?
For you trying to make the ssd1289 tft display work with a RaspberryPi using spritesmods carambola method look here: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=33679&p=288642
@gagaramba: I think we should move to another forum to start discussing this and exchange files. What about the raspberrypi forum? What I did in more details include: 1. got the 3.6 kernel source from git 2. patched the kernel using the .diff Sprite provides. I had to change the file locations for drivers/video/Kconfig and Makefile for the patch to update these files and the path to drivers/video/ for the patch to create the ssd1289.c file 3. Having the files patched/created run menuconfig and selected the Sprite's mode for ssd1289 4. Then edited the arch/arm/mach-bcm2708/bcm2708.c file and tried to modify it to match Sprite's configuration for Carambola, unfortunately the file is a lot different than Carambola's file. I am at work right now without access to my raspi's files, I can upload whatever I have done later today.
In also tried the circuit as described for RPi WITHOUT success. Has anybody made it work yet for RPi? Hardware questions: why is the 4020 never reset after the first 32bit? Why use RD on display when it is written only?
In also tried the circuit as described for RPi WITHOUT success. Has anybody made it work yet for RPi? Hardware questions: why is the 4020 never reset after the first 32bit? Why use RD on display when it is written only?
Yes it really is a intersting article. i just bought all the stuff and I am going try it with my Raspi. @ xalkideos: Could you please upload your files. We can probably help you or the files could help us to get it to work on RPi.
Very nice article. Unfortunately I don't have a Carambola to try it. But I have a Raspi and an SSD1289 Touch Screen and trying to get it work with the Raspi without success. I have build the circuit in a breadboard, modified the bcm2708.c file, patching the kernel and compiled and installed. Has anyone made it work with a RaspberryPi?
hi ! As I´m new in Linux world, I have a question which could be very stupid... has anyone tried this patch with the Raspberry Pi ? Or can anyone tell me if, and if so, how, I can apply this patch to my Pi ? thx a lot !
Very useful article, thanks! Here is a cheap SPI interface 1.8" Colour TFT-LCD board on ebay (less than CDN$7):http://www.ebay.ca/itm/1-8-Serial-SPI-Interface-TFT-Color-LCD-Module-Display-128-x-160Dots-/170856821451?pt=LH_DefaultDomain_0&hash=item27c7dc32cb
Nice! Any idea if one could avoid the patch and make a kernel module out of your code?
nomis: Whatever brand of chip you use, just use pin 9 to connect to the data-input of the following shift register; that's the one you use to chain these chips.
Hi, I'm trying to convert this to run on a RasPi and have a newbie question. On your schematic you show the CD4094s having DIN and DOUT. On the data sheets for the ones I bought (TI) there is a DATA, but only one, not IN and oOUT. Since you're just feeding the MOSI signal from the host do you think I can just connect the data of all three to MOSI on my RasPi? Thanks.
Hi, I'm trying to rebuild Carambola with your hack. After applying the hacks do I have to make any change with make menuconfig or make kernel_menuconfig to rebuild openwrt with the SSD1289 support ? Regards, Fabian
Hi! I want to do the same thing but for raspberry pi. I have to admit that I'm new to most of this stuff though, so please bear that in mind :) Two questions: 1. 5V line on rpi has max of 300mA current draw- will it suffice? I'm guessing 50mA won't which is maximum for 3V3 line. If it does suffice would you recommend connecting lcd to rpi line through 5V pin or 3V3 with some kind of voltage divider? 2. On the schematic there are capacitors on every ic but not on the lcd itself- I understand you used one, it's just missing on the schematic? If it's so- what kind of cap was it?
Never mind, I got it working with my ATMega now (though it is slow)! I did have to use Q6 on my TI CD4020B (pin 4) though, so you must have a different version of this chip for it to work...
Hmm, strange, according to my scope it should be on Q6. Then again, I haven't got it working yet... Do you know if timing is important for this to work? I'm experimenting with an ATMega at the moment, to get the concept right.
MichelV: Nope. Q1 already divides the incoming signal by 2, so Q5 will be the input signal divided by 32.
You seem to be using Q5 on the CD4020B, but shouldn't that be Q6? (being the 5th bit, as Q starts counting at 1 in the datasheet).
Very good job, what is the max frame / sec you can achieve for 320x240x16bpp with this setup ?
Amazing job, a true smart SW/HW integration. I have seen lazy people using FPGA or Cortex M3 to achieve this ! congrats to you Sprite_tm
MichelV: The diode is to make sure the shift register can only charge the capacitor behind it, in order to reduce flickering when uploading a new image. It's a bog-standard small signal diode. I'd advise putting the display SPI on the hardware SPI line and the touchscreen on software SPI, indeed. Let me know if you succeed, I'm really curious if this works on the Pi too. Ben: Sorry, not a clue. The parallel interface is a remnant of whe sources I borrowed the code from.
Very nice! I ordered a screen and some parts to see if I can get it working on the Raspberry Pi (have you tried that btw?). Two questions though: 1. What is the 1N1418 for? Is it really required? (can't find the part) 2. The raspberry Pi only has one (accessible) SPI port. I presume it's best to use that one for the LCD display and bitbang the touchscreen/SD card interface (as it's bound to have a lot less data on that line)?
Hi, Great work, I have got a AVR32 Board with a Buildroot Linux on it and would like to use this LCD as a FB Device. I only use it in Userspace so far. I read about the 16 Bit Direct I/O mode mentioned in the PatchFile, where do I determine the Control GPIOs WR CS RD .... Is thsi IORESOURCE MEM like .start = Port_E_Pin_1 .end = Port_E_Pin_16 for the Cmd/Data register? Cheers Ben
Leon: That is the definition for the secondary GPIO-based SPI-bus for the touchscreen. The pins for the hardware bus (for the LCD) aren't specifically mentioned in the C-code because they are defined by the hardware.
Hi Sprite Confusion.. +static struct spi_gpio_platform_data spi_gpio_data = { + .sck = RT305X_GPIO_12, + .mosi = RT305X_GPIO_11, + .miso = RT305X_GPIO_13, + .num_chipselect = 1, I was under the impression that the default is: SPI_EN GPIO3 SPI_CLK GPIO4 SPI_DOUT GPIO5 SPI_DIN GPIO6
Leon: I did use the default pins for the LCD shift registers. I used alternate pins (using a GPIO-based SPI-bus) for the touchscreen controller, that's because the Carambola doesn't have a second CS-pin for its SPI-controller.
Hi Sprite Is there a reason that you did not use the Carambola "default" SPI pins?
Sy: I used CD4094s. Just noticed I don't mention that anywhere, and it's not on the schematic either. I'll modify the text a bit so it's a bit clearer.
Awsome mod dude. What shift registers did you use? I'm relatively new to electronics (my coder regret: No.1) and this looks like a pretty sweet project, especially for my RPi.
Awal: I used Kdrive (aka Xfbdev). And nope, that would be if the /cs was connected to the 4th output of the counter. It's connected to the 5th, so it goes low, low, high, and then gets reset to low because the /cs of the carambola is connected to the reset-input of the counter and the end of the packet will reset it.
Very interesting project! Since I'm planning to do that, I have two questions. What X-server did you use on the Carambola board? How do the function ssd1289_spi_write() (sending of 3 bytes through SPI) and LCD /cs-line work together with CD4020 IC? It seems that /cs-line is high since 16th bit (from 24) is sent. So during sending 3 bytes, /cs-line goes low,high,low. But the LCD fetches data during low-high transition.
Avishay: Yes, most LCD controllers support them; the SSD1289 I had does too. Unfortunately, there aren't too many LCDs with those controllers on-board which actually bring the SPI to a pin or pad somewhere... usually all you get is the parallel interface.
Very nice work! I planned to do it myself (actually for almost the same purpose) when my raspi arrives, but it's going to take a while. However, as far as I know, there is no SPI driver for the raspi SOC. Anyway, most intelligent LCDs of this kind support native SPI, so you don't really need all the shift register mess.
Nice work yet again. :)
Yet another brilliant mod from sprite :)
It's a joy to see the results of your work. Thumbs up for running Monkey Island!
would love to do this with the TP-Link series routers they would make cool little toys.
In other words, you are a genius and us lowly mortals have no chance of doing this on our own.
On funny note: many such LCDs (also available as cheap mobile spare parts without stupid PCB, so much more compact) could be rewired to use SPI on their own - without all that horrible external IC mess. Most LCD controllers on modules are generic, capable of 8/9/16/18 bit 8080/6800 bus, eventually also RGB H/V sync bus, and almost all could do SPI, 3 or 4 pin. Newer controllers also sometimes support MIPI DSI, etc. If one carefully looks into datasheet of LCD driver IC - and collates that vs flexible connector out of LCD, they'll soon notice it all revolves around just 3 logic level signals usually known as IM0, IM1 and IM2. So these 3 pins define driver's external interface. If collating LCD chip on glass apparent pinout vs flexible connector of LCD one can usually locate apparent IM0..3 signals. In most lucky case, logic levels on IM0-3 are defined by mere SMD resistors on flexible ribbon itself, so flipping couple of SMD resistors (jumpers) sets controller into SPI mode so you can forget about horrible 16 bit wide something. This needs some checks whether SPI track connected to something sensible on flex connector ofc. Either way, many modules can be converted into "native" SPI mode with minimal soldering and flex ribon track patching. Then you have just plain normal SPI right out of LCD driver and can entirely omit that converter part - most LCD controllers already have SPI operation mode built in. This used by cheap phones and so on.