Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 5 months ago.
Reading from ILI9341 using 4 pin SPI
Hi, I am using Raspberry pi to talk to the ILI9341 controller. While I am able to write to the ILI9341 , display images and stuff, I am not able to read anything back from the controller including the ID. I saw the following pieces of code in ur program and have some follow up questions.
int SPI_TFT_ILI9341::Read_ID(void){ int r; r = rd_byte(0x0A); r = rd_byte(0x0A); r = rd_byte(0x0A); r = rd_byte(0x0A); return(r); }
char SPI_TFT_ILI9341::rd_byte(unsigned char cmd) { char r; _dc = 0; _cs = 0; SPI::write(cmd); mbed lib _cs = 1; r = SPI::write(0xff); _cs = 1; return(r); }
Questions:
1) You are sending command 0x0A to read ID . As per the spec 0x04 or oxD3 is the ID command. 0x0A is Read Display Power Mode 2) in rd_byte function , what do the following two lines accomplish _cs = 1; r = SPI::write(0xff); _cs = 1;
Should this not be
_dc = 1; r = SPI::write(0xff); _cs = 1;
In sending a read command to the ILi9341 is 0xFF the first parameter to this command before doing the reads. Please clarify this.
Question relating to:
