Welcome

Hardware

The first problem I had was that the LCD has a 16-bit parallel interface. That's lovely and all, but I didn't have 16+ GPIO pins to drive, and even if I had that amount of pins, I didn't want to lose all my processing time actively turning them on or off. The only port on the Carambola that actually was low pincount but fast enough to interface to, and didn't require too much hardware to interface with, was the SPI port. Now, the LCD controller itself does have a SPI interface, but unfortunately none of the LCDs I saw actually brought that out to something I could solder to. I would have to think up some logic to go between the 16-bit parallel interface and the SPI port.

The usual way to get a lot of parallel outputs from a SPI port is by using some shift registers, which is what I did:

If you know how shift registers work, part of this schematic should be very familiar: the shift registers (which are CD4094s, by the way) are cascaded so that if the Carambola clocks three bytes out of its SPI port, the bits end up inside each shift register. The strobe of the shift registers is connected to the /cs-line of the LCD interface: the effect is that as soon as that line goes down, the shift registers will keep outputting what was clocked into them and the LCD will react to those values. This way, by clocking 3 bytes into the shift register and lowering the strobe-line, 16 bits of command- or pixeldata can be sent to the LCD.

In this circuit, the strobe line isn't connected directly to the Carambola, though. In my first iterations, it actually was directly connected, and every pixel would involve sending a packet of tree bytes over the SPI-bus, finishing with lowering the strobe-line. Unfortunately, it seems sending such packets has quite a bit of overhead: it's way quicker to send 1000s of bytes at the same time. That's what the CD4020 is for: it will count 32 clock cycles (aka 4 bytes) and then automatically lower the CS-line. That way, by sending instructions as 4 bytes, I could bypass the overhead of sending the data as separate packets.

The touchscreen chip that's integrated on the LCDs PCB has its own SPI-interface. On the Carambola, I implemented this using a couple of free GPIOs and the GPIO-SPI-module to make the Linux-kernel emulate a second SPI-bus on these.

I saw the PCB on the back of the LCD had a fair amount of ground plane, so I decided to wire everything up dead-bug style:

On the PCB, you also may notice some capacitors and a LM1117-3.3: the 3.3V line I used to feed the Carambola didn't have enough power to feed the LCD too, so I gave the LCD its own regulator and just feed it off 5V.

Now the hardware was ready, all I had to do was write a kernel driver so Linux would recognise this contraption as a valid display device.

« Prev 2 Next »


© 2006-2022 Sprite_tm - Contact