Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: Getting pixel data with ILI9341 lib

  1. #1
    Senior Member
    Join Date
    Apr 2017
    Posts
    136

    Getting pixel data with ILI9341 lib

    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.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,101
    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);

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,703
    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...

  4. #4
    Senior Member
    Join Date
    Apr 2017
    Posts
    136
    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....

  5. #5
    Senior Member
    Join Date
    Apr 2017
    Posts
    136
    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/B0...?ie=UTF8&psc=1

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

    Anyone have any idea on what the solution could be?

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,101
    Does readRect() act any differently?

  7. #7
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,703
    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...

  8. #8
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    4,774
    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 by Frank B; 12-03-2018 at 01:50 PM.

  9. #9
    Senior Member
    Join Date
    Apr 2017
    Posts
    136
    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.

    Click image for larger version. 

Name:	board.JPG 
Views:	5 
Size:	125.5 KB 
ID:	15277

    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);

  10. #10
    Senior Member
    Join Date
    Apr 2017
    Posts
    136
    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.

  11. #11
    Senior Member
    Join Date
    Apr 2017
    Posts
    136
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •