You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using your library on my project with the esp-idf. The library works fine but there is an error raised from the GPIO controller inside esp when I don't define the TFT_CS pin in the code (or define it to -1 as you did). My board doesn't have a CS pin since it is fixed in the PCB and there are no other free pins to use in place of this pin.
As I said, the code compiles just fine and works as expected when configured correctly. It only raises a trivial error in the logs when I try to monitor the board.
Here is my setup:
MCU: ESP32-S3-WROOM-1-N16R2
ESP-IDF: v4.4
Flash and RAM mode: QIO
Flash and RAM speed: 120 MHz
CPU Speed: 240 MHz
Here is the LCD Configuration:
#ifndef __OCM_LCD_SETUP__
#define __OCM_LCD_SETUP__
#define USER_SETUP_ID 146
#define TFT_PARALLEL_8_BIT
#define ILI9488_DRIVER
#include "BoardDefinitions.h"
// ESP32 S3 pins used for the parallel interface TFT
//#define TFT_CS PIN_LCD_CS // Not used if the CS pin is fixed on the PCB.
#define TFT_DC PIN_LCD_DC // Data Command control pin - must use a GPIO in the range 0-31
#define TFT_RST PIN_LCD_RST
#define TFT_WR PIN_LCD_WR // Write strobe control pin - must use a GPIO in the range 0-31
#define TFT_RD PIN_LCD_RD
#define TFT_D0 PIN_LCD_D0 // Must use GPIO in the range 0-31 for the data bus
#define TFT_D1 PIN_LCD_D1 // so a single register write sets/clears all bits
#define TFT_D2 PIN_LCD_D2
#define TFT_D3 PIN_LCD_D3
#define TFT_D4 PIN_LCD_D4
#define TFT_D5 PIN_LCD_D5
#define TFT_D6 PIN_LCD_D6
#define TFT_D7 PIN_LCD_D7
#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
#endif
I know this error is indeed caused by the TFT_CS pin since I tried to temporarily replace it with another pin that is used for something else and the error disappeared from the logs.
I found the root of this issue to be the definitions in the: TFT_eSPI_ESP32_S3.h file and the other board files where you defined the TFT_CS as -1 if there aren't any other definitions like so:
#ifndef TFT_CS
#define TFT_CS -1 // Keep DMA code happy
#define CS_L // No macro allocated so it generates no code
#define CS_H // No macro allocated so it generates no code
#else
I understand this is needed for some other parts of the code, but the error is raised when the TFT_eSPI.cpp calls the pinMode method without checking whether the pin is negative. Thus resulting in a GPIO number error:
#if defined (TFT_CS) && !defined(RP2040_PIO_INTERFACE)
// Set to output once again in case MISO is used for CS
pinMode(TFT_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
#elif defined (ARDUINO_ARCH_ESP8266) && !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_SPI)
spi.setHwCs(1); // Use hardware SS toggling
#endif
I tried to add #if TFT_CS >= 0 like in the other places you used it and the errors disappeared. Here is how I did it:
#if defined (TFT_CS) && TFT_CS >= 0 && !defined(RP2040_PIO_INTERFACE)
// Set to output once again in case MISO is used for CS
pinMode(TFT_CS, OUTPUT);
digitalWrite(TFT_CS, HIGH); // Chip select high (inactive)
#elif defined (ARDUINO_ARCH_ESP8266) && !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_SPI)
spi.setHwCs(1); // Use hardware SS toggling
#endif
But I didn't know if it would interfere with the other parts of the library. So, I didn't create a pull request.
If this fixes this pin, the same change might also be needed for other non-essential pins if any.
This discussion was converted from issue #2456 on March 02, 2023 18:10.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, Thank you for making this library.
I am using your library on my project with the esp-idf. The library works fine but there is an error raised from the GPIO controller inside esp when I don't define the TFT_CS pin in the code (or define it to -1 as you did). My board doesn't have a CS pin since it is fixed in the PCB and there are no other free pins to use in place of this pin.
As I said, the code compiles just fine and works as expected when configured correctly. It only raises a trivial error in the logs when I try to monitor the board.
Here is my setup:
MCU: ESP32-S3-WROOM-1-N16R2
ESP-IDF: v4.4
Flash and RAM mode: QIO
Flash and RAM speed: 120 MHz
CPU Speed: 240 MHz
Here is the LCD Configuration:
Here is the error log:
I know this error is indeed caused by the TFT_CS pin since I tried to temporarily replace it with another pin that is used for something else and the error disappeared from the logs.
I found the root of this issue to be the definitions in the: TFT_eSPI_ESP32_S3.h file and the other board files where you defined the TFT_CS as -1 if there aren't any other definitions like so:
I understand this is needed for some other parts of the code, but the error is raised when the TFT_eSPI.cpp calls the pinMode method without checking whether the pin is negative. Thus resulting in a GPIO number error:
I tried to add #if TFT_CS >= 0 like in the other places you used it and the errors disappeared. Here is how I did it:
But I didn't know if it would interfere with the other parts of the library. So, I didn't create a pull request.
If this fixes this pin, the same change might also be needed for other non-essential pins if any.
Thank you for your help and time,
Best Regards.
Beta Was this translation helpful? Give feedback.
All reactions