Hi
I am a complete beginner. I have the Leonardo and the Adafruit TFT has a ILI9430 chip. This is supposed to be compatible with the ILI9431 chip.
I want to use the ICSP on the Leonardo to connect to the the TFT. I simply cannot get this to work.
Within the IDE, the code I am using is
/* ADAFRUIT TFT: 2.2" 18-bit color TFT LCD display with microSD card breakout - ILI9340. Arduino Leonardo The ILI9341 chip is backward compatible with the ILI9340 chip, which is no longer used.*/
(PS. Look, From the photos, I know it seems as if I have an actual nail in each of the four corners of the Leonardo. You don't have to tell everybody about that. Let's just keep it between ourselves, Ok, thank you.
Use the correct constructor and everything should work fine.
But my usual advice is : Run all the library examples first.
Your "trivial" program has too many mistakes.
If you have a problem with any of the Adafruit_ILI9341 library examples, quote the example name. Explain your problem. Copy-paste your constructor statement.
When you have 100% success with the bit-bashed SPI you can try the proper hardware SPI. Note that this means MOSI=16 and SCK=15 on the Leonardo. (these are on the 3x2 SPI header)
Thank you very much indeed. I will make the changes tomorrow.
I also take your point about running examples first and in fact I began with that but the examples didn't work, presumably (?) because of the problem you solved, so I tried to cut it down to the minimum. That's when I got way out of my depth! Next time I will do as you recommend and quit sooner.
So thank you again
kind regards
Thanks for the response. Yes, I will but two points. The first is I have to get it to work before I do that; my pinouts might well be all wrong, although you don't seem to think so? (I appreciate that I would just be soldering the header to the TFT though) The second is I er don't actually have a soldering Ron. Any ideas for the best one to get would be welcome.
The nails are only temporary. I have just bought a new pack of plasters, which I think might also help with the LCD pin connections?
I will work through the example software. Serious thanks for responding
Surely you can find a neighbour, granddaughter or grandson who can solder it for you.
You might also be able to poke dressmakers pins into the header holes. The header pins are square, the header holes are round, a sharp pin in the gap might wedge an electrical connection.
I strongly advise following the library examples. But when you select Arduino pins avoid #0 and #1. (because they are used by Serial)
Regarding soldering equipment. How often will you use it?
You can buy most Arduino components with header pins already soldered. (or just procreate some grandchildren)
Hi
Had a first run with your constructor but no joy. I will check it all out again tomorrow.
Re the soldering iron, I'd use it maybe once a fortnight/ 3 weeks but I really don't know yet - not very often! I can buy one, really, its not a problem, but I've seen so many online if you can recommend one that'd be great - mid-price range.
In your last post you didn't actually list any library examples, unless I've missed that bit, but I tried a couple and they still don't work.
So, let me see if I've done anything really dumb tomorrow and if its still not working, I'll get back to you.
BTW these are the pinouts I'm using and I AM using the ICSP to connect as per the photo I uploaded.
Seriously. Take a genuine library example e.g.
C:\Users\ .. \Documents\Arduino\libraries\Adafruit_ILI9341\examples\graphicstest\graphicstest.ino
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
// For the Adafruit shield, these are the default.
#define TFT_DC 9 //helps to write each wire colour
#define TFT_CS 10
#define TFT_RST 8
#define TFT_SCK 13
#define TFT_MISO 12
#define TFT_MOSI 11
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
By which I mean : follow that wiring scheme.
If you want to use different wiring, copy-paste your#defines and your constructor. NEVER choose 0 or 1.
If you have a problem with the scheme that I suggested, please fill in each wire colour. And post a photo of your wiring. Foreign eyes can often spot wrong wires.
Hi
Thanks for bearing with this. I posted a photo with my wiring earlier, maybe that is the problem?
With the Leonardo, I didn't think I had a choice re using the ICSP or not because they apparently moved all the serial stuff on to the ICSP? I will try that code in the IDE but I am struggling to figure out the pin numbers on the ICSP. I know you said that MOSI =16 and SCK=15 on the ISP header but looking at the Leonardo as it is oriented in the jpeg below, have I wired it correctly - I don't see 16 or 15 in the schematic I followed.
Still looking for carrots I'm afraid. I did everything you said. I did come across this though:
The Leonardo is a bit different than the Uno. The SPI data lines are not on any digital pins. They are only on the ICSP pins. This is from the Leonardo datasheet:
SPI: on the ICSP header. These pins support SPI communication using the SPI library. Note that the SPI pins are not connected to any of the digital I/O pins as they are on the Uno, They are only available on the ICSP connector. This means that if you have a shield that uses SPI, but does NOT have a 6-pin ICSP connector that connects to the Leonardo's 6-pin ICSP header, the shield will not work.
There is nothing difficult about connecting a blue wire from pin#a to socket #b. Followed by a green wire from #c to #d. #e to #f, ...
Especially when foreign eyes can check both ends of each documented coloured wire.
You just have to be meticulous. Follow a checklist.
The extra 15 minutes of your life spent in writing a checklist and actually using the checklist just mean that it will work first time.
Not so good for multi-post multi-day threads on a Forum. But hey-ho it gets you working.
You must have a different version of Adafruits ILI9341 library, this is what I have:
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
Note that only specifying TFT_DC and TFT_CS in the constructor will use the hardware SPI, while the larger constructor will use software SPI.
The unsoldered header is going to cause endless problems, if it can ever be made to work like that.
added #defines for TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO
commented the HW SPI constructor
un-commented the SW SPI constructor (aka breakout, bit-bang, ...)
No software will ever work reliably until you have soldered the header pins. A neighbour or grandchild will solder it for you.
Or you buy a small soldering iron. Practise on scrap board. Practise. Practise. Then solder it yourself. There are videos to watch on YouTube.
It is unfortunate that the OP bought a display with separate header strip. Most Arduino displays come with ready-soldered pins.
// For the Adafruit shield, these are the default. #define TFT_DC 9 #define TFT_CS 10 #define TFT_MOSI 12 #define TFT_CLK 13 #define TFT_RST 8 #define TFT_MISO 11
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
This compiles and uploads to the IDE. Nothing happens on the TFT
The wiring is shown in the photo below:
Leonardo TFT
red +3.3v vin
black GND gnd
orange 8 rst
green 9 dc
blue 10 cs
blue again 11 mosi
yellow 12 miso
white 13 sck