ILI9341 not working

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: ILI9341 not working

Postby loboris » Wed Nov 22, 2017 7:39 pm

@Zwegogo

I have changed the conflicting enum names.
Please try again, it should now work.

Zwegogo
Posts: 7
Joined: Wed Oct 25, 2017 2:51 pm

Re: ILI9341 not working

Postby Zwegogo » Thu Nov 23, 2017 3:37 pm

@loboris

Hi,

Thank you for your quick reply and action! Really great. I have implemented your changes, but i get some new errors. See below.
Hopefully it will help to solve the issue. Thanks!

Regards,

Stefan

CC build/main/main.o
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/sns_proto/main/sd_card.h:15,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:36:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:33:0: warning: "SPI_DEVICE_BIT_LSBFIRST" redefined
#define SPI_DEVICE_BIT_LSBFIRST (SPI_DEVICE_TXBIT_LSBFIRST|SPI_DEVICE_RXBIT_LSBFIRST); ///< Transmit and receive LSB first
^
In file included from C:/msys32/home/stefan/esp/sns_proto/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/sns_proto/main/images_1.h:25,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:35:
C:/msys32/home/stefan/esp/sns_proto/components/spidriver/spi_master_lobo.h:67:0: note: this is the location of the previous definition
#define SPI_DEVICE_BIT_LSBFIRST (SPI_TXBIT_LSBFIRST|SPI_RXBIT_LSBFIRST); ///< Transmit and receive LSB first
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/sns_proto/main/sd_card.h:15,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:36:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:41:15: error: conflicting types for 'transaction_cb_t'
typedef void(*transaction_cb_t)(spi_transaction_t *trans);
^
In file included from C:/msys32/home/stefan/esp/sns_proto/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/sns_proto/main/images_1.h:25,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:35:
C:/msys32/home/stefan/esp/sns_proto/components/spidriver/spi_master_lobo.h:76:15: note: previous declaration of 'transaction_cb_t' was here
typedef void(*transaction_cb_t)(spi_lobo_transaction_t *trans);
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/sns_proto/main/sd_card.h:15,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:36:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:65:0: warning: "SPI_TRANS_MODE_DIOQIO_ADDR" redefined
#define SPI_TRANS_MODE_DIOQIO_ADDR (1<<4) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
^
In file included from C:/msys32/home/stefan/esp/sns_proto/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/sns_proto/main/images_1.h:25,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:35:
C:/msys32/home/stefan/esp/sns_proto/components/spidriver/spi_master_lobo.h:101:0: note: this is the location of the previous definition
#define SPI_TRANS_MODE_DIOQIO_ADDR (1<<2) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/sns_proto/main/sd_card.h:15,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:36:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:66:0: warning: "SPI_TRANS_USE_RXDATA" redefined
#define SPI_TRANS_USE_RXDATA (1<<2) ///< Receive into rx_data member of spi_transaction_t instead into memory at rx_buffer.
^
In file included from C:/msys32/home/stefan/esp/sns_proto/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/sns_proto/main/images_1.h:25,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:35:
C:/msys32/home/stefan/esp/sns_proto/components/spidriver/spi_master_lobo.h:102:0: note: this is the location of the previous definition
#define SPI_TRANS_USE_RXDATA (1<<3) ///< Receive into rx_data member of spi_lobo_transaction_t instead into memory at rx_buffer.
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/sns_proto/main/sd_card.h:15,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:36:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:67:0: warning: "SPI_TRANS_USE_TXDATA" redefined
#define SPI_TRANS_USE_TXDATA (1<<3) ///< Transmit tx_data member of spi_transaction_t instead of data at tx_buffer. Do not set tx_buffer when using this.
^
In file included from C:/msys32/home/stefan/esp/sns_proto/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/sns_proto/main/images_1.h:25,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:35:
C:/msys32/home/stefan/esp/sns_proto/components/spidriver/spi_master_lobo.h:103:0: note: this is the location of the previous definition
#define SPI_TRANS_USE_TXDATA (1<<4) ///< Transmit tx_data member of spi_lobo_transaction_t instead of data at tx_buffer. Do not set tx_buffer when using this.
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/bt/bluedroid/include/bt_target.h:1829:0,
from C:/msys32/home/stefan/esp/esp-idf/components/bt/bluedroid/bta/include/bta_api.h:28,
from C:/msys32/home/stefan/esp/sns_proto/main/main.c:26:
C:/msys32/home/stefan/esp/esp-idf/components/bt/bluedroid/include/bt_trace.h:28:14: error: expected identifier or '(' before string constant
#define TAG "BT"
^
C:/msys32/home/stefan/esp/sns_proto/main/sd_card.h:20:20: note: in expansion of macro 'TAG'
static const char *TAG = "example";
^
C:/msys32/home/stefan/esp/sns_proto/main/main.c: In function 'app_main':
C:/msys32/home/stefan/esp/sns_proto/main/main.c:177:35: error: 'card' undeclared (first use in this function)
sdmmc_card_print_info(stdout, card);
^
C:/msys32/home/stefan/esp/sns_proto/main/main.c:177:35: note: each undeclared identifier is reported only once for each function it appears in
C:/msys32/home/stefan/esp/sns_proto/main/main.c:153:38: warning: unused variable 'mount_config' [-Wunused-variable]
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
^
C:/msys32/home/stefan/esp/sns_proto/main/main.c:141:25: warning: variable 'slot_config' set but not used [-Wunused-but-set-variable]
sdspi_slot_config_t slot_config = SDSPI_SLOT_CONFIG_DEFAULT();
^
C:/msys32/home/stefan/esp/sns_proto/main/main.c:139:18: warning: unused variable 'host' [-Wunused-variable]
sdmmc_host_t host = SDSPI_HOST_DEFAULT();
^
make[1]: *** [/home/stefan/esp/esp-idf/make/component_wrapper.mk:243: main.o] Error 1
make: *** [C:/msys32/home/stefan/esp/esp-idf/make/project.mk:434: component-main-build] Error 2

Zwegogo
Posts: 7
Joined: Wed Oct 25, 2017 2:51 pm

Re: ILI9341 not working

Postby Zwegogo » Mon Nov 27, 2017 10:55 am

@loboris

Hi loboris,

To be sure I tested again by combining the original SD-card example with your newest tft demo. I get the errors below. It shows that there are still conflicts betwee spi_master and spi_master_lobo. Hopes this helps to resolve the issue.

Regards,

Stefan

$ make all
CC build/main/tft_demo.o
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/tft_new/main/sd_card_example_main.h:15,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:25:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:33:0: warning: "SPI_DEVICE_BIT_LSBFIRST" redefined
#define SPI_DEVICE_BIT_LSBFIRST (SPI_DEVICE_TXBIT_LSBFIRST|SPI_DEVICE_RXBIT_LSBFIRST); ///< Transmit and receive LSB first
^
In file included from C:/msys32/home/stefan/esp/tft_new/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:22:
C:/msys32/home/stefan/esp/tft_new/components/spidriver/spi_master_lobo.h:67:0: note: this is the location of the previous definition
#define SPI_DEVICE_BIT_LSBFIRST (SPI_TXBIT_LSBFIRST|SPI_RXBIT_LSBFIRST); ///< Transmit and receive LSB first
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/tft_new/main/sd_card_example_main.h:15,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:25:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:65:0: warning: "SPI_TRANS_MODE_DIOQIO_ADDR" redefined
#define SPI_TRANS_MODE_DIOQIO_ADDR (1<<4) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
^
In file included from C:/msys32/home/stefan/esp/tft_new/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:22:
C:/msys32/home/stefan/esp/tft_new/components/spidriver/spi_master_lobo.h:101:0: note: this is the location of the previous definition
#define SPI_TRANS_MODE_DIOQIO_ADDR (1<<2) ///< Also transmit address in mode selected by SPI_MODE_DIO/SPI_MODE_QIO
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/tft_new/main/sd_card_example_main.h:15,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:25:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:66:0: warning: "SPI_TRANS_USE_RXDATA" redefined
#define SPI_TRANS_USE_RXDATA (1<<2) ///< Receive into rx_data member of spi_transaction_t instead into memory at rx_buffer.
^
In file included from C:/msys32/home/stefan/esp/tft_new/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:22:
C:/msys32/home/stefan/esp/tft_new/components/spidriver/spi_master_lobo.h:102:0: note: this is the location of the previous definition
#define SPI_TRANS_USE_RXDATA (1<<3) ///< Receive into rx_data member of spi_lobo_transaction_t instead into memory at rx_buffer.
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/tft_new/main/sd_card_example_main.h:15,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:25:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:67:0: warning: "SPI_TRANS_USE_TXDATA" redefined
#define SPI_TRANS_USE_TXDATA (1<<3) ///< Transmit tx_data member of spi_transaction_t instead of data at tx_buffer. Do not set tx_buffer when using this.
^
In file included from C:/msys32/home/stefan/esp/tft_new/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:22:
C:/msys32/home/stefan/esp/tft_new/components/spidriver/spi_master_lobo.h:103:0: note: this is the location of the previous definition
#define SPI_TRANS_USE_TXDATA (1<<4) ///< Transmit tx_data member of spi_lobo_transaction_t instead of data at tx_buffer. Do not set tx_buffer when using this.
^
In file included from C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/sdspi_host.h:22:0,
from C:/msys32/home/stefan/esp/esp-idf/components/fatfs/src/esp_vfs_fat.h:21,
from C:/msys32/home/stefan/esp/tft_new/main/sd_card_example_main.h:15,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:25:
C:/msys32/home/stefan/esp/esp-idf/components/driver/include/driver/spi_master.h:41:15: error: conflicting types for 'transaction_cb_t'
typedef void(*transaction_cb_t)(spi_transaction_t *trans);
^
In file included from C:/msys32/home/stefan/esp/tft_new/components/tft/tftspi.h:11:0,
from C:/msys32/home/stefan/esp/tft_new/main/tft_demo.c:22:
C:/msys32/home/stefan/esp/tft_new/components/spidriver/spi_master_lobo.h:76:15: note: previous declaration of 'transaction_cb_t' was here
typedef void(*transaction_cb_t)(spi_lobo_transaction_t *trans);
^
make[1]: *** [/home/stefan/esp/esp-idf/make/component_wrapper.mk:243: tft_demo.o] Error 1
make: *** [C:/msys32/home/stefan/esp/esp-idf/make/project.mk:434: component-main-build] Error 2

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: ILI9341 not working

Postby loboris » Mon Nov 27, 2017 4:56 pm

@Zwegogo

I have now changed all conflicting names, and using SD Card in spi mode now works with TFT library.

Example is added to tft_demo.c, to run with SD Card test uncomment the code block from line 1116 to 1239 and line 1245.

Here is the example log:

Code: Select all

I (383) cpu_start: Pro cpu start user code
I (177) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.

=======================================================
===== Test using SD Card in SPI mode              =====
===== SD Card uses the same gpio's as TFT display =====
=======================================================

I (217) SDCard test: Initializing SD card
I (221) SDCard test: Using SPI peripheral
I (227) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
Name: SL08G
Type: SDHC/SDXC
Speed: default speed
Size: 7580MB
CSD: ver=1, sector_size=512, capacity=15523840 read_bl_len=9
SCR: sd_spec=2, bus_width=5
I (317) SDCard test: Opening file
I (336) SDCard test: File written
I (346) SDCard test: Renaming file
I (352) SDCard test: Reading file
I (354) SDCard test: Read from file: 'Hello SL08G!'
I (355) SDCard test: Card unmounted
===== SD Card test end ================================


==============================
TFT display DEMO, LoBo 11/2017
==============================
Pins used: miso=19, mosi=18, sck=5, cs=15
 Touch CS: 32
==============================

SPI: display device added to spi bus (1)
SPI: attached display device, speed=8000000
SPI: bus uses native pins: false
SPI: touch screen device added to spi bus (1)
SPI: attached TS device, speed=1000000
SPI: display init...
OK
STMPE touch initialized, ver: 0811 - 03
SPI: Max rd speed = 1000000
SPI: Changed speed to 26666666

---------------------
Graphics demo started
---------------------
I (1985) [TFT Demo]: Time is not set yet. Connecting to WiFi and getting time over NTP.
I (1997) wifi: wifi firmware version: 708a055
I (1997) wifi: config NVS flash: enabled
I (1997) wifi: config nano formating: disabled
I (1998) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (2007) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (2028) wifi: Init dynamic tx buffer num: 32
I (2029) wifi: Init data frame dynamic rx buffer num: 32
I (2029) wifi: Init management frame dynamic rx buffer num: 32
I (2033) wifi: wifi driver task: 3ffc5558, prio:23, stack:4096
I (2038) wifi: Init static rx buffer num: 10
I (2042) wifi: Init dynamic rx buffer num: 32
I (2046) wifi: wifi power manager task: 0x3ffca198 prio: 21 stack: 2560
I (2053) [TFT Demo]: Setting WiFi configuration SSID LoBoInternet...
I (2086) phy: phy_version: 366.0, ba9923d, Oct 31 2017, 18:06:17, 0, 0
I (2087) wifi: mode : sta (30:ae:a4:0c:f3:ac)
I (2208) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
I (2866) wifi: state: init -> auth (b0)
I (2869) wifi: state: auth -> assoc (0)
I (2876) wifi: state: assoc -> run (10)
I (2908) wifi: connected with LoBoInternet, channel 1
I (4996) event: sta ip: 192.168.0.19, mask: 255.255.255.0, gw: 192.168.0.1
I (4997) [TFT Demo]: Initializing SNTP
I (5501) [TFT Demo]: System time is set.
I (5501) wifi: state: run -> init (0)
I (5502) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
I (5513) wifi: flush txq
I (5513) wifi: stop sw txq
I (5513) wifi: lmac stop hw txq
E (5513) wifi: esp_wifi_connect 836 wifi not start


I (7611) [SPIFFS]: Registering SPIFFS file system
I (7611) [SPIFFS]: Mounting SPIFFS files system
I (7611) [SPIFFS]: Start address: 0x280000; Size 1024 KB
I (7617) [SPIFFS]:   Work buffer: 2048 B
I (7621) [SPIFFS]:    FDS buffer: 384 B
I (7626) [SPIFFS]:    Cache size: 2048 B
I (7668) [SPIFFS]: Mounted

==========================================
Display: ILI9341: PORTRAIT 240,320 Color

Zwegogo
Posts: 7
Joined: Wed Oct 25, 2017 2:51 pm

Re: ILI9341 not working

Postby Zwegogo » Tue Nov 28, 2017 11:18 am

@loboris

Hi Loboris,

Thanks for adding the SD card example to the tft example! I have tried and the tft.example works.
When i try to load one of the test images from the sd card i get the following errors.

Display: ILI9341: PORTRAIT 240,320 Color

E (8361) sdspi_host: data CRC failed, got=0xa17f expected=0xffff
I (8361) sdspi_host: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
E (8364) sdspi_host: sdspi_host_start_command: cmd=17 error=0x109
E (8370) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x109
E (8378) diskio_sdmmc: sdmmc_read_blocks failed (265)
E (8950) sdspi_host: data CRC failed, got=0xa17f expected=0xffff
I (8950) sdspi_host: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
E (8953) sdspi_host: sdspi_host_start_command: cmd=17 error=0x109
E (8959) sdmmc_cmd: sdmmc_read_sectors_dma: sdmmc_send_cmd returned 0x109
E (8967) diskio_sdmmc: sdmmc_read_blocks failed (265)


The SD_card test is succesful and the SD_card is succesfully mounted. Were you able to load the test images from your SD card in your setup?

Regards,

Stefan

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: ILI9341 not working

Postby loboris » Fri Dec 01, 2017 11:06 am

@Zwegogo
It looks like SD card in SPI mode and spi_master (on which this library is based) cannot work at the same time.
I'll try to find the solution, for now I've opened the issue at esp-idf GitHub.

Zwegogo
Posts: 7
Joined: Wed Oct 25, 2017 2:51 pm

Re: ILI9341 not working

Postby Zwegogo » Fri Dec 01, 2017 12:07 pm

@loboris

Hi, good that you ran into the same problem/errors, that gives a focus to find a solution. What would be your time estimate to solving this puzzle?

Regards,

Stefan

Navami GS
Posts: 1
Joined: Sun Aug 29, 2021 10:12 am

Re: ILI9341 not working

Postby Navami GS » Mon Aug 30, 2021 9:35 am

Hi,
I have a query regarding TFT displays to use with ESP32.

My setup is,
1. I'm using the ESPIDF version 2020-12 (4.18.0)
2. ESP32-WROOM-32UE on custom board
3. The Display controller is ILI9341. 240x320 TFT Color Display 2.4" .
4. Interconnection between ILI9341 and ESP32 is the SPI port. The DC pin is connected to IO12, the LED pin is connected to IO27 and the
Reset pin is connected to IO26.
5. Library: ESP32_TFT_Library by Loboris. (https://github.com/loboris/ESP32_TFT_library)

Query
1. I'm not able to display graphics on the TFT display, but text I don't have issues. (This issue persists with devkit and custom board)

I'm attaching the video for reference.
https://drive.google.com/file/d/1BtCJ-G ... sp=sharing

I'll appreciate all the help in this regard.
Expecting your earliest response.

Regards
Navami GS

Who is online

Users browsing this forum: No registered users and 59 guests