2.2" TFT LCD Breakout Board

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

2.2" TFT LCD Breakout Board

Postby rmm200 » Sat May 05, 2012 4:17 pm

The Tutorial acknowledges that the sample program will have to be modified for the SPI pinout on the Mega 2560, but it does not mention that the Uno pinouts are hard coded in the HX8340B driver also. A couple of sample lines from ::begin are: pinMode (13, OUTPUT); and pinMode(11, OUTPUT); clkpinmask and datapinmask also use these pin numbers. At the end of that driver, there is an if defined section that lists most Arduino models, but not the Mega 2560. No idea what to change here...

With the current driver, hardware SPI mode just results in a blank screen. My reaction was Oh no - bad hardware! Funny part was SD card access worked fine. Hardware SPI is required to work to use the SD card.

Using software SPI, I could at least see most tests working. Some like testfillrects fail to a white screen (no test after a failing test work).
Based on what I see in the HX8340B driver, I think this is probably lack of Mega 2560 support also.

Finally my request: Can we get the HX8340B driver upgraded to support the Mega 2560, or at least warn folks in the tutorial that it won't work? Would save others a lot of time.

Really nice display and worth the pain...
rmm200
 
Posts: 7
Joined: Sun Jan 30, 2011 5:31 pm

Re: 2.2" TFT LCD Breakout Board

Postby adafruit » Sat May 05, 2012 4:51 pm

we'll update the tutorial soon (no ETA) thanks!
User avatar
adafruit
 
Posts: 10491
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: 2.2" TFT LCD Breakout Board

Postby rmm200 » Sat May 05, 2012 5:47 pm

Don't give up on the library Adafruit_HX8340B.cpp yet.
The "Arduino.h" header file (which you include) brings in a board-specific arduino_pinouts.h. MOSI and SCK are correctly defined for all boards.
Simply replacing 13 (two places) with SCK, and 11 (two places) with MOSI gets hardware SPI working on the Mega2560, and should not affect the UNO.
Sure made my day...

Edited to add - My Rose displays now! Gorgeous display!
rmm200
 
Posts: 7
Joined: Sun Jan 30, 2011 5:31 pm

Re: 2.2" TFT LCD Breakout Board

Postby pburgess » Sat May 05, 2012 9:12 pm

Just edited the library with rmm200's changes (thanks!), and the tutorial page will be refresh shortly.
User avatar
pburgess
 
Posts: 1343
Joined: Sun Oct 26, 2008 1:29 am

Re: 2.2" TFT LCD Breakout Board

Postby kscharf » Tue May 08, 2012 9:21 pm

I downloaded the library from github and unzipped it into my library directory under arduino-1.0. I had to rename the directory as the '-' were not liked by the IDE. After one false start I also downloaded the GFX library and had to rename that too.
Is this a problem with Arduino 1.0 only?

After looking at the code closely, I think it will work fine with the atmega1284p as well as the megas and standard Arduinos. Very clever though the mega case would work fine with the '328 as well since SCK and MISO port and pin lookup functions should be defined for those in the Arduino framework.
User avatar
kscharf
 
Posts: 136
Joined: Wed Sep 10, 2008 9:29 am

Re: 2.2" TFT LCD Breakout Board

Postby paularmitt » Tue May 15, 2012 3:10 pm

Hi,

I've got a question about this LCD..

I bought 5 of these for a work project, intending to write a driver for the beaglebone, based on an existing st7735 frame buffer driver..

Comparing to the hx8340 datasheet, the registers & the spi protocol used in your example code are completely different. Your example makes use of a weird 9 bit SPI that I can't really do in hardware, whereas the actual hx8340 datasheet (p51,52) can use 8bit spi & the first byte of each transfer to flag whether data / command index is being sent.

The actual display data sheet for the btl221722 LCD module you're using matches your driver perfectly tho, and does say hx8340b..

I can't reconcile the two, and wondered am I missing something - or have I really got to bit bash the entire 50k or so of data each frame?? If it really is a hx8340 based display, what are configuration inputs im0 & im2 connected to??

Thanks,

Paul
paularmitt
 
Posts: 1
Joined: Tue May 15, 2012 2:47 pm

Re: 2.2" TFT LCD Breakout Board

Postby adafruit » Wed May 16, 2012 9:53 am

the im0 etc pins are hard wired on the tft itself for 9 bit spi, it cant be set for 8 bit at all!
User avatar
adafruit
 
Posts: 10491
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: 2.2" TFT LCD Breakout Board

Postby kscharf » Wed May 16, 2012 10:43 am

The library code for this board is correct, it does a 9 bit transfer by bit banging the first bit and then sending the remaining 8 in hardware. This works on the AVR because you can access the pins connected to the SPI interface directly. I would think most other microcontrollers can do this as well. The 9 bit SPI transfer does save you one wire connection between the module and the procesor (unless you want to use the SD card as well in which case you need to add 3 extra lines for the SDCS, SDR/S, and MISO lines) The library doesn't seem to support read back of the display, I wonder if the HW supports that?
User avatar
kscharf
 
Posts: 136
Joined: Wed Sep 10, 2008 9:29 am

Re: 2.2" TFT LCD Breakout Board

Postby ktownsend » Thu May 17, 2012 6:31 pm

Kevin:

Almost all of these small displays are write-only in SPI mode, including this one.
ktownsend
 
Posts: 201
Joined: Thu Nov 05, 2009 1:18 am


Return to Glowy things (LCD, LED, TFT, EL) purchased at Adafruit

Who is online

Users browsing this forum: mibignistinly and 9 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [107]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]