Navigation

    M5Stack Community

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

    cepics

    @cepics

    5
    Reputation
    177
    Posts
    3612
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    cepics Follow

    Posts made by cepics

    • RE: lovyan launcher doesn't compile on M5Stack basic

      yes!!

      posted in Arduino
      C
      cepics
    • RE: <SOLVED> M5Stack basic vs gray and SD card

      in SD.h I changed:

          bool begin(uint8_t ssPin=SS, SPIClass &spi=SPI, uint32_t frequency=4000000, const char * mountpoint="/sd", uint8_t max_files=5, bool format_if_empty=false);
      

      to

          bool begin(uint8_t ssPin=SS, SPIClass &spi=SPI, uint32_t frequency=1000000, const char * mountpoint="/sd", uint8_t max_files=5, bool format_if_empty=false);
      

      and in sd_diskio.cpp:

          if (card->frequency > 25000000) {
              card->frequency = 25000000;
          }
      

      to

          if (card->frequency > 10000000) {
              card->frequency = 10000000;
          }
      

      .... and now seems to work!!

      posted in Arduino
      C
      cepics
    • RE: <SOLVED> M5Stack basic vs gray and SD card

      I trierd to modify the sd.begin() function in the used SD.h with the new frequency .... but no joy!!

      still searching......

      any ideas??

      posted in Arduino
      C
      cepics
    • RE: lovyan launcher doesn't compile on M5Stack basic

      nobody?!?!

      posted in Arduino
      C
      cepics
    • lovyan launcher doesn't compile on M5Stack basic

      Hi all,

      arduino IDE 2.0.1 doesn't compile M5Stack_LovyanLauncher sketch with this error:
      (this is only the "red" part of the output)

      In file included from C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\LovyanLauncher.ino:43:
      C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\src\WiFiWPS.h: In member function 'void WiFiWPS::wpsInitConfig()':
      C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\src\WiFiWPS.h:23:16: error: 'struct esp_wps_config_t' has no member named 'crypto_funcs'
           wps_config.crypto_funcs = &g_wifi_default_wps_crypto_funcs;
                      ^~~~~~~~~~~~
      C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\src\WiFiWPS.h:23:32: error: 'g_wifi_default_wps_crypto_funcs' was not declared in this scope
           wps_config.crypto_funcs = &g_wifi_default_wps_crypto_funcs;
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\src\WiFiWPS.h: In member function 'virtual bool WiFiWPS::setup()':
      C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\src\WiFiWPS.h:100:37: error: no matching function for call to 'onEvent(void (&)(arduino_event_id_t, system_event_info_t))'
           onevent = WiFi.onEvent(WiFiEvent);
                                           ^
      In file included from C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WiFi\src/WiFiSTA.h:28,
                       from C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WiFi\src/WiFi.h:32,
                       from c:\Users\Documents\Arduino\libraries\M5Stack_TreeView\src/MenuItemWiFiClient.h:4,
                       from C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\LovyanLauncher.ino:31:
      C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WiFi\src/WiFiGeneric.h:159:21: note: candidate: 'wifi_event_id_t WiFiGenericClass::onEvent(WiFiEventCb, arduino_event_id_t)' <near match>
           wifi_event_id_t onEvent(WiFiEventCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX);
                           ^~~~~~~
      C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WiFi\src/WiFiGeneric.h:159:21: note:   conversion of argument 1 would be ill-formed:
      In file included from C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\LovyanLauncher.ino:43:
      C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\src\WiFiWPS.h:100:37: error: invalid conversion from 'void (*)(arduino_event_id_t, system_event_info_t)' to 'WiFiEventCb' {aka 'void (*)(arduino_event_id_t)'} [-fpermissive]
           onevent = WiFi.onEvent(WiFiEvent);
                                           ^
      In file included from C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WiFi\src/WiFiSTA.h:28,
                       from C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WiFi\src/WiFi.h:32,
                       from c:\Users\Documents\Arduino\libraries\M5Stack_TreeView\src/MenuItemWiFiClient.h:4,
                       from C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\LovyanLauncher.ino:31:
      C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WiFi\src/WiFiGeneric.h:161:21: note: candidate: 'wifi_event_id_t WiFiGenericClass::onEvent(WiFiEventSysCb, arduino_event_id_t)' <near match>
           wifi_event_id_t onEvent(WiFiEventSysCb cbEvent, arduino_event_id_t event = ARDUINO_EVENT_MAX);
                           ^~~~~~~
      C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\WiFi\src/WiFiGeneric.h:161:21: note:   conversion of argument 1 would be ill-formed:
      In file included from C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\LovyanLauncher.ino:43:
      C:\Users\Documents\Arduino\libraries\M5Stack_LovyanLauncher\LovyanLauncher\src\WiFiWPS.h:100:37: error: invalid conversion from 'void (*)(arduino_event_id_t, system_event_info_t)' to 'WiFiEventSysCb' {aka 'void (*)(arduino_event_t*)'} [-fpermissive]
           onevent = WiFi.onEvent(WiFiEvent);
                                           ^
      Multiple libraries were found for "SD.h"
        Used: C:\Users\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\libraries\SD
        Not used: C:\Users\AppData\Local\Arduino15\libraries\SD
      exit status 1
      
      Compilation error: 'struct esp_wps_config_t' has no member named 'crypto_funcs'
      

      all the libraries are up to date....

      I could upload the code with M5burner, but I need to modify the clock of the sd card in M5Stack.cpp from 40Mhz to 10Mhz to work with M5stack basic....

      some tips?

      tnks a lot

      posted in Arduino
      C
      cepics
    • RE: SD mount fail on M5Stack basic

      the first sketch works, with M5Stack basic, if I modify the M5Stack.cpp library from:

      // TF Card
      if (SDEnable == true) {
          SD.begin(TFCARD_CS_PIN, SPI, 40000000);
      }
      

      to

      // TF Card
      if (SDEnable == true) {
          SD.begin(TFCARD_CS_PIN, SPI, 10000000);
      }
      
      posted in Arduino
      C
      cepics
    • RE: <SOLVED> M5Stack basic vs gray and SD card

      tnks a lot to answer!!!

      but I can't find where the M5Stack.cpp file is invoked....

      mumble mumble...

      posted in Arduino
      C
      cepics
    • <SOLVED> M5Stack basic vs gray and SD card

      hi all
      I'm trying to use M5Stack-SD-Updater on M5stack basic (V2.61), but after flashing the M5Stack doesn't see the sd card....
      same process on M5Stack gray (v 2.4) works...

      same behavior if I use M5Burner to burn lovyan launcher on the two controllers... with the same sd card, M5gray can access to sd and M5basic don't

      I tried four different M5Stack basic unit ... same behavior!!

      ideas?
      tnks a lot!!!

      posted in Arduino
      C
      cepics
    • SD mount fail on M5Stack basic

      Hi all, I have problems with lovyan launcher... now the app doesn,t open the sd of the stack basic..

      when I burn lovyan launcher with M5burner in a M5stack basic, the sd fail... same proces on a M5Stack gray, works...

      on a basic unit, with this sketch, sd fail!!

      /*
      *******************************************************************************
      * Copyright (c) 2022 by M5Stack
      *                  Equipped with M5Core sample source code
      *                          配套  M5Core 示例源代码
      * Visit for more information: https://docs.m5stack.com/en/core/gray
      * 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/gray
      *
      * Describe: TF Card. TF卡
      * Date: 2022/3/25
      *******************************************************************************
          In this example, we will detect the existence of a file and perform read and
          write operations on it
          在这个示例中,我们将会检测某文件是否存在,并进行读写文件操作
      */
      
      #include <M5Stack.h>
      
      void setup() {
          M5.begin();
          if (!SD.begin()) {  // Initialize the SD card. 初始化SD卡
              M5.Lcd.println(
                  "Card failed, or not present");  // Print a message if the SD card
                                                   // initialization fails or if the
                                                   // SD card does not exist
                                                   // 如果SD卡初始化失败或者SD卡不存在,则打印消息
              while (1)
                  ;
          }
          M5.Lcd.println("TF card initialized.");
          if (SD.exists("/hello.txt")) {  // Check if the "/hello.txt" file
                                          // exists.查看是否存在"/hello.txt"文件
              M5.Lcd.println("hello.txt exists.");
          } else {
              M5.Lcd.println("hello.txt doesn't exist.");
          }
          M5.Lcd.println("Creating hello.txt");
          File myFile = SD.open("/hello.txt",
                                FILE_WRITE);  // Create a new file "/hello.txt".
                                              // 创建一个新文件"/hello.txt"
          if (myFile) {  // If the file is open, then write to it.
                         // 如果文件打开,则进行写入操作
              M5.Lcd.println("Writing to test.txt...");
              myFile.println("SD test.");
              myFile.close();  // Close the file. 关闭文件
              M5.Lcd.println("done.");
          } else {
              M5.Lcd.println("error opening test.txt");
          }
          delay(500);
          myFile = SD.open("/hello.txt",
                           FILE_READ);  // Open the file "/hello.txt" in read mode.
                                        // 以读取模式打开文件"/hello.txt"
          if (myFile) {
              M5.Lcd.println("/hello.txt Content:");
              // Read the data from the file and print it until the reading is
              // complete. 从文件里读取数据并打印到串口,直到读取完成.
              while (myFile.available()) {
                  M5.Lcd.write(myFile.read());
              }
              myFile.close();
          } else {
              M5.Lcd.println("error opening /hello.txt");  // If the file is not open.
                                                           // 如果文件没有打开
          }
      }
      
      void loop() {
      }
      

      .... on basic unit with this sketch, sd works

      // Libraries for SD card
      #include "FS.h"
      #include <SD.h>
      //#include "mySD.h"
      #include <SPI.h>
      
      
      // Define CS pin for the SD card module
      #define SD_MISO     19
      #define SD_MOSI     23
      #define SD_SCLK     18
      #define SD_CS       4
      SPIClass sdSPI(VSPI);
      
      String dataMessage;
      
      void setup() {
        // Start serial communication for debugging purposes
        Serial.begin(115200);
       
        // Initialize SD card
        //SD.begin(SD_CS);  
        sdSPI.begin(SD_SCLK, SD_MISO, SD_MOSI, SD_CS);
        if(!SD.begin(SD_CS, sdSPI)) {
          Serial.println("Card Mount Failed");
          return;
        }
        Serial.println("1");
        uint8_t cardType = SD.cardType();
        if(cardType == CARD_NONE) {
          Serial.println("No SD card attached");
          return;
        }
        Serial.println("Initializing SD card...");
        if (!SD.begin(SD_CS)) {
          Serial.println("ERROR - SD card initialization failed!");
          return;    // init failed
        }
        Serial.println("2");
        // If the data.txt file doesn't exist
        // Create a file on the SD card and write the data labels
        File file = SD.open("/data1.txt");
        if(!file) {
          Serial.println("File doens't exist");
          Serial.println("Creating file...");
          writeFile(SD, "/data1.txt", "Reading ID, Date, Hour, Temperature \r\n");
        }
        else {
          Serial.println("File already exists");  
        }
        file.close();
        logSDCard();
        
      }
      
      void loop() {
        // The ESP32 will be in deep sleep
        // it never reaches the loop()
      }
      
      // Write the sensor readings on the SD card
      void logSDCard() {
        //dataMessage = String(readingID) + "," + String(dayStamp) + "," + String(timeStamp) + "," + 
        //              String(temperature) + "\r\n";
        dataMessage = "Hello World \n";
        Serial.print("Save data: ");
        Serial.println(dataMessage);
        appendFile(SD, "/data1.txt", dataMessage.c_str());
      }
      
      // Write to the SD card (DON'T MODIFY THIS FUNCTION)
      void writeFile(fs::FS &fs, const char * path, const char * message) {
        Serial.printf("Writing file: %s\n", path);
      
        File file = fs.open(path, FILE_WRITE);
        if(!file) {
          Serial.println("Failed to open file for writing");
          return;
        }
        if(file.print(message)) {
          Serial.println("File written");
        } else {
          Serial.println("Write failed");
        }
        file.close();
      }
      
      // Append data to the SD card (DON'T MODIFY THIS FUNCTION)
      void appendFile(fs::FS &fs, const char * path, const char * message) {
        Serial.printf("Appending to file: %s\n", path);
      
        File file = fs.open(path, FILE_APPEND);
        if(!file) {
          Serial.println("Failed to open file for appending");
          return;
        }
        if(file.print(message)) {
          Serial.println("Message appended");
        } else {
          Serial.println("Append failed");
        }
        file.close();
      }
      

      maybe I have to change some pins assignement some where??

      tnks a lot!!

      posted in Arduino
      C
      cepics
    • RE: upload code to STAMP PWR485

      thnks!!!
      but how do I select one of the two rs485 port??

      posted in Cores
      C
      cepics