M5Paper Canvas not working in Arduino IDE



  • Yesterday I received the M5Paper.
    Nice device, with a handy size.
    The tests on the M5Paper thought it right. But some examples in the Arduino IDE turn out not to work. After execution and loading, the screen remains blank.
    I hope these Arduino written programs have been tested before they are published!

    Even a simple program turns out not to work, which I have included.

    #include <M5EPD.h>
    #include "binaryttf.h"
    
    M5EPD_Canvas canvas(&M5.EPD);
    
    void setup()
    {
        M5.begin();
        M5.EPD.SetRotation(0);
        M5.TP.SetRotation(0);
        M5.EPD.Clear(true);
        
        canvas.loadFont(binaryttf, sizeof(binaryttf));
        canvas.createCanvas(540, 960);
        canvas.setTextSize(48);
        canvas.drawString("4567", 0 , 0);
        canvas.pushCanvas(0, 0, UPDATE_MODE_GC16);   
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    }
    

    I hope someone can help me with this so that it won't be a bit of a mess.

    With best regards,

    Jan
    Hellevoetsluis-NL



  • @powersoft have you tried any of the built in examples in the M5Paper library?



  • Did you make any progress on this?

    The "HelloWorld.ino" example from M5EPD which I believe is very similar to the one above.. does not work either..

    #include <M5EPD.h>
    
    M5EPD_Canvas canvas(&M5.EPD);
    
    void setup()
    {
        M5.begin();
        M5.EPD.SetRotation(90);
        M5.EPD.Clear(true);
        M5.RTC.begin();
        canvas.createCanvas(540, 960);
        canvas.setTextSize(3);
        canvas.drawString("Hello World", 45, 350);
        canvas.pushCanvas(0,0,UPDATE_MODE_DU4);
    }
    
    void loop()
    {
    
    }
    

    Produces a blank page when rendered.



  • The problem including in some of the built in examples (HelloWorld.ino) seems to be related to the canvas size.. in the Hello World example it creates a 540x960 canvas (which is the resolution of the display)

    If you drop that down to 540x400.. it works fine.. Is there not enough RAM to create a canvas the size of the display maybe?



  • To go full circle and solve the issue... Are you using platformio rather than arduino?

    You need to add:

    # Name,   Type, SubType, Offset,  Size, Flags
    nvs,      data, nvs,     0x9000,  0x5000,
    otadata,  data, ota,     0xe000,  0x2000,
    app0,     app,  ota_0,   0x10000, 0x640000,
    app1,     app,  ota_1,   0x650000,0x640000,
    spiffs,   data, spiffs,  0xc90000,0x370000,
    

    in a new file "default_16MB.csv" in the same folder as platformio.ini, and modify platformio.ini to add:

    board_build.partitions = default_16MB.csv
    build_flags = 
    	-DCORE_DEBUG_LEVEL=4
    	-DBOARD_HAS_PSRAM
    	-mfix-esp32-psram-cache-issue
    

    Which fixes the RAM issue and allows using the full size canvas.



  • @sambartle
    Yes, all is working fine. When I was srated i dont find the M5Paper. After installing all m5stack elements I had the posibility tp choose th M5Paper, snd all examples running well!



  • @powersoft glad you got it sorted out :)



  • @sambartle I struggled for a few hours now to find out why the display is not showing anything ... then I found your response here. Now it works flawlessly - thanks a lot!

    M5 folks: you might want to add that to your library's README on GitHub - I can't be the only one who wants to use platformio for developing software for the M5 Paper.



  • Is there a fix for arduino IDE as well? Having the exact same issue with the canvas size on latest arduino IDE. Or did I use the wrong board configuration? (Using M5Stack-Core-ESP32 because there is no dedicated M5Paper board config)



  • Is there a working solution for the Arduino IDE as well?
    Also: is there an official board configuration available yet? I only find M5Core, M5Stick C,... but none for the M5Paper



  • @mattp reupdate arduino libs and board definations as there is a M5paper option now under boards.



  • @mattp
    Hello, found the solution into this video frome LUKE

    “M5Paper Seasons Greetings Display” on youtube.

    He describe how to load the definitions of the m5stack boards.

    This video was verry helpfull for me😮



  • @powersoft, @ajb2k3
    Thank you both for your answers.
    The board manager url found on https://docs.m5stack.com/#/en/arduino/arduino_development is apparently the old one and still does not contain the M5Paper board, but through the youtube video powersoft recommended I was able to find the correct url and everything works now as expected :)