Note: on Arduino UNO board.
I have a SEEEDStudio Ethernet shield.
It uses pins 10-13.
I want to use my 2.2" TFT shield (AdaFruit) with it.
It also uses pin 10 as the CS.
So I cut the pin off, rewired it to pin 8, and changed the following:
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
To this:
#define TFT_DC 9
#define TFT_CS 8
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
Running my code, the display stuff works fine with the new CS line.
Comment the TFT code out and the Ethernet code works great.
However, with both pieces of code present, the Ethernet fails.
Any suggestions?
Thanks,
Randy Hyde
P.S. I also tried rewiring pin 9 to pin 7 with appropriate software changes. Didn't help.
Problem with TFT 2.2 Sheild and Ethernet shield
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- randyhyde
- Posts: 11
- Joined: Wed Apr 01, 2015 12:25 pm
Problem with TFT 2.2 Sheild and Ethernet shield
Last edited by randyhyde on Fri Apr 17, 2015 1:39 am, edited 1 time in total.
- randyhyde
- Posts: 11
- Joined: Wed Apr 01, 2015 12:25 pm
Re: Problem with TFT 2.2 Sheild and Ethernet shield
BTW, "SPI_HAS_TRANSACTION" is not defined in Adafruit_ILI9341.cpp. Should it be?
There has to be some hardware conflict as I just noticed that Ethernet transmissions get garbled when no TFT software is active and I have the TFT plugged in to the top of the Ethernet shield (note that pins 9&10 of the TFT shield have been moved to 7&8).
[edit]
Moving SPI pins to 3, 5, & 6 (along with 7&8 for DC/CS) and running software SPI got the display working (albeit *very* slowly on the display) along with the Ethernet. Apparently, there is some conflict when using the SPI bus for both the Ethernet and display. Will have to dig into the Ethernet code/schematics to see if the bus is not being ti-stated properly.
There has to be some hardware conflict as I just noticed that Ethernet transmissions get garbled when no TFT software is active and I have the TFT plugged in to the top of the Ethernet shield (note that pins 9&10 of the TFT shield have been moved to 7&8).
[edit]
Moving SPI pins to 3, 5, & 6 (along with 7&8 for DC/CS) and running software SPI got the display working (albeit *very* slowly on the display) along with the Ethernet. Apparently, there is some conflict when using the SPI bus for both the Ethernet and display. Will have to dig into the Ethernet code/schematics to see if the bus is not being ti-stated properly.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Problem with TFT 2.2 Sheild and Ethernet shield
SPI has four modes based on when you read and write data (clock high/low, rising/falling edge). If the devices use different modes, they might confuse each other.
Paul Stoffregen wrote an extension to the SPI library that lets you switch from one mode to another, breaking the sequences into 'transactions'. It's possible that you're using code that needs transaction-based SPI to make the devices work together.
Paul Stoffregen wrote an extension to the SPI library that lets you switch from one mode to another, breaking the sequences into 'transactions'. It's possible that you're using code that needs transaction-based SPI to make the devices work together.
- randyhyde
- Posts: 11
- Joined: Wed Apr 01, 2015 12:25 pm
Re: Problem with TFT 2.2 Sheild and Ethernet shield
YES, I just discovered that while the graphics library calls beginTransaction and endTransaction, the Ethernet code does not. I was about to ask if anyone thought this could be the problem. I guess that it is. Time to start digging through the Ethernet code and make the changes.
Thank God for open source...
Thank God for open source...
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Problem with TFT 2.2 Sheild and Ethernet shield
With any luck, it should be as easy as adding similar begin/end calls around the Ethernet library's SPI code.
- randyhyde
- Posts: 11
- Joined: Wed Apr 01, 2015 12:25 pm
Re: Problem with TFT 2.2 Sheild and Ethernet shield
Yes indeed, it was almost that easy.adafruit_support_mike wrote:With any luck, it should be as easy as adding similar begin/end calls around the Ethernet library's SPI code.
Had to figure out that the maximum SPI speed was 4MHz (not 8 as in the GFX example code), but once I got to that point everything worked fine.
Thanks for the help.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Problem with TFT 2.2 Sheild and Ethernet shield
Glad to hear you got it working.
Happy hacking!
Happy hacking!
Please be positive and constructive with your questions and comments.