Add TFT_eSPI_ESP32_C6.c and TFT_eSPI_ESP32_C6.h
I added TFT_eSPI_ESP32_C6.c and TFT_eSPI_ESP32_C6.h to fix the ESP32C6 compilation error. When using the TFT_eSPI library on Arduino, I found that using TFT_eSPI_ESP32 did not compile correctly. After several attempts and modifications, I finally chose to add the files TFT_eSPI_ESP32_C6.c and TFT_eSPI_ESP32_C6.h to resolve the compilation issues
I am trying the new files you made. at the compilation level there are no errors but when I go to load the esp32c6 program it crashes and restarts. 11:50:40.866 -> [ 817][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x4200d956 11:50:40.866 -> [ 817][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 14 successfully set to type GPIO (1) with bus 0xf 11:50:40.866 -> [ 818][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 14 successfully set to type SPI_MASTER_MOSI (36) wiGuru Meditation Error: Core 0 panic'ed (Store access fault). Exception was unhandled. 11:50:41.218 -> 11:50:41.218 -> Core 0 register dump:
With the official Espressif ESP32-C6-DevKitC-1-N8 Development Board (Amazon) connected to a 2.8 TFT Display 240x320 (touch display) which works perfectly on MEGA Arduinos with ILI9341 DRIVER.
I tried your update on my code by:
Copying: TFT_eSPI_ESP32_C6.c Copying: TFT_eSPI_ESP32_C6.h Updating: TFT_eSPI.cpp Updating: TFT_eSPI.h
But it still doesn't work at all. First of all, this ESP32 has no VSPI, it's FSPI:
I get it to compile when I do:
#define USE_FSPI_PORT
But then it keeps crashing and rebooting with this error:
Guru Meditation Error: Core 0 panic'ed (Store access fault). Exception was unhandled.
I also tried with ILI9341_2_DRIVER, but the same happens.
Can you guys check this and see if there's any quick fix?
With the official Espressif ESP32-C6-DevKitC-1-N8 Development Board (Amazon) connected to a 2.8 TFT Display 240x320 (touch display) which works perfectly on MEGA Arduinos with ILI9341 DRIVER.
I tried your update on my code by:
Copying: TFT_eSPI_ESP32_C6.c
Copying: TFT_eSPI_ESP32_C6.h Updating: TFT_eSPI.cpp Updating: TFT_eSPI.h But it still doesn't work at all. First of all, this ESP32 has no VSPI, it's FSPI:
I get it to compile when I do:
#define USE_FSPI_PORTBut then it keeps crashing and rebooting with this error:
Guru Meditation Error: Core 0 panic'ed (Store access fault). Exception was unhandled.
I also tried with ILI9341_2_DRIVER, but the same happens.
Can you guys check this and see if there's any quick fix?
@crmbz0r
Hi, I am trying to use TFT_eSPI with the XIAO ESP32-C6. I pulled PR #3399, which resolves the compilation issues for this MCU in Arduino IDE. However, I still cannot get my ST7789 240x240 display working via SPI. The wiring and pinout are correct, as it functions with other libraries. Is there anything else needed to make this work on the ESP32-C6? Any advice or insights would be greatly appreciated!
@emblink I got it working yesterday with a pretty similar setup (same display controller), I think you need to enable #define TFT_SDA_READ and #define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW) in the User_Setup.h file.
Let me know if that works, happy to help if it doesn't
Hi @DanielBrkr,
Thank you so much! #define TFT_SDA_READ resolved the issue.
It’s a bit tricky, as it's not directly mentioned in #include <User_Setups/Setup24_ST7789.h>. I didn’t wire the MISO line to the display, and since my setup worked with Adafruit_ST7789.h, I didn’t expect a "read" operation to be needed here. I also commented out User_Setup.h and missed the TFT_SDA_READ reference there—my mistake!
Thanks again for your help!
This is the final version modified based on the reference.:https://github.com/Cincinnatu/TFT_eSPI
FYI, I bought a Waveshare ESPC6-LCD-1.47 device and this PR made it compile properly. Thanks!
This is the final version modified based on the reference.:https://github.com/Cincinnatu/TFT_eSPI
Works great with Waveshare ESP32-C6 with built in 1.47" screen. Thank you!
Really really hope this gets included into bodmers
Hey @MagnusThome and @Nushio, can I check what setup settings did you use with the Waveshare ESP32-C6-LCD-1.47? This is what I created using the schematic from the Waveshare website but there does not seem to be any display, only backlight.
#define USER_SETUP_ID 999
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
#define TFT_SDA_READ // This option is for ESP32 ONLY, tested with ST7789 and GC9A01 display only
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define TFT_WIDTH 172
#define TFT_HEIGHT 320
#define TFT_BL 22 // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)
#define TFT_MOSI 6
#define TFT_SCLK 7
#define TFT_CS 14 // Chip select control pin
#define TFT_DC 15 // Data Command control pin
#define TFT_RST 21 // Reset pin (could connect to RST pin)
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define SPI_FREQUENCY 27000000
// Support for 1.47" 320x172 Round Rectangle Color IPS TFT Display
#define USER_SETUP_ID 71
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
#define TFT_WIDTH 172 // ST7789 172 x 320
#define TFT_HEIGHT 320 // ST7789 240 x 320
#define TFT_BL 22 // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)
#define TFT_MISO 5
#define TFT_MOSI 6
#define TFT_SCLK 7
#define TFT_CS 14 // Chip select control pin
#define TFT_DC 15 // Data Command control pin
#define TFT_RST 21 // Reset pin (could connect to RST pin)
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SMOOTH_FONT
#define SPI_FREQUENCY 80000000
#define USER_SETUP_INFO "User_Setup"
#define ST7789_DRIVER // Full configuration option, define additional parameters below for this display
#define TFT_RGB_ORDER TFT_BGR
#define TFT_WIDTH 172 // ST7789 172 x 320
#define TFT_HEIGHT 320 // ST7789 240 x 320
#define TFT_BL 22 // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)
#define TFT_MISO 5
#define TFT_MOSI 6
#define TFT_SCLK 7
#define TFT_CS 14 // Chip select control pin
#define TFT_DC 15 // Data Command control pin
#define TFT_RST 21 // Reset pin (could connect to RST pin)
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define SPI_FREQUENCY 80000000
#define SPI_READ_FREQUENCY 20000000
#define SPI_TOUCH_FREQUENCY 2500000
But, in my main setup code, I added:
#define TFT_BACKLIGHT 22
#define Frequency 1000
#define Resolution 10
void setup()
{
ledcAttach(TFT_BACKLIGHT, Frequency, Resolution);
ledcWrite(TFT_BACKLIGHT, 90); // Lowers screen brightness to 90%, 100% runs too hot IMO
}
Thank you both.
Thanks a lot for this PR! I tested on a waveshare ESP32-C6-LCD-1.47 and worked fine.
Thanks @MagnusThome, @Nushio, but most of all @Cincinnatu. I now have a working EEZ LVGL 8.3.5 project, following with the instructions of FlixMySwitch on YT, using the WS Dev board with 1.47 LCD. I use it in landscape and used the constructor for setting the Width (320) and Height (172). AFAIK, MISO is not connected on this Dev board (acc. to the schematics at the WS Wiki), so makes no sense to have this defined and TFT_SDA_READ on, but it is needed for it to work, I discovered. I used ST7789_DRIVER_2 which fixes the RGB-BGR issue for me. I can post my setup, but it is similar to the above ones.
Thanks for all you guys. I'm a noob. I want it to work with a Waveshare ESP32-C6-LCD-1.47 (172x320) board. someboy can help me out ? Do I have to clone Bodmer/TFT_eSPI or Cincinnatu's ? Then, Do I have to replace User_Setup.h with @Nushio 's 1st comment at all ? Then, Do I have to put the code in which @Nushio 's 2nd comment ? I appreciate in advance.
Thanks for all you guys. I'm a noob. I want it to work with a Waveshare ESP32-C6-LCD-1.47 (172x320) board. someboy can help me out ? Do I have to clone Bodmer/TFT_eSPI or Cincinnatu's ? Then, Do I have to replace User_Setup.h with @Nushio 's 1st comment at all ? Then, Do I have to put the code in which @Nushio 's 2nd comment ? I appreciate in advance.
Fellow Noob here too. I used Cincinnatu's fork. Just copied everything into the libraries folder. Then I have Magnus's User_Setup.h, except the first #define, for which I use #define USER_SETUP_INFO "User_Setup".
@JayWayAr THANKS A LOT! It works in Arduino IDE. Actually, my goal is to use TFT_eSPI with ESP-IDF, LVGL directly. Anyone knows about that ?
Thank you, all of you! I got my WaveShare C6 LCD 1.47 working with my HotHead test demo! Cheers, Terry
Can someone help? It only response me Guru Meditation Error: Core 0 panic'ed (Store access fault). Exception was unhandled.
Hey, Thanks, I managed to get my esp32_c6 1.9 Touch display 7789 to work with your TFT_eSPI mods but for the life of me can't get the touch to work. Do you have any ideas ?
@Nushio huge thanks for the setup and all that stuff!
@merc07 it does not have touch if I remember correctly
Hey, Thanks, I managed to get my esp32_c6 1.9 Touch display 7789 to work with your TFT_eSPI mods but for the life of me can't get the touch to work. Do you have any ideas ?
Is this the Waveshare unit? https://www.waveshare.com/wiki/ESP32-C6-LCD-1.9 it uses the I2C_QMI8658 touch overlay
Yes the Waveshare - You are correct, it is IC2 but the CST816 Figured that yesterday, hence the TFT eSPI doesn't work..
CST816S touch(18, 8, 21, 22); // sda, scl, rst, irq Still it seems none of the CST816 libraries work :(
Thanks for all you guys. I'm a noob. I want it to work with a Waveshare ESP32-C6-LCD-1.47 (172x320) board. someboy can help me out ? Do I have to clone Bodmer/TFT_eSPI or Cincinnatu's ? Then, Do I have to replace User_Setup.h with @Nushio 's 1st comment at all ? Then, Do I have to put the code in which @Nushio 's 2nd comment ? I appreciate in advance.
Fellow Noob here too. I used Cincinnatu's fork. Just copied everything into the libraries folder. Then I have Magnus's User_Setup.h, except the first #define, for which I use #define USER_SETUP_INFO "User_Setup".
HOLY SHIT Thank you so much guys, I've been trying to figure out this for like 6 hours, y'all saved me. THANK YOU @Cincinnatu
This seems like a pretty simple patch, any chance it could be merged in?
Can anyone explain how to use this? Just for a change of pace - how is this done? Where are the files? TFT_eSPI_ESP32_C6.c and h?
If I finally make them can I upload them here so people can download them?
