some troubles with ili9341, spi connectivity issues?
while trying out the graphics test
the ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog i’m using is something like this http://www.ebay.com/itm/New-240×320-SPI … 1863818914
and working via spi interface with an additional C/D pin (command / data) – i read somewhere that some boards are hardwired for 9-bits SPI, need to figure out if it may be the case. for now it doesn’t seem so
i run into various register read and spi issues the register reads seem to vary between 2 consecutive read attempts separated by a delay and that i need to issue a sleep out and display on command before any graphics test would work
Display id: 0x0,0,0
Display status: 0x0,0,0,0
Display Power Mode: 0x8
MADCTL Mode: 0x0
Pixel Format: 0x6
set pix format 16 bits
Pixel Format: 0x5
Image Format: 0x8
Self Diagnostic: 0x0
sleep out << issue sleep out command
Display id: 0x0,0,0
Display status: 0xC0,0,0,0
Display Power Mode: 0x98
MADCTL Mode: 0x0
Pixel Format: 0x0
set pix format 16 bits
Pixel Format: 0x0 << invalid values of pixel format
Image Format: 0x0 << invalid values of image format
Self Diagnostic: 0x0 << incorrect values of self diagnostic status 0xC0 is expected after doing a sleep out command
display on << issue display on command
sleep out << issue sleep out command
ILI9341 Test!
Display id: 0x0,0,0
Display status: 0xC0,0,0,0
Display Power Mode: 0x9C
MADCTL Mode: 0x0
Pixel Format: 0x6
set pix format 16 bits
Pixel Format: 0x5
Image Format: 0x9C
Self Diagnostic: 0xC0 << now it looked a little more sane
Benchmark Time (microseconds)
Screen fill 682875 << note the graphics test terminates midstream on the lcd leaving a blank screen
Text 89295
Lines 510067
Horiz/Vert Lines 58799
Rectangles (outline) 39863
Rectangles (filled) 1418504
Circles (filled) 348216
Circles (outline) 393844
Triangles (outline) 120584
Triangles (filled) 541684
Rounded rects (outline) 144681
Rounded rects (filled) 1590095
Done!Replies
the values of the read (lcd) registers function seem to return different values with each set of consecutive call, (no reset, no display on, no sleep out etc) something else seemed amiss
isplay id: 0x0,0,0
Display status: 0x0,0,0,0
Display Power Mode: 0x8
MADCTL Mode: 0x0
Pixel Format: 0x0
set pix format 16 bits
Pixel Format: 0x0 << all zeros
Image Format: 0x0 << all zeros
Self Diagnostic: 0x0
Display id: 0x0,0,0
Display status: 0x0,0,0,0
Display Power Mode: 0x8
MADCTL Mode: 0x0
Pixel Format: 0x6
set pix format 16 bits
Pixel Format: 0x5<< looked more sane (note this is deliberately set for value 0x55, but actually 0x05 is retrieved)
Image Format: 0x8 << looked more sane
Self Diagnostic: 0x0
Display id: 0x0,0,0
Display status: 0x0,0,0,0
Display Power Mode: 0x8
MADCTL Mode: 0x0
Pixel Format: 0x5
set pix format 16 bits
Pixel Format: 0x5
Image Format: 0x8
Self Diagnostic: 0x0
Display id: 0x0,0,0
Display status: 0x0,0,0,0
Display Power Mode: 0x8
MADCTL Mode: 0x0
Pixel Format: 0x5
set pix format 16 bits
Pixel Format: 0xFF << all 0xFF !
Image Format: 0xFF << all 0xFF !
Self Diagnostic: 0xFF << all 0xFF !Any problems there indicate unreliable SPI connections e.g. loose or broken wire.
Which version of the IDE are you using? Early “MapleCore” versions crash with the F() macro.
David.
i’m using the ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog _STM library pretty much from the existing F1 core
https://github.com/rogerclarkmelbourne/ … LI9341_STM
as for SPI i’m using this library
https://github.com/rogerclarkmelbourne/ … raries/SPI
basically made a copy of Adafruit_ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog _STM.cpp and running it ‘locally’ within the same app so that i can insert more statements to figure out the issues.
currently i’m doing my version of readcommand8(uint8_t cmd, 0) that doesn’t issue that ‘sekret’ command :lol:
and modified slightly (enclosed below) so that i can return multiple parameters, for the read-commands e.g. ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog _RDDST, the ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog can actually return several bytes of responses. hence the modification.
/*
params
buf[] u'd need to provide an array of bytes to store the results returned from ili9341
c - this is the ili9341 command
n - how many bytes to read and insert in buf[] from the response
*/
void Adafruit_ILI9341_STM::readcommandx(uint8 *buf, uint8_t c, int8 n) {
uint index = 0;
if (hwSPI)
spi_begin();/*
SETDC_CMD();
CS_ENABLE();
spiwrite(0xD9); // woo sekret command?
SETDC_DATA();
spiwrite(0x10 + index);
CS_DISABLE();
*/
SETDC_CMD();
CS_ENABLE();
//if(hwSPI) digitalWrite(_sclk, LOW);
spiwrite(c);
SETDC_DATA();
SPI.transfer(0x00); //the first 8 bits/clocks are dummy clocks
for (int i = 0; i < n; i++) {
uint8 b = SPI.transfer(0x00);
*(buf+i) = b;
}
CS_DISABLE();
if (hwSPI)
spi_end();
}i’d need to slowly debug this, i made my ‘custom’ readcommandx function return an extra byte, more than the spec, so far it doesn’t seem to say that my ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog is hardwired for 9bits spi, i tend to get both 0xff or 0x00, which for now didn’t mean anything in particular :lol:
It uses 8-bit SPI. Connect all the pins. Use the full constructor().
Make sure that you have solid connections. i.e. good header sockets.
David.
swapped the pins and now it works :D
surprisingly while now graphics test runs to completion, the varying values from lcd register reads commands persists, i.e. it still varies between consecutive sets of reads, the first reads after the graphics test run apparently reflect the correct values, after that it varies to 0xff and 0x00
what i observed with my tests is that after running the graphics test and issue 0x09 read status, the status is correct / expected
however, subsequent same command and read start to ‘drift’ and i’d either get 0x00 or perhaps sometimes 0xff. 0xff is particularly observed after a reset and then issuing a display on and sleep out command. but a next read all that become 0x00
however despite all these goofy status bytes, currently graphics tests run to completion
there is some ‘magic’ in that initlal reset at tft.begin() and the initialization codes :lol:
for now i still don’t really understand spi e.g. is the spi clock running even if there is no SPI.transfer(0x00) command? and if after issuing the command, would there be circumstances where the lcd take more spi clocks before providing a response (the specs didn’t seem to suggest it)? other things that might influence the results are like timings as D/C and CS pins are gpio pins and the notion of ‘sekret’ command, i noted that issuing the ‘sekret’ command prior do not fix the invalid returned status. my guess is that there’s possibly something more i’d need to learn about spi and that it seem some information is not documented in the ‘reference manual’ for ILI9341ILI9341Displays, touch panels and LEDs… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…View in hardware catalog (in particular some of those ‘magic’ cryptic commands found in tft.begin() are not documented in the reference manual)
just 2 cents
;)
You can read reg(0x04), reg(0x09) and GRAM registers directly.
You need the ‘sekret’ command to read multi-byte registers like ID (0xD3) or GAMMAP (0xE0)
As far as I can remember, the Adafruit code reads registers correctly. Use the full-fat method for index into a multi-byte register.
David.
