2.8 ILI9341 restive touch miso not connected ?

Status
Not open for further replies.
@defragster
Thanks for the explanation, I'm trying to develop some code to scroll through 10 different screens of data. Only 1 field of data is shown on each screen ( but using a nice size text ).
I'm Trying to keep it simple, so I've split the screen roughly down the middle - when the screen is touched I look at the value of X - if it is higher than 2000 I increase a screen count. ( so I will show the next screen ).
If the value of X is less than 2001, I decrease the screen counter.
I've noticed some odd ( almost random at times) behaviour on my X values, so think I may look at the readData and see how I get on !

Thanks
Keith
 
OK I got the Touch screen working with your sketch (I think this is your sketch) below.

It works nicely with my finger and with the plastic point of one of my plastic pencils (I took the lead out).

However, one of my other sketches that displays text (via fonts), doesn't work now. The screen is garbled up. Is there a text/font mode I have to switch into? Or does text and graphics mixed nicely on the screen?

Code:
//This example implements a simple sliding On/Off button. The example
// demonstrates drawing and touch operations.
//
//Thanks to Adafruit forums member Asteroid for the original sketch!
//
#include <SPI.h>
#include <Wire.h>
#include <ILI9341_t3.h>

#include <XPT2046_Touchscreen.h>
// This is calibration data for the raw touch data to the screen coordinates
#define TS_MINX 200
#define TS_MINY 325
#define TS_MAXX 3700
#define TS_MAXY 3670

#define CS_PIN 8
//Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
XPT2046_Touchscreen ts(CS_PIN);
#define TFT_CS 10
#define TFT_DC  9
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);

boolean RecordOn = false;

#define FRAME_X 210
#define FRAME_Y 180
#define FRAME_W 100
#define FRAME_H 50

#define REDBUTTON_X FRAME_X
#define REDBUTTON_Y FRAME_Y
#define REDBUTTON_W (FRAME_W/2)
#define REDBUTTON_H FRAME_H

#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
#define GREENBUTTON_Y FRAME_Y
#define GREENBUTTON_W (FRAME_W/2)
#define GREENBUTTON_H FRAME_H

void drawFrame()
{
  tft.drawRect(FRAME_X, FRAME_Y, FRAME_W, FRAME_H, ILI9341_BLACK);
}

void redBtn()
{ 
  tft.fillRect(REDBUTTON_X, REDBUTTON_Y, REDBUTTON_W, REDBUTTON_H, ILI9341_RED);
  tft.fillRect(GREENBUTTON_X, GREENBUTTON_Y, GREENBUTTON_W, GREENBUTTON_H, ILI9341_BLUE);
  drawFrame();
  tft.setCursor(GREENBUTTON_X + 6 , GREENBUTTON_Y + (GREENBUTTON_H/2));
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.println("ON");
  RecordOn = false;
}

void greenBtn()
{
  tft.fillRect(GREENBUTTON_X, GREENBUTTON_Y, GREENBUTTON_W, GREENBUTTON_H, ILI9341_GREEN);
  tft.fillRect(REDBUTTON_X, REDBUTTON_Y, REDBUTTON_W, REDBUTTON_H, ILI9341_BLUE);
  drawFrame();
  tft.setCursor(REDBUTTON_X + 6 , REDBUTTON_Y + (REDBUTTON_H/2));
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.println("OFF");
  RecordOn = true;
}

void setup(void)
{
  Serial.begin(9600);
  tft.begin();
  if (!ts.begin()) { 
    Serial.println("Unable to start touchscreen.");
  } 
  else { 
    Serial.println("Touchscreen started."); 
  }

  tft.fillScreen(ILI9341_BLUE);
  // origin = left,top landscape (USB left upper)
  tft.setRotation(1); 
  redBtn();
}

void loop()
{
  // See if there's any  touch data for us
   boolean istouched = ts.touched();
  if (istouched)
  {   
    // Retrieve a point  
    TS_Point p = ts.getPoint(); 
    // Scale using the calibration #'s
    // and rotate coordinate system
    p.x = map(p.x, TS_MINX, TS_MAXX, 0, 319);
    p.y = map(p.y, TS_MINY, TS_MAXY, 0, 239);
    int y =  p.y;
    int x = p.x;
    
    if (RecordOn)
    {
      if((x > REDBUTTON_X) && (x < (REDBUTTON_X + REDBUTTON_W))) {
        if ((y > REDBUTTON_Y) && (y <= (REDBUTTON_Y + REDBUTTON_H))) {
          Serial.println("Red btn hit"); 
          redBtn();
        }
      }
    }
    else //Record is off (RecordOn == false)
    {
      if((x > GREENBUTTON_X) && (x < (GREENBUTTON_X + GREENBUTTON_W))) {
        if ((y > GREENBUTTON_Y) && (y <= (GREENBUTTON_Y + GREENBUTTON_H))) {
          Serial.println("Green btn hit"); 
          greenBtn();
        }
      }
    }

    //Serial.println(RecordOn);
  }  
}
 
@rfeash737 - that is the default example code. I made a version where I generalized the buttons and then extended that to other examples: https://github.com/Defragster/XPT2046_Touch_Examples

It takes the HIT testing for buttons out of the user code, but introduces a complex data structure for buttons to feed an engine that identifies buttons. in you case the samples might be interesting but not useful for just page forward and backward.

Except I demonstrate dealing with mapping to pixels in any screen rotation. That touch paint have the screen read backwards somehow - the 'onoffbutton' example is a better demo where I do more buttons and rotate the screen dynamically for example purposes.

For your purposes adding 10 on screen buttons could let you jump directly to any screen. in landscape mode the buttons would be large enough to hit and label in two rows of 5 and leave a large area to display whatever you wanted in another screen area. I diverted from the button work to get a non polling version using the interrupt pin that went pretty well, but has some anomaly.

I just moved all my examples to the new GitHub listed above as having it inside the touch screen fork of PJRC makes GitHub painful. I haven't looked at them for some time, but left them working.
 
Oh, the topic/issue of this thread "..miso not connected.." is solved :) (It was bad soldering of the connector between the display and pcb. Works now.)
No threadpollution possible ;)
 
I am curious, and this may highlight my level of c programming knowledge - but why would you opt to use the readData () method to obtain the touch position over the getPoint () method or vice versa?

We're trying to be fully compatible with Adafruit's touch controller library. Adafruit has those two redundant ways, so we're doing them both as well. The only reason is because some programs use one way, others use the other way, so we need to have both for compatibility.

I suspect, but I don't know for certain, that readData() probably was made first. Adafruit probably had similar but slightly different functions in many of their libraries. It seems the getPoint() is something newer they're doing, to make their many libraries use the same functions. But even with that, they haven't done it with perfect consistency across their libs (some have an underscore in the special variable name, others don't), so it's hard to say if that's just an oversight, or if they have some other purpose.

Anyway, the idea was to implement the same function names, parameters and types as Adafruit used. That way you can use programs and examples written for those libs, and anything you write should (hopefully) work if you or others try to use it with an Adafruit library.
 
Oh, the topic/issue of this thread ... No threadpollution possible ;)

Thanks Frank - I put the same note on both threads - the other was created after this since the title fit your problem. Hopefully my new thread will make a single spot that is findable. Even better I hope I can get back to where I was and make some improvements.
 
Question regarding the Color 320x240 TFT Display and the ILI9341 Controller Chip, do we have any capability to change the screen brightness? I'm running mine on a Teensy 3.2 using 3.3v and the display is 'OK' but I was just wondering if we have any tweaking capabilities?

Thanks...
 
Good question.

I recently ordered some of these displays. Haven't used them yet. I made this PCB to speed things up (well, at least minimize my time spent fiddling).

https://www.oshpark.com/shared_projects/TG395I75

Still waiting for the PCB to arrive from OSH Park, so this is untested. I should have it next week...

Maybe I missed it but I couldn't fine a parts list for this board on this thread. Can someone please post the valves of the resisters, capacitor, voltage regulator, diode for this board?
 
@rfresh737 - what resistor did you put inline with the power? I'm not sure about 3.3v - but on 5v it recommends 100ohm. I saw a note the other day from 5v users they went as low as 10 ohm. I'm not an EE and didn't even try the math - but as long as the current limit works out - that should put more current to the LEDS for more brightness

@gsklinger - there was a second prior board from OSH without touch - if you go there and click on Paul's projects - you can find it and it gives a BOM and more detail. The changes I saw are through hole cap on power (instead of SMD), and two added 10K resistors for pullup that are placed under the Teensy. I have those parts here now but didn't fully build one yet. The power plug is a pain to find - I got one from DigiKey that looks like it will work - may need some editing.
 
@rfresh737 - what resistor did you put inline with the power? I'm not sure about 3.3v - but on 5v it recommends 100ohm. I saw a note the other day from 5v users they went as low as 10 ohm. I'm not an EE and didn't even try the math - but as long as the current limit works out - that should put more current to the LEDS for more brightness

@gsklinger - there was a second prior board from OSH without touch - if you go there and click on Paul's projects - you can find it and it gives a BOM and more detail. The changes I saw are through hole cap on power (instead of SMD), and two added 10K resistors for pullup that are placed under the Teensy. I have those parts here now but didn't fully build one yet. The power plug is a pain to find - I got one from DigiKey that looks like it will work - may need some editing.

EDIT: I'm using a 100 ohm resistor. Those are what was used in some of the tutorials I looked at...however, I'm not sure that's appropriate for a 3.3v system. But I'm a newbie so I have no idea what would be 'correct' for 3.3v?

>that should put more current to the LEDS for more brightness.

You mean the LCD, right?

I'm willing to try a lower ohm resistor but don't know what to drop it down to?

EDIT: I dropped it down to a 47 ohm resistor and that made the LCD a little brighter and now the brightness looks 'better' than with the 100 ohm resistor. In fact, I'd say the screen brightness is 'excellent' now. So, maybe 47 ohms on a 3.3v board with this screen.
 
Last edited:
There is a resistor on the display - so in theory, it should be no problem to use very low values, or ZERO ohm !
But the current will be higher, of course. You might want to measure it.

I use ZERO (with 5 V) , but i use a small circuit to control the brightness with PWM.
 
Last edited:
EDIT: I'm using a 100 ohm resistor.
>that should put more current to the LEDS for more brightness.

You mean the LCD, right?

The LCD is backlit by LED's - you'll note that pin is labeled 'LED'.

47ohms sounds like a safe drop if you are getting good results. It is a matter of taste/environment on the brightness.

@Paul ran his Hackathon on 3.3v - if he could note what resistors he used that would be interesting.
 
Paul: On your ToDo list please remember the OSH Display board update for the new version

Paul - If you get to update the OSH Display board setup - don't forget the FUSE link rating - I did - I just realized I adjusted the other needed parts - but left the low 0.14A PTC on my order list - so it won't feed the T_3.2 enough current to use the new hardware - given that 5v feeds the display LED and the LDO output is 5v not 6v not sure if you would recommend .3A or .35A maybe?
 
I'm measuring 76 mA total (7805 regulator + Teensy 3.2 + 2.8 inch display) when running the XPT2046_Touchscreen ILI9341Test example.

That's at the default 96 MHz. If I set Tools > CPU Speed to 24 MHz, the total current is 55 mA.
 
Last edited:
@rfresh737 - what resistor did you put inline with the power? I'm not sure about 3.3v - but on 5v it recommends 100ohm. I saw a note the other day from 5v users they went as low as 10 ohm. I'm not an EE and didn't even try the math - but as long as the current limit works out - that should put more current to the LEDS for more brightness

@gsklinger - there was a second prior board from OSH without touch - if you go there and click on Paul's projects - you can find it and it gives a BOM and more detail. The changes I saw are through hole cap on power (instead of SMD), and two added 10K resistors for pullup that are placed under the Teensy. I have those parts here now but didn't fully build one yet. The power plug is a pain to find - I got one from DigiKey that looks like it will work - may need some editing.

Thanks, I've got the board and all the parts now. One question though - which way does the Shottky diode go? I could find any posted photos that show it and the PCB is not marked. Is a schematic for this board available? Thanks again.
 
Arduino: DUE
Display: 2.4 ILI9341 + XPT2046
Lib: ILI9341_due

I have a small, but annoying malfunction.
To pilot the XPT2046 I have used direct pins, not those of the standard SPI and all was well.
Now, to reduce the pin usage, I connected the XPT2046 to the SPI and everything works fine, but if I connect the pin SDO_MISO of the display, the SDO_MISO data become crazy shooting continuously and autonomously incorrect values.
This happens with the library ILI9341_due, but also with the other libraries.
I do not need the READ function of the display, but I would like to know if others have encountered this problem and if they fixed.

amelia
 
Arduino: DUE
Display: 2.4 ILI9341 + XPT2046
Lib: ILI9341_due

I have a small, but annoying malfunction ...

Found, it is reported into the title of the Thread "ILI9341 restive touch miso not connected ?".
Infact I am not able to read the Status of the TFT.
The SDO_MISO pin is floating.

amelia
 
Status
Not open for further replies.
Back
Top