Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ILI9341 Screen is only working with disabled Chip Select #283

Closed
tobimai opened this issue Jan 12, 2019 · 25 comments
Closed

ILI9341 Screen is only working with disabled Chip Select #283

tobimai opened this issue Jan 12, 2019 · 25 comments

Comments

@tobimai
Copy link

tobimai commented Jan 12, 2019

Hi,

I have this ILI9341 Display from Banggood and it works perfectly as long as I don't use ChipSelect by commenting out thedefine TFT_CS 5 line. And connecting CS to GND.

The problem is, that I want to use CS to be able to also use Touch.
But when I use CS the Display just stays blank/white.

I tried multiple Pins and Multiple Cables and multiple SPI Frequencies, nothing works.
I also looked at the CS signal with an Oscilloscope and it's definitly doing something (seems like going low for a short time), I can't see more as it's an rather old analogue Oscilloscope.

When I enable CS in the lib and connect CS to GND, the display also stays blank.

I use an ESP32 DOIT v1 Devkit and Platformio for the programming.

Here is the UserSetup.h and Here is the main.cpp file wich is just the example slightly modified.

@Bodmer
Copy link
Owner

Bodmer commented Jan 13, 2019

Post a picture of your setup. Is the touch contoller chip wired to the ESP32 for these tests, if so was the touch controller chip select driven high so there is no SPI bus conflict. How are you powering the display?

These may sound like irrelevant questions but something is wrong with the setup, allocating a pin to the chip select but then not using it should not affect the behavior of the display.

@tobimai
Copy link
Author

tobimai commented Jan 15, 2019

Post a picture of your setup. Is the touch contoller chip wired to the ESP32 for these tests, if so was the touch controller chip select driven high so there is no SPI bus conflict. How are you powering the display?

These may sound like irrelevant questions but something is wrong with the setup, allocating a pin to the chip select but then not using it should not affect the behavior of the display.

I tested it on more pins and discovered, that CS only works on some Pins.
Currently it works fine on 32 and 35.

Could it have something to do with the settings of the internal pullUp-Resistors?

To your questions:
When Testing, the Touch chip was disconnected and I am Powering the board from my Laptop (1.5A USB Port, shouldn't be a problem)

Sorry that I didn't reply earlier, GitHub didn't send a notification for some reason.

@Bodmer
Copy link
Owner

Bodmer commented Jan 17, 2019

GPIO 35 is input only so will not be able to drive the CS line. GPIO32 can be used and since it works I would keep using that pin. I cannot replicate the issue with GPIO 5 using the Arduino environment, perhaps there is an issue with the library and the PlatformIO environment?

@FLYINGSC0T
Copy link

Hi Bodmer. Thanks for a great library!! I have a problem getting Lora to work with an ILI9341 display on a TTGO T-Beam. If I comment out tft.begin() Lora works but if I enable it Lora does not work. The pin connections that I have set up in user setup .h file for the display are:

#define TFT_MISO 22 // Changed to 22 as GPIO 19 is used by Lora MISO on T-Beam
#define TFT_MOSI 25 // Changed to 25 as GPIO 23 is used ny Lora MOSI on T-Beam
#define TFT_SCLK 21 // Changed to 21 as GPIO 18 is used by Lora CS on T-Beam
#define TFT_CS 13
#define TFT_DC 2
#define TFT_RST 4

Any idea where the confliction is ?
I have checked the GPIO's used by the T-Beam for the Lora module and I am sure they don't conflict but I can't find the problem.

BTW the display works perfectly using the above settings on an ESP32 Dev. board only that I can't get Lora and the display to work with the T-Beam.

Thanks in advance for any help.

George

@achillhasler
Copy link

Hi George,
ESP32 have 2 usable SPI interface. (VSPI and HSPI) If you include <SPI.h> a variable SPI is defined whitch is used by the librarys.
If you dont create a new variable for the other SPI bus all librarys have to share the same bus (meens same connection for MOSI, MISO and SCK). Bud each dervice must have a own CS.
try:
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18

ciao Achill

@Bodmer
Copy link
Owner

Bodmer commented Jan 18, 2019

Hi George, as Achill has said the Lora device and library use the VSPI interface in the ESP32, so if the TFT_eSPI libray moves the VSPI pins MOSI, MISO and SCK then the Lora function will stop working. The TFT CS and DC pins must be on unused pins.

I may add the option to select either HSPI or VSPI at a future date.

@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 18, 2019 via email

@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 18, 2019 via email

@Bodmer
Copy link
Owner

Bodmer commented Jan 18, 2019

The key is to use the same pins for MISO, MOSI and SCK:

#define TFT_MISO 19 // Does not need to be conected to TFT unless reading from display
#define TFT_MOSI 27
#define TFT_SCLK  5
#define TFT_CS      13
#define TFT_DC       2
#define TFT_RST      4

@Bodmer Bodmer closed this as completed Jan 18, 2019
@Bodmer Bodmer reopened this Jan 18, 2019
@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 18, 2019 via email

@Bodmer
Copy link
Owner

Bodmer commented Jan 18, 2019

Ok, in that case the only clean option is to add HSPI support which should be simple to do. I am extra busy at the moment but should be able to update the library within the next 10 days.

@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 18, 2019 via email

@achillhasler
Copy link

Hi George,
have you tryed to share the spi-bus?
spi_share
The lane near processor is a sd-card, away the tft.
Both has connction to Ground, MISO, MOSI and SCK other are separate
You see MOSI (D23) brown cable
MISO (D19) violet cable
SCK (D18) green cable

on the jpg you see
SD-Card use additional (D5) SS and 3.3V
LCD use additional 5V (red cable), D4, RX2 (D16), TX2 (D17), RX0 (D3)

The SD-Card needs no configuation because this are the default pins for VSPI.

The User_setup.h for the shown picture is
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 3 // Chip select control pin
#define TFT_DC 4 // Data Command control pin
#define TFT_RST 17 // Reset pin
#define TOUCH_CS 16 // Chip select pin (T_CS) of touch screen (if you have a touchscreen)

nice Weekend

@Bodmer
Copy link
Owner

Bodmer commented Jan 19, 2019

@achill, the problem for flyingscot is that his LoraWAN board does not make the required pins available to allow sharing, so the clean solution is to use the HSPI port which can be mapped to easily accessible pins.

@Bodmer
Copy link
Owner

Bodmer commented Jan 19, 2019

This site has good info and links for
the T-Beam board:
http://tinymicros.com/wiki/TTGO_T-Beam

@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 19, 2019 via email

@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 19, 2019 via email

@Bodmer
Copy link
Owner

Bodmer commented Jan 22, 2019

@tobimai

Your issue has got hijacked but I am still monitoring this thread if you wish to add more, or please start a new issue.

@Bodmer Bodmer closed this as completed Jan 22, 2019
@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 22, 2019 via email

@Bodmer
Copy link
Owner

Bodmer commented Jan 22, 2019

Hi George,

I just meant that it got used to discuss other possible changes to the library unrelated to your problem!

@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 22, 2019 via email

@Bodmer
Copy link
Owner

Bodmer commented Jan 22, 2019

The T-Beam beahves as a device. I don't think you can use it as a host as it would need software to drive your SDR. You will probably find a Raspberry Pi will interface with the SDR.

@FLYINGSC0T
Copy link

FLYINGSC0T commented Jan 22, 2019 via email

@FLYINGSC0T
Copy link

Hi Bodmer,

Any progress on the implementation of HSPI for the T-Beam ?

Regards.

@Ede2016
Copy link

Ede2016 commented Dec 2, 2019

Maybe this was answered already.
I use exactly the same display from Banggood with this code including CS pin and it works fine.
https://github.com/espressif/esp-idf/tree/master/examples/peripherals/spi_master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants