Building an LCD TFT library for Arduino DUE

The purpose of this post is to present the building of a library that allows to connect an LCD TFT module to the Arduino Due.

There are so many LCD TFT chips out there and each one has unique configuration requirements, that it is not practical to build here a library that could be use with different LCDs but only the one presented here and compatibles.

This application uses the External Bus Interface (EBI) called Static Memory Controller (SMC) inside the SAM3X8E to handle the LCD module.

I will port the LCD library and one example of the SAM3X/SAM3U evaluation boards from the ASF Atmel to Arduino DUE.

I think it is important to mention that the only 'general purpose' SMC parallel library for Due that I have found in the forum is the one by delsauce, which I haven't try yet: (Parallel library for Due External Memory Bus/Static Memory Controller - Arduino Due - Arduino Forum).

I will use a 240RGB x 320 dot LCD integrated with the HX8347A chip controller. The same one used in the mentioned Atmel boards. The library will consist of the HX8347A files (.h, .cpp) and a configuration file (.h). The library invokes the smc library. The example will draw pictures and strings on the LCD. This porting also covers the XY touch screen capabilities of the LCD. It will be is required an ADS7843E controller.

The beautiful of the HX8347A LCD is that the 2x18 connector 'almost' fit the Due one. I say almost because if everything goes accordingly, the board will be shifted one column to the right. A couple of small power jumpers and one 100K resistor will be also needed. The building of a shield will be necessary to avoid obstruction with the DUE connectors.

That said, let’s start the porting.

PART I. Raw Porting from the Original

Hardware needed:

  • Arduino Due
  • LCD EM-LCD28TP.

I have decided to start this porting using the original pin/register definitions. The idea here is to stick as close as possible with the original application (hardware and software). Remember that the SAM3X/3U-EK board's cores are close siblings of the Due's core and the LCD is the same. This implies few changes to be made at the beginning. For example, I had to re-defined 3 pins (data and CS) used in the original code given that those pins are not connected in the Arduino Due.

Before make a stop, here a picture of the pinout inter-connection and the Arduino DUE with the LCD. So far, the initial raw LCD library works OK despite the rat's nest. I will create and upload in Github the LCD library files and example sketch very soon.

P