Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Hamnet
    H
    • Continue chat with Hamnet
    • Start new chat with Hamnet
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    Hamnet

    @Hamnet

    2
    Reputation
    23
    Posts
    566
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Hamnet Follow

    Posts made by Hamnet

    • M5Paper crashing on EPD.Clear, or SPIFFs.begin

      Hello,

      I started working on M5Paper in the summer, had fun, got my project more or less working. Then life got in the way, I got a new computer, I moved house.

      Now I've finally opened it up again. Installed the driver and Arduino IDE (2.0.3, previously I was using 1.8) on my new computer (Macbook M1, previously on Intel Macbook); installed the M5Stack board manager, installed the M5EPD library; compiled my program, uploaded it.

      Serial monitor just showed repeated

      M5EPD initializing...OK
      M5EPD initializing...OK
      M5EPD initializing...OK
      

      ... etc

      I added a few more lines of debugging,

        Serial.println("\n\n------- begin ----");
        M5.begin();
        Serial.println("------- SetRotation ----");
        M5.EPD.SetRotation(90);
        Serial.println("------- Clear ----");
        M5.EPD.Clear(true);
      

      now I get repeated

      ------- begin ----
      M5EPD initializing...OK
      ------- SetRotation ----
      ------- Clear ----
      
      ------- begin ----
      M5EPD initializing...OK
      ------- SetRotation ----
      ------- Clear ----
      

      ... etc

      • in other words, it's crashing in M5.EPD.Clear(true);.

      If I comment out the call to M5.EPD.Clear, then I get as far as the next debugging statement, but the next call, to SPIFFS.begin, also crashes.

      Finally I created a new sketch, and copied the 'Hello World' code from https://docs.m5stack.com/en/quick_start/m5paper/arduino into it. Uploaded that, and back to the minimal output:

      M5EPD initializing...OK
      M5EPD initializing...OK
      M5EPD initializing...OK
      

      ... etc

      Can anyone suggest what might be going on here? Is there a problem with the 2.0.3 IDE? Do I need to update firmware to account for some updated libraries?

      Thanks in advance for any help you can give.

      posted in Arduino
      H
      Hamnet
    • RE: Some questions about power

      Thank you Felix. Disappointing that all the substantial sleep modes cause a reboot!

      My remaining question then is about how to enter light sleep.

      I found your post here from two years ago. And this post. There was also this, which is not M5 specific.

      From these I think that I need to do something like this:

        M5.disableEPDPower();
        M5.disableEXTPower();
      
        // then this??
        M5.Axp.LightSleep(SLEEP_SEC(5));
        
       // or this??
       esp_sleep_enable_timer_wakeup(5 * 1000 * 1000);
       esp_light_sleep_start();
      

      Can you clear up my confusion? And (for light sleep) do I need to do anything special with GPIO settings, which I can see from some of your earlier notes?

      thanks again.

      posted in Arduino
      H
      Hamnet
    • Some questions about power

      I've nearly completed my project on M5Paper, with thanks to the people on this forum who've helped me over many hurdles. The crucial last aspect is to get it running as long as possible on battery.

      Basically my project loads about 5 days worth of data from an internet resource; and then should update a display based on this data every 10 minutes or so.

      My original intention (based on this line in the product description "battery life can be further preserved by using the RTC to set the device into deep sleep and wake it up again when needed") was that it could shut down completely, leaving the display intact; wake up every 10 minutes to update just a bit of the display; and every 4-5 days refresh the data feed.

      However, it now appears that using the shutdown function with a time delay actually reboots the device when the time expires, rather than just waking up.

      Q1: Is that correct, or have I missed an option that will to shut down everything except the RTC, but preserve state so that it doesn't reboot on wake up?

      The second issue is that I don't want the display flashing every 10 minutes; it's an essential aspect of this project that the display should be discreet. Hence I only want to make small updates to the display every 10 minutes; larger updates every six hours or so.

      From experiments, it's evident that the basic arduino 'delay' function makes little or no difference to power consumption.

      I understand from the data on @felmue's info page and from this forum post that it should be possible to use either "light sleep" or "deep sleep". But (a) I've not been able to figure out the code for this and (b) I'm not clear from these sources whether I need to make a hardware modification before it is safe (and effective?) to use these functions. (I'm using an M5Paper V1.1.)

      Q2: Is deep sleep my next best option to conserve power between updates, without causing massive screen blink?

      Q3: Do I need to make a hardware modification in order to access this?

      Finally, if I indeed I can get somewhere with the rest of this, I'm thinking that I'll do a completely shutdown for six hours or so in the middle of the night. That will probably mean reloading the data every 24 hours instead of every 4-5 days.

      Q4: If I shut down the wifi immediately after loading data; is the power required to start up the wifi, find the access point, load the data etc more often significant? Or is the power draw of the device as a whole remain fairly steady regardless of whether the wifi is on? If I do shutdown every night, is it worth writing the data to SPIFFS so that it can recover it locally after rebooting, rather than getting it from the internet each time?

      TIA for answers to any or all of these questions!

      posted in Arduino
      H
      Hamnet
    • RE: Accessing SPIFFS independently of loading program

      @felmue Thank you so much Felix, you've helped me again.

      posted in Arduino
      H
      Hamnet
    • Accessing SPIFFS independently of loading program

      I have some questions about SPIFFS.

      I think I understand how to access it from within my program (theoretically, I haven't tried this). But I've a couple of theoretical questions, and one practical one:

      Do the contents survive hard reset?
      Do the contents survive uploading new software?

      My interest is in using it to store font files for use on M5Paper. I've seen examples referencing a font file on SPIFFS. My practical question is how they get there! Is there a way to store data on SPIFFS independently of the program I upload. That is, can I upload some font files; and then access them regardless of the programs I'm uploading? Or does each program have to first download the font file from somewhere, store it on SPIFFS, so it can then access it?

      (Or do I need to write a program to load a file on to SPIFFS, run that, then overwrite it with the program that will use those files?)

      Apologies if this is covered somewhere in docs, I couldn't see it.

      TIA

      posted in Arduino
      H
      Hamnet
    • RE: Retrieving data over HTTPS (M5 Paper, but I think this is a generic question)

      @felmue Thanks Felix, that got me over the hump! I think the issue was trying to convert my existing example directly.

      posted in Arduino
      H
      Hamnet
    • RE: Retrieving data over HTTPS (M5 Paper, but I think this is a generic question)

      (I should add - as a temporary workaround I can access an https: resource by calling client.setInsecure(); but I'm looking for a proper solution.)

      posted in Arduino
      H
      Hamnet
    • Retrieving data over HTTPS (M5 Paper, but I think this is a generic question)

      I'm sure this is basic but it's driving me crazy. I can retrieve data over wifi from an "http:" source with no problem. But I can't figure out how to access a URL over https.

      All the examples I can find online - for Arduino, ESp32, or M5 - seem to use http: URLs in their demos. I've found references to WifiClientSecure, but not a usable example. Evidently simply substituting it for WifiClient is not sufficient!

      The canvas.drawJpgUrl function works with an "https:" URL, so clearly there is no fundamental difficulty.

      Googling led me to this excellent library "Fetch": but alas the examples don't compile, a problem others have noted.

      Probably part of the problem is the number of different libraries with similar or even identical names, and different versions of the same library.

      Please can someone recommend the current best (or at least good!) library to use, and point me at a working example?

      Thanks in advance!

      posted in Arduino
      H
      Hamnet
    • RE: Another basic question: how do the APIs interact?

      @ajb2k3

      To clarify, I think you're implying that some of the other APIs are available to me on M5Paper, but some aren't - is that correct?

      Yes, correct.

      Is there any way to tell which ones can and which can't? Is it API by API, or is it more granular - certain functions documented under other APIs are available?

      For example, are the functions under https://docs.m5stack.com/en/api/core/power available - lightSleep, deepSleep etc?

      Thanks again for all the help.

      posted in Arduino
      H
      Hamnet