How to Run a Demo with M5stack


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

// 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

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: then I’ve used my friend Google to search for M5Stack library source and he found this 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 ?

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.

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

1 Like

I’m trying to get my m5stack together with vscode + platformio running. But could not find a example to give me a kickstart.
I failed to transfer the esp32 example to platformio. Failed also with transfer the platformio example from stm32 to esp32. (Compiles for stm32 but not for esp32)
I’m not an expert - especially not for build environments.
Any hint where I can get a fresh quickstart?