TFT - D/C
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mike808
- Posts: 74
- Joined: Sat May 25, 2013 10:22 pm
TFT - D/C
Hi, I puchased a TFT display (http://www.adafruit.com/products/1480) and it works well with my Arduino. I am currently writing some code on my Raspberry Pi to drive this display and to learn more about SPI. When using with the arduino, I had pin 8 connected to D/C pin on the display. What is D/C and what would that map to on the Raspberry Pi? From looking at the code, i'm guessing it has something to do with the hardware SPI which I would want to take advantage of for performance. thank you!
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: TFT - D/C
D/C selects data or command mode when writing to the display. Set D/C low before writing a command, set D/C high before writing data.
- mike808
- Posts: 74
- Joined: Sat May 25, 2013 10:22 pm
Re: TFT - D/C
What speed and bits_per_word should i be using when communicating with SPI and this display?
Code: Select all
struct spi_ioc_transfer spi[length];
int i = 0;
int retVal = -1;
// one spi transfer for each byte
for (i = 0 ; i < length ; i++)
{
spi[i].tx_buf = (unsigned long)(data + i);
spi[i].rx_buf = (unsigned long)(data + i) ;
spi[i].len = sizeof(*(data + i)) ;
spi[i].delay_usecs = 0 ;
spi[i].speed_hz = ???; // <-- what to put here?
spi[i].bits_per_word = ???; // <-- what to put here?
spi[i].cs_change = 0;
}
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: TFT - D/C
The value for bits should be 8. You want to format your data as shown in 4-line 18-bit mode on page 63 of the datasheet
http://www.adafruit.com/datasheets/ILI9340.pdf
I didn't spot any specific instructions on the data clock rate in the datasheet, but you should be OK at 400kHz. Once you get that working, try 800kHz, and then keep bumping it up from there.
http://www.adafruit.com/datasheets/ILI9340.pdf
I didn't spot any specific instructions on the data clock rate in the datasheet, but you should be OK at 400kHz. Once you get that working, try 800kHz, and then keep bumping it up from there.
- mike808
- Posts: 74
- Joined: Sat May 25, 2013 10:22 pm
Re: TFT - D/C
I've been banging my head on this and can't get it to work. Are there any userspace example programs that demonstrates this? I've tried frequencies from 400kHz 1000kHz with no success. I'm not sure what I'm doing wrong and would very much appreciate some help please.
Please be positive and constructive with your questions and comments.