chipKIT® Development Platform

Inspired by Arduino™

uC32 Doesn't recognize any TFT / LCD Screens

Created Tue, 27 Dec 2016 18:26:45 +0000 by VHDL-BPA


VHDL-BPA

Tue, 27 Dec 2016 18:26:45 +0000

I recently bought two uC32 microcontrollers, so I could avoid having to use arduinos.

I have tried messing around with the libraries for a while now, and I can get most basic programs running on the uC32 without any problems at all.

However, none of my different TFT screens are working at all. When I run the TFTProber program, no screens are recognized, even ones like the ILI9341, ILI9340c, and HX8357D. Any time I run the program it says reset ok, could not identify screen, and sends back all FFFFFFFs. Same data, same results, any screen.

I have verified that these screens are working with other microcontrollers and an FPGA, what am I doing wrong?

Please help me!

-VHDL


majenko

Tue, 27 Dec 2016 19:13:26 +0000

Do you have links to the screens you are using? Not all interfaces support TFT probing (many SPI ones don't).


VHDL-BPA

Tue, 27 Dec 2016 19:34:29 +0000

https://learn.adafruit.com/adafruit-3-5-color-320x480-tft-touchscreen-breakout/overview

https://www.adafruit.com/product/2478

https://www.adafruit.com/product/1770

http://www.elecfreaks.com/store/24-tft-lcd-tft0124sp-p-785.html

These are the screens I am using.

I was trying to say also, the reason I used the probe program was because I wanted a way to troubleshoot this problem. No program that I write or example code that I use seems to do anything at all on any of my screens.


majenko

Tue, 27 Dec 2016 21:42:48 +0000

Unfortunately I haven't actually used any of those specific screens. I only have one ILI9341 and IIRC (I can't put my hands on it right now) it works in 16-bit mode. I am not 100% sure if I got the 8-bit mode tested or not.

There is not currently any support for SPI for the ILI9341 either.

I need to go digging through my boxes to find the right screens to check with...


VHDL-BPA

Wed, 28 Dec 2016 17:55:35 +0000

That would be awesome!

I also think part of my problem is that I am not very good at C/C++. How exactly do I write the starting and calling code for these custom screens with uC32 libraries? Every time I tried something it would give me a compile error and say I am not calling the function correctly (I know I am not). For the HX8357 for example, how would I call it?


majenko

Wed, 28 Dec 2016 19:47:02 +0000

The HX8347D driver has an example with it that shows you how to use it. Define a DSPI object for the port you have it connected to, and pass that along with the C/D and CS pins to the constructor.


VHDL-BPA

Thu, 29 Dec 2016 03:49:56 +0000

It still isn't working. I get about 30-40 lines of errors each try. Here is what I wrote so far, to try to interface with the HX8357:

#include <HX8357.h> #include <DisplayCore.h> #include <DSPI.h> #include <TFT.h>

DSPI0 spi; TFTDSPI mySpi(&spi, 7, 10); HX8357 tft(&mySpi);

void setup() { Serial.begin(115200); pinMode(9, OUTPUT); digitalWrite(9, HIGH); tft.initializeDevice();

tft.fillScreen(Color::Black);
tft.setTextColor(Color::Red);

}

void loop() { tft.setCursor(10, 10); tft.print(millis()); }


majenko

Thu, 29 Dec 2016 10:52:59 +0000

Ummm... why do you have #include &lt;TFT.h&gt;? That library is ancient, cannot work with DisplayCore, and in short should not be used or installed by anyone. Delete it.


VHDL-BPA

Thu, 29 Dec 2016 19:36:41 +0000

Okay, I don't quite understand how this works. I simply want to call the functions that initialize the screen and use the standard SPI pins.


majenko

Thu, 29 Dec 2016 20:40:33 +0000

You delete the TFT library that you installed, and remove the #include <TFT.h> from your code. Then try it and see what happens.


VHDL-BPA

Thu, 29 Dec 2016 22:10:38 +0000

Nothing changed. It still fails to compile and has the same long list of errors that I can't make sense of.


majenko

Fri, 30 Dec 2016 11:34:32 +0000

Could you maybe, I dunno, like share said errors? It's hard to know what is going on when you keep us in the dark like this.


VHDL-BPA

Fri, 30 Dec 2016 18:08:02 +0000

Sorry! Here is my code and the list of errors.

#include <HX8357.h> #include <DisplayCore.h> #include <DSPI.h>

DSPI0 spi; TFTDSPI mySpi(spi, 7, 10); HX8357 tft(&mySpi);

void setup() { Serial.begin(115200); pinMode(9, OUTPUT); digitalWrite(9, HIGH); tft.initializeDevice();

tft.fillScreen(Color::Black);
tft.setTextColor(Color::Red);  

}

void loop() { tft.setCursor(10, 10); tft.print(millis()); }


WARNING: Spurious .github folder in 'Adafruit HX8357 Library' library In file included from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:9:0:

C:\Users\PSCDefault\Documents\Arduino\libraries\DisplayCore/DisplayCore.h:24:3: error: conflicting declaration 'typedef struct FontHeader FontHeader'

} FontHeader;

^

In file included from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/HX8357.h:4:0,

             from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:8:

C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/TFT.h:38:3: error: 'FontHeader' has a previous declaration as 'typedef struct FontHeader FontHeader'

} FontHeader;

^

In file included from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:9:0:

C:\Users\PSCDefault\Documents\Arduino\libraries\DisplayCore/DisplayCore.h:26:8: error: redefinition of 'struct coord'

struct coord {

    ^

In file included from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/HX8357.h:4:0,

             from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:8:

C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/TFT.h:40:8: error: previous definition of 'struct coord'

struct coord {

    ^

In file included from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:9:0:

C:\Users\PSCDefault\Documents\Arduino\libraries\DisplayCore/DisplayCore.h:31:7: error: using typedef-name 'point3d' after 'class'

class point3d {

   ^

In file included from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/HX8357.h:4:0,

             from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:8:

C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/TFT.h:49:3: note: 'point3d' has a previous declaration here

} point3d;

^

In file included from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:9:0:

C:\Users\PSCDefault\Documents\Arduino\libraries\DisplayCore/DisplayCore.h:108:27: error: conflicting declaration 'typedef struct Color565 Color565'

} attribute((packed)) Color565;

                       ^

In file included from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/HX8357.h:4:0,

             from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:8:

C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/TFT.h:60:27: error: 'Color565' has a previous declaration as 'typedef struct Color565 Color565'

} attribute((packed)) Color565;

                       ^

In file included from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:9:0:

C:\Users\PSCDefault\Documents\Arduino\libraries\DisplayCore/DisplayCore.h:423:7: error: redefinition of 'class Touch'

class Touch {

   ^

In file included from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/TFT.h:326:0,

             from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/HX8357.h:4,

             from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:8:

C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/Touch.h:11:7: error: previous definition of 'class Touch'

class Touch {

   ^

In file included from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:9:0:

C:\Users\PSCDefault\Documents\Arduino\libraries\DisplayCore/DisplayCore.h:496:7: error: redefinition of 'class Filter'

class Filter {

   ^

In file included from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/TFT.h:331:0,

             from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/HX8357.h:4,

             from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:8:

C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/Filter.h:8:7: error: previous definition of 'class Filter'

class Filter {

   ^

In file included from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:9:0:

C:\Users\PSCDefault\Documents\Arduino\libraries\DisplayCore/DisplayCore.h:508:7: error: redefinition of 'class Image'

class Image : public DisplayCore {

   ^

In file included from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/TFT.h:286:0,

             from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/HX8357.h:4,

             from C:\Users\PSCDefault\Documents\Arduino\WaveShare28\WaveShare28.ino:8:

C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/Image.h:8:7: error: previous definition of 'class Image'

class Image {

   ^

Multiple libraries were found for "DisplayCore.h" Used: C:\Users\PSCDefault\Documents\Arduino\libraries\DisplayCore Not used: C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\DisplayCore exit status 255 Error compiling for board chipKIT uC32.


majenko

Fri, 30 Dec 2016 18:51:25 +0000

In file included from C:\Users\PSCDefault\Documents\Arduino\hardware\chipkit-core\pic32\libraries\TFT-master/HX8357.h:4:0,

I thought I told you to delete the TFT library that you have downloaded and installed?


VHDL-BPA

Tue, 03 Jan 2017 20:16:27 +0000

I did, I think that is the one for Arduino. Let me look again to see if I accidentally had multiple copies.


majenko

Tue, 03 Jan 2017 20:43:06 +0000

Well, the path component "hardware\chipkit-core" tells me it's not the Arduino one, but chipKIT. Also, the suffix "-master" tells me that you downloaded it from Github as a .ZIP file.

So no, it's not the Arduino one. It's one YOU downloaded and installed.


VHDL-BPA

Wed, 04 Jan 2017 22:33:33 +0000

I don't understand though. I looked through a lot of the libraries while I was trying to troubleshoot, and they have #include the TFT library within them. How can I use the HX8357 without the TFT library? Doesn't it require it?


majenko

Thu, 05 Jan 2017 21:04:09 +0000

The TFT library is what came before DisplayCore. If you are seeing "#include <TFT.h>" anywhere then either it's in a sketch or example that isn't for chipKIT, or it's written for the (now ancient) TFT library that you shouldn't be using. In the majority of the latter cases you can replace "TFT.h" with "DisplayCore.h". In the former, you will need to re-write the program to use DisplayCore since it's nothing like the Arduino TFT library, which is only for the Arduino TFT shield.


VHDL-BPA

Fri, 06 Jan 2017 18:42:32 +0000

The main trouble I am having is trying to interface to the HX8357 in the first place, and get it to work at all. I don't really mind having to change the programs I wrote for the Arduino. As for the drivers and libraries for the screen, I don't even know where to start since all of them require your old TFT library.


majenko

Sat, 07 Jan 2017 11:48:11 +0000

I don't know why you should think that. The only libraries that want the old TFT library are the old TFT libraries. DisplayCore is all you need - that and the associated driver libraries from DisplayCore - NOT the ones from the TFT libraries. If you see the word "TFT.h" in a library then it's the WRONG library.


VHDL-BPA

Mon, 09 Jan 2017 20:55:24 +0000

So there isn't a new library for the HX8357?


majenko

Mon, 09 Jan 2017 22:15:04 +0000

Hang on, I can't count. Getting confused between HX8357 and HX8347D.

In DisplayCore the HX8357 driver has been renamed Picadillo. Not sure if it will work with your setup or not.


majenko

Mon, 09 Jan 2017 22:16:03 +0000

Actually it probably won't - it only supports the PMP at the moment. That means a MAX32 or similar - something with a full 16-bit PMP available on the headers.