GremlinWrangler
Well-known member
Hi all
Trying to get an Ethernet connected display working seem to have something clashing in SPI settings between ethernet and the TFT_ILI9163C, a cut down version of the DHCP printing code reproduces the problem, at least on my install (Windows, Arduino 1.8.5, Teensyduino 1.40, Teensy included TFT and Ethernet versions)
In this case DHCP should be getting a 10.5.x.x address but the printed result is 2.3.10.0, and other more complex ethernet functions fail in various ways as well.
The Ethernet module is a W5500 clone with CS on 10, and the display pins are immaterial being write only.
Chasing down into the libraries both use transactions which is good but in TFT_ILI9163C.h write functions there are values going into KINETISK_SPI0.PUSHR which if commented out allow ethernet to work correctly (but breaks the TFT obviously), suggesting something is being set there that clashes with the settings for ethernet SPI. Ethernet appears to use teensy SPIFIFO.h to get at the KINETISK_SPI0.PUSHR but my read of the code there is that it should be overwriting anything left behind by the TFT commands.
Any suggestions on untangling this would be welcome, still not sure if it is peculiar to this install.
For anybody else arriving via a search TFT_ILI93XX does work with ethernet but has issues of it's own getting the 128*128 displays to work.
Trying to get an Ethernet connected display working seem to have something clashing in SPI settings between ethernet and the TFT_ILI9163C, a cut down version of the DHCP printing code reproduces the problem, at least on my install (Windows, Arduino 1.8.5, Teensyduino 1.40, Teensy included TFT and Ethernet versions)
Code:
#include <SPI.h>
#include <Ethernet.h>
#include <Adafruit_GFX.h>
#include <TFT_ILI9163C.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {
0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
};
#define __CS 9
#define __DC 20
TFT_ILI9163C tft = TFT_ILI9163C(__CS, __DC);
void setup() {
Serial.begin(9600);
// tft.begin(); // tft.begin here will work
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// start the Ethernet connection:
Serial.println("Initialize Ethernet with DHCP:");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
for (;;)
;
}
tft.begin();// here causes errors with ethernet
printIPAddress();
}
void loop() {
switch (Ethernet.maintain()) {
case 1:
//renewed fail
Serial.println("Error: renewed fail");
break;
case 2:
//renewed success
Serial.println("Renewed success");
//print your local IP address:
printIPAddress();
break;
case 3:
//rebind fail
Serial.println("Error: rebind fail");
break;
case 4:
//rebind success
Serial.println("Rebind success");
//print your local IP address:
printIPAddress();
break;
default:
//nothing happened
break;
}
}
void printIPAddress() {
Serial.print("My IP address: ");
Serial.println(Ethernet.localIP());
}
In this case DHCP should be getting a 10.5.x.x address but the printed result is 2.3.10.0, and other more complex ethernet functions fail in various ways as well.
The Ethernet module is a W5500 clone with CS on 10, and the display pins are immaterial being write only.
Chasing down into the libraries both use transactions which is good but in TFT_ILI9163C.h write functions there are values going into KINETISK_SPI0.PUSHR which if commented out allow ethernet to work correctly (but breaks the TFT obviously), suggesting something is being set there that clashes with the settings for ethernet SPI. Ethernet appears to use teensy SPIFIFO.h to get at the KINETISK_SPI0.PUSHR but my read of the code there is that it should be overwriting anything left behind by the TFT commands.
Any suggestions on untangling this would be welcome, still not sure if it is peculiar to this install.
For anybody else arriving via a search TFT_ILI93XX does work with ethernet but has issues of it's own getting the 128*128 displays to work.