How to Run a Demo with M5stack

Description

Good,day!
I want to know how to run a demo in M5stack.

What MCU/Processor/Board and compiler are you using?

M5stack , VSCode with PlatformIO , LittlevGL(v6)

What do you want to achieve?

I want to use a LittlevGL in the screen that is implemented in the M5stack.

What have you tried so far?

I matched the pin assignment of the TFT_eSPI library to the M5stack.
However, I can only see the sandstorm.

Code to reproduce

TFT_eSPI/User_Setup.h
// For the M5Stack module use these #define lines
#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS   14  // Chip select control pin
#define TFT_DC   27  // Data Command control pin
#define TFT_RST  33  // Reset pin (could connect to Arduino RESET pin)
#define TFT_BL   32  // LED back-light (required for M5Stack)

Screenshot and/or video

Hi,
AFAIK the M5 has special version of the TFT_eSPI library. Are you using their special version or the standard one?

Thanks, Pablo.
I didn’t even know a special version existed.
I’ve been using the same TFT_ eSPI library for some time now.
It’s probably the standard version.
Where’s the special TFT_eSPI library?

So I’ve take simple look to the TFT_eSPI repo and… look ma’ what I’ve found: https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup12_M5Stack.h then I’ve used my friend Google to search for M5Stack library source and he found this https://github.com/m5stack/M5Stack/blob/master/src/M5Display.cpp so I was actually wrong - the is no special version of the library, but special user configuration in TFT_eSPI and special additional setup.

That’s great!!!
I checked “Setup12.M5stack.h” and it looks like I needed #define M5STACK.
When I added it, it was no longer a sandstorm.
However, the night theme is not adapted.I think the colors are reversed.

Do you know anything about this?

Unfortunately I don’t have any M5Stack, but can it be this https://github.com/m5stack/M5Stack/blob/e8085b06f26d59014cdb8950104aac33293edda6/src/M5Display.cpp#L36 ?

I referred to it, but it seems a bit esoteric to me.
The M5stack’s display driver appears to be a special ILI9341.
It seems to be using BGR for color representation, but I was able to fix that by setting up the TFT_eSPI library.
The problem is that the positives and negatives of the colors are reversed.

Is it still a setting on the TFT_ eSPI side?

I’m unable to say if it is in TFT_eSPI or in the color type in LVGL. You probably have to test the right colors with simple fill screen or something like this.

I have once again made a comparison with the project you told me about.
As a result, I found that I was hitting the registers directly with the display driver code.
I have mimicked it in my library.
image


With that, the theme color has been successfully returned!
Now you can play with M5stack. Thanks to you, Pablo!

1 Like