Getting pixel data with ILI9341 lib

Status
Not open for further replies.

KrisKasprzak

Well-known member
All,

I'm using some 2.8" TFT displays and driving them with the ILI9341_t3 library and all works well. My project records voltages and such over time and plots the values on a graph, along with current measurements, times etc.

I'd love to be able to create an image of the screen but I don't see method for capture screen, I was even willing to write my own but need a "getPixel(x,y) method in the lib.

Anyone know if it's even possible to get pixel data?

Thanks in advance.
 
There is a READ function in the _t3 lib:: void readRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t *pcolors);
 
As @defragster mentioned, there is a readRect function, in addition to this there is a readPixel(x, y) function which reads in one pixel...

Note: if you use my version of the library ili9341_t3n and maybe Frank's version, on a T3.5 or T3.6, you have the ability to create a logical frame buffer, where you can do a bunch of operations, which write in memory and then when you want you can tell it to update the screen. With this you can simply find the data in RAM... But that is probably more than you are asking for...
 
Thanks all, i don't know my my doxygen did not list those methods, but thanks for point them out. I looked in the .h and yep--there they are. I liberated some example code elsewhere and i now have a "print screen" capability for my LCD displays.

man i love this stuff....
 
Need some more help....

My PrintScreen() works like a champ, but only on certain displays. I have have 2 different 2.8" tft based on ILI9341 chips

this display returns 65535 upon a call to readPIxel();--regardless of what the pixel is.
https://www.amazon.com/gp/product/B073R7BH1B/ref=oh_aui_detailpage_o07_s00?ie=UTF8&psc=1

This display returs the correct pixel data
https://www.amazon.com/gp/product/B017FZTIO6/ref=oh_aui_detailpage_o07_s00?ie=UTF8&psc=1

Anyone have any idea on what the solution could be?
 
Sorry I am not sure what is not working? Are you having problems reading data from the display or writing to the display? If writing, make sure everything is hooked up properly. Also check backlighting... Also I know that Paul gets in a many of the displays in and they test them before they ship them out as there is a percentage of them that don't work... Also with some of these suppliers, sometimes the display chip is not what they said it was...

Does reading anything work? That is if you run the Example graphictest for the ILI9341_t3 library, what data is printed when the program starts with both displays? Info like: Display Power Mode, and MADCTL Mode: and...

Maybe the MISO pin is not working properly on one display.

If that works, not sure I was going to say maybe a speed issue for reading pixels, but they are both setup to try to read at 2K speed which is nice and slow...
 
Kris, i've seen your wiring in the other thread :) try to reduce the spi to 1MHz - does that work ? If yes, you need *way* shorter connections to the display.
 
Last edited:
I can't get readRect to even work, but then again i struggle with using pointers---see any errors in my code snippet? An image of my PCB is attached, with a small note to where MISO is. Oddly one display works fine on this pcb, the other does not.

board.JPG

Code:
uint16_t *Pixel = 0;
  Display.drawPixel(100, 100, C_BLUE);
  Display.readRect(100, 100, 1, 1, Pixel);
  // never gets to this line
  Serial.println(*Pixel);
 
PS i looked in the lib and withing the .cpp file within the readRect function


SPI.beginTransaction(SPISettings(2000000, MSBFIRST, SPI_MODE0));

I tried making the 2000000 to as low as 50000, still no go.
 
UPDATE:

I got my "bad" displays to read a pixel. Turned out it was a bad solder joint on one of the components on the back of the display. As a last ditch effort i heated up all resistors and caps (and the MISO pin), and the display started working. I actually bought 3, was i could fix, another didn't respond to a resolder--i'm guessing solder mask or something is preventing a connection.

What a pain, but given these things are like $11 not sure I can complain too much.
 
Status
Not open for further replies.
Back
Top