m5stack / M5Stack

M5Stack Arduino Library
MIT License
1.19k stars 425 forks source link

Question - M5Stack and ST7789 display with 8-bit parallel interface #313

Closed brightproject closed 1 year ago

brightproject commented 1 year ago

It's not really an issue - I just need the community's help. I have an example source code that is written for a m5stack device. But I don't have M5stack available, although I'm very interested in this device and maybe I'll buy myself such a thing somehow ... but later. I'm developing my own device, it's a prototype aircraft instrument - it's also based on ESP32-wroom(D0WDQ5 Rev 3) For display, I use a 2.8 inch display running on the ST7789 driver. photo1687542368 On the photo stm32f401ccu6 - do not pay attention, just an old photo, now this display is connected to the ESP-32 and the same picture is displayed. photo1687531275

I connected the display via an 8-bit parallel interface.

// ESP32 pins used
#define TFT_CS   33  // Chip select control pin
#define TFT_DC   15  // Data Command control pin - must use a pin in the range 0-31
#define TFT_RST  32  // Reset pin

#define TFT_WR    4  // Write strobe control pin - must use a pin in the range 0-31
#define TFT_RD    2

#define TFT_D0   12  // Must use pins in the range 0-31 for the data bus
#define TFT_D1   13  // so a single register write sets/clears all bits
#define TFT_D2   26
#define TFT_D3   25
#define TFT_D4   17
#define TFT_D5   16
#define TFT_D6   27
#define TFT_D7   14

ESP32 + display works fine with the library TFT_eSPI @Bodmer But I can't get the example code to work on this hardware. As far as I understand, the source code includes the m5stack library using the line of code #include <M5Stack.h> This file includes libraries for working with buttons, tilt sensors and the display itself. #include "M5Display.h" In this file, "miracles" happen and the fun begins for me. Actually there is a connection of the modified library * and configurations, with the necessary pins and defines.

#include "utility/Config.h"
#include "utility/In_eSPI.h"

I changed the settings and paths in the file In_eSPI_Setup.h

//#include "ILI9341_Defines.h"
//#define TFT_DRIVER 0x9341

#include <Free_Fonts.h>
#include "In_eSPI_Drivers/ST7789_Defines.h"
#define TFT_DRIVER 0x7789

Changed also in In_eSPI.cpp

#elif defined(ST7789_DRIVER)
 #include "In_eSPI_Drivers/ST7789_Init.h"

I put the required files in the folder In_eSPI_Drivers The sketch from the example compiled successfully, the brightness is adjusted with the buttons...but the display is white. Specified in the settings file In_eSPI_Setup.h such defines

#define ESP32
#define TFT_PARALLEL_8_BIT

// Only define one driver, the other ones must be commented out
//#define ILI9341_DRIVER
#define ST7789_DRIVER

but the display is still white. When I specify ESP32_parallel define #define ESP32_PARALLEL I get an error in determining registers during compilation. Скриншот 28-06-2023 13 51 33 I tried to use the library files * from the tft_spy repository itself, as well as from the new version of M5CoreS3 - but there is no result. As soon as you include the file TFT_eSPI.h of the TFT_eSPI library directly in the file M5Display.h, you get a font error, although all links to the file are intact, the files are in folders...

C:\Users\Admin\Documents\Arduino\libraries\GaugeWidgets\examples\GaugeWidgets_demo\GaugeWidgets_demo.ino:944:21: note: in expansion of macro 'FSSB24'
   gdraw.setFreeFont(FSSB24);

I understand that the problem is most likely in my low programming skills. But why is the problem so vague? Please help.

Tinyu-Zhao commented 1 year ago

M5Stack library built in TFT_eSPI library version is not the latest, inevitably there will be conflicts, please choose one of the two libraries, rather than using them together.

BTW, It is better to ask such questions in our community, and only questions related to the M5Stack library itself will be addressed here