tungl
Posts: 4
Joined: Mon Jan 27, 2014 1:31 pm
Location: Germany

New to SPI - How to read data

Mon Jan 27, 2014 1:45 pm

Hi,

a few days ago, I've bought a small 2" TFT display with an ILI9341 controller. In my case it's configured to use a four-pin SPI interface. As a start I'm trying to read the manufacturer ID, just to make sure the SPI connection is working. The procedure is described in the data sheet on page 91.
I'm using Python and spidev to communicate with the display but I'm not sure how to do it correctly.
I pull the DC pin to low to indicate a following data command, then I use xfer2 to send 0x04. Can I expect three bytes of data as a response then? And how do I read them?

I've already done some unidirectional (write only) SPI communication with some standard 2x16 character LCD display which works fine, but I'm absolutely clueless how to correctly receive data over SPI.

Thanks,
Martin

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: New to SPI - How to read data

Tue Jan 28, 2014 11:33 pm

All you need to do is open /dev/spidev0.0 or /dev/spidev0.1 for r/w and then start wring and reading data.

http://www.raspberrypi.org/forums/viewt ... 44&t=65743
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

Return to “Interfacing (DSI, CSI, I2C, etc.)”