šŸ¤–Have you ever tried Chat.M5Stack.com before asking??šŸ˜Ž
  • SizeOf Structure M5Stack Core2 vs NANO

    Arduino
    4
    1 Votes
    4 Posts
    2k Views
    S
    yuyun2000, I wasn't able to get my structure to pass correctly. I ended up not only changing the double to a float, but I also changed it to another uint16_t. There was still a 1 byte difference in the sizes of the structure (Nano was 13, M5Stack was 14). I added the "uint8_t pad1" to the Nano so it was then 14 also. The comms routines that I have now shows that they both return a 0 (successful) but the data doesn't come across like it does with the Nano to Nano testing. I've decided to give up on sending the Structure and just assemble the data into a String Array and send that. I have it working as a String, but I'm changing it over to use a null terminated Character Array. Thanks Anyway, it was fun trying! Sir Michael
  • M5StamPLC and Serial1

    Arduino
    2
    0 Votes
    2 Posts
    1k Views
    Y
    The issue you're experiencing with the M5StamPLC.begin() function interfering with Serial1 is likely due to the library initializing or reconfiguring the hardware UART pins used by Serial1. Here's how you can resolve it: Solution: Check Pin Mapping: Ensure that the pins you're using for Serial1 (RX_PIN and TX_PIN) are not being reconfigured by the M5StamPLC.begin() function. The M5StamPLC library might initialize its own UART or other peripherals on the same pins. Explicitly Reinitialize Serial1 After M5StamPLC.begin(): Call Serial1.begin() again after M5StamPLC.begin() to ensure the UART settings are restored:void setup() { M5StamPLC.begin(); Serial1.begin(38400, SERIAL_8N1, RX_PIN, TX_PIN); } Use Alternative UART Pins: If the issue persists, try using a different UART (e.g., Serial2) if your hardware supports it. For example:Serial2.begin(38400, SERIAL_8N1, RX_PIN_2, TX_PIN_2); Review M5StamPLC Library Documentation: The M5StamPLC library might have specific requirements or conflicts with certain pins. Refer to the official documentation for details. Debugging: Add debug prints to verify if Serial1 is being initialized correctly:void setup() { Serial.begin(115200); // For debugging M5StamPLC.begin(); Serial1.begin(38400, SERIAL_8N1, RX_PIN, TX_PIN); Serial.println("Serial1 initialized"); } Additional Notes: If the problem is related to the M5StamPLC library's internal UART configuration, you may need to modify the library or contact M5Stack support (support@m5stack.com) for further assistance. https://chat.m5stack.com/
  • M5 Dial V1.1 CAN bus

    Arduino
    2
    0 Votes
    2 Posts
    1k Views
    Y
    @davidrubixbattery The compilation errors you're encountering are related to the ESP32CAN library in the Arduino IDE. Specifically, the errors indicate that certain registers and definitions (DPORT_PERIP_CLK_EN_REG, CAN_TX_IDX, CAN_RX_IDX, and ETS_CAN_INTR_SOURCE) are not declared in the current version of the ESP32 Arduino core library you're using. Steps to Resolve the Issue: Update the ESP32 Arduino Core: Ensure you are using the latest version of the ESP32 Arduino core. Open the Arduino IDE, go to Tools > Board > Boards Manager, search for "esp32", and update to the latest version. Check the ESP32CAN Library: The ESP32CAN library might not be compatible with the latest ESP32 Arduino core. Try using the M5Stack CAN library instead, as it is tailored for M5Stack products. Alternative Library: If the issue persists, consider using the ESP32 TWAI (CAN) API directly in your Arduino sketch. The TWAI API is the newer and recommended way to handle CAN communication on ESP32. Verify Hardware Connections: Ensure the Dial and Isolated CAN bus unit are correctly connected to the specified port (Port A) and that the pins are properly configured in your code. Example Code for M5Stack CAN: Here’s a basic example for initializing CAN on an M5Stack device: #include <M5Stack.h> #include "esp32_can.h" void setup() { M5.begin(); CAN_init(0, GPIO_NUM_5, GPIO_NUM_4); // Example pins for CAN TX and RX } void loop() { // Your CAN communication logic here } Additional Resources: M5Stack CAN Unit Documentation ESP32 TWAI API Reference https://chat.m5stack.com/
  • Help: A fatal error occurred: No serial data received.

    Arduino
    6
    0 Votes
    6 Posts
    6k Views
    H
    Hi! This error often happens due to unstable USB connections or driver issues. Try these steps: use a different USB cable (preferably a high-quality, data-capable one), connect directly to your Mac’s USB port (avoid hubs), and restart your Mac before uploading. Also, check that your ESP32-S3 drivers are properly installed and up to date. Lowering the upload baud rate (e.g., from 921600 to 115200) in the Arduino IDE can improve stability. If it persists, try uploading from another computer to rule out hardware issues. Hope this helps!
  • 0 Votes
    2 Posts
    1k Views
    No one has replied
  • SPIFFS Error: esptool not found!

    Arduino
    2
    0 Votes
    2 Posts
    4k Views
    H
    This error usually means the Arduino IDE can’t find the esptool utility required to upload SPIFFS data. To fix this, try these steps: Ensure you have the latest ESP32 board package installed via Board Manager. Restart the Arduino IDE after installation or updates. Check your system PATH environment variable includes the path to esptool (usually inside the ESP32 package folder). If the problem persists, try reinstalling the ESP32 core or upload SPIFFS data using the command line with esptool.py directly.
  • Unable to verify flash chip connection

    Arduino
    5
    0 Votes
    5 Posts
    7k Views
    H
    Try lowering the baud rate to 115200 in the upload settings—921600 can sometimes cause issues, especially on macOS. Also, double-check your USB cable (some are power-only), and try a different USB port or hub. If you're using a USB-C to serial adapter, that might be causing noise.
  • Board Manager 2.1.4 Failure in Arduino 1.8.19 IDE

    Arduino
    3
    0 Votes
    3 Posts
    3k Views
    W
    @kuriko I believe so, but now that I've patched M5Unified, I'd need to unpatch and test again. I'll report back if anything further happens.
  • How to make m5stickcplus2 mic test in arduino

    Arduino
    3
    0 Votes
    3 Posts
    2k Views
    M
    @kuriko yes!I tried this but it is not the frequency-amplitude data?
  • Core S3 OTG as USB Host

    Arduino
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • M5Dial can port a or b be used as a second serial port?

    Arduino
    6
    0 Votes
    6 Posts
    4k Views
    S
    @robski I managed to get it to work on Port B, defined the pins in Arduino and used: Serial1.begin(9600, SERIAL_8N1, rX1, tX1); Works well.
  • M5Dial: i2C voltage level, 3.3V or 5V?

    Arduino
    3
    1 Votes
    3 Posts
    2k Views
    N
    @robski Thanks a lot
  • M5Unit-8Encoder only for ESP32?

    Arduino
    4
    0 Votes
    4 Posts
    3k Views
    I
    Hi @felmue, thanks for responding. The M5Stack Supplied github example is below. /* Description: Provide three LEGO motor drive modes怂Press button B to switch the mode, button A and C control parameter value increase and decrease */ #include <M5Stack.h> #include "UNIT_8ENCODER.h" #include <M5GFX.h> M5GFX display; M5Canvas canvas(&display); UNIT_8ENCODER sensor; long delay_time = 0; void show_rgb_led(void) { sensor.setAllLEDColor(0xff0000); delay(1000); sensor.setAllLEDColor(0x00ff00); delay(1000); sensor.setAllLEDColor(0x0000ff); delay(1000); sensor.setAllLEDColor(0x000000); } void show_encoder_value(void) { int32_t encoder[8] = {0}; uint8_t btn_stauts[8] = {0}; bool switch_status = false; canvas.clear(BLACK); canvas.setCursor(80, 0); canvas.setTextSize(2); canvas.setTextColor(YELLOW); canvas.printf("8Encoder Demo"); canvas.setColor(ORANGE); canvas.drawLine(0, 25, 320, 25); canvas.drawLine(0, 25 + 30, 320, 25 + 30); canvas.setCursor(0, 30); canvas.setTextSize(2); canvas.setTextColor(WHITE); canvas.printf("1-4"); canvas.setColor(ORANGE); canvas.drawLine(60, 30, 60, 25 + 30); canvas.drawLine(125, 30, 125, 25 + 30); canvas.drawLine(190, 30, 190, 25 + 30); canvas.drawLine(255, 30, 255, 25 + 30); canvas.setColor(ORANGE); canvas.drawLine(0, 55 + 30, 320, 55 + 30); canvas.setCursor(0, 30 + 30); canvas.setTextSize(2); canvas.setTextColor(WHITE); canvas.printf("5-8"); canvas.setColor(ORANGE); canvas.drawLine(60, 25 + 30, 60, 55 + 30); canvas.drawLine(125, 25 + 30, 125, 55 + 30); canvas.drawLine(190, 25 + 30, 190, 55 + 30); canvas.drawLine(255, 25 + 30, 255, 55 + 30); canvas.setTextColor(GREEN); for (int i = 0; i < 8; i++) { encoder[i] = sensor.getEncoderValue(i); btn_stauts[i] = sensor.getButtonStatus(i); } for (int i = 0; i < 8; i++) { if (!btn_stauts[i]) { if (i < 4) canvas.fillRect(60 + 65 * i, 30, 65, 25, GREEN); else canvas.fillRect(60 + 65 * (i - 4), 60, 65, 25, GREEN); } } canvas.drawString(String(encoder[0]), 60, 30); canvas.drawString(String(encoder[1]), 125, 30); canvas.drawString(String(encoder[2]), 190, 30); canvas.drawString(String(encoder[3]), 255, 30); canvas.drawString(String(encoder[4]), 60, 60); canvas.drawString(String(encoder[5]), 125, 60); canvas.drawString(String(encoder[6]), 190, 60); canvas.drawString(String(encoder[7]), 255, 60); switch_status = sensor.getSwitchStatus(); canvas.setCursor(10, 120); canvas.setTextColor(WHITE); canvas.printf("switch:"); if (switch_status) { canvas.fillRect(100, 110, 50, 30, GREEN); } else { canvas.fillRect(100, 110, 50, 30, RED); } canvas.setColor(ORANGE); canvas.drawLine(0, 185, 320, 185); canvas.drawLine(120, 185, 120, 320); canvas.drawLine(210, 185, 210, 320); canvas.setTextColor(YELLOW); canvas.drawString("RGB", 30, 190); canvas.drawString("Show", 30, 220); canvas.drawString("Encoder", 130, 190); canvas.drawString("Reset", 130, 220); canvas.pushSprite(0, 0); } void setup() { M5.begin(true, false, true); M5.Power.begin(); display.begin(); sensor.begin(&Wire, ENCODER_ADDR, 21, 22, 100000UL); canvas.setColorDepth(8); // mono color // canvas.setFont(&fonts::efontCN_12); canvas.createSprite(display.width(), display.height()); delay_time = millis() + 10; } void loop() { show_encoder_value(); M5.update(); if (M5.BtnA.wasPressed()) { show_rgb_led(); } else if (M5.BtnB.wasPressed()) { for (int i = 0; i < 8; i++) { sensor.resetCounter(i); } } } My assumption was just to change line 110 from (their default esp32 pin definition) for SDA / SCL sensor.begin(&Wire, ENCODER_ADDR, 21, 22, 100000UL); To my pin definition for M5Dial Port A sensor.begin(&Wire, ENCODER_ADDR, 13, 15, 100000UL); However that didn't work, After hours and hours of mucking about I found what works for me. ADD #define WIRE Wire In Setup ADD WIRE.begin(13,15); sensor.begin(&Wire, ENCODER_ADDR, 13, 15, 100000UL); Full Working Code Below #include "M5Dial.h" #include <Arduino.h> #include <lvgl.h> //#include <Wire.h> #include <SPI.h> #include "ui.h" #include "ui_helpers.h" #include "UNIT_8ENCODER.h" UNIT_8ENCODER sensor; // init the tft espi static lv_disp_draw_buf_t draw_buf; static lv_disp_drv_t disp_drv; // Descriptor of a display driver static lv_indev_drv_t indev_drv; // Descriptor of a touch driver #define EXAMPLE_LCD_H_RES 240 #define EXAMPLE_LCD_V_RES 240 #define LV_VER_RES_MAX 240 #define LV_HOR_RES_MAX 240 M5GFX *tft; #define WIRE Wire void tft_lv_initialization() { lv_init(); static lv_color_t buf1[(LV_HOR_RES_MAX * LV_VER_RES_MAX) / 10]; // Declare a buffer for 1/10 screen size static lv_color_t buf2[(LV_HOR_RES_MAX * LV_VER_RES_MAX) / 10]; // second buffer is optionnal // Initialize `disp_buf` display buffer with the buffer(s). lv_disp_draw_buf_init(&draw_buf, buf1, buf2, (LV_HOR_RES_MAX * LV_VER_RES_MAX) / 10); tft=&M5Dial.Lcd; } // Display flushing void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) { uint32_t w = (area->x2 - area->x1 + 1); uint32_t h = (area->y2 - area->y1 + 1); tft->startWrite(); tft->setAddrWindow(area->x1, area->y1, w, h); tft->pushColors((uint16_t *)&color_p->full, w * h, true); tft->endWrite(); lv_disp_flush_ready(disp); } void init_disp_driver() { lv_disp_drv_init(&disp_drv); // Basic initialization disp_drv.flush_cb = my_disp_flush; // Set your driver function disp_drv.draw_buf = &draw_buf; // Assign the buffer to the display disp_drv.hor_res = LV_HOR_RES_MAX; // Set the horizontal resolution of the display disp_drv.ver_res = LV_VER_RES_MAX; // Set the vertical resolution of the display lv_disp_drv_register(&disp_drv); // Finally register the driver lv_disp_set_bg_color(NULL, lv_color_hex3(0x000)); // Set default background color to black } void my_touchpad_read(lv_indev_drv_t * drv, lv_indev_data_t * data) { uint32_t currentTime = millis(); M5.Touch.update(currentTime); if(M5.Touch.getCount() > 0) { auto pos = M5.Touch.getDetail(); data->state = LV_INDEV_STATE_PRESSED; data->point.x = pos.x; data->point.y = pos.y; } else { data->state = LV_INDEV_STATE_RELEASED; } } void init_touch_driver() { lv_disp_drv_register(&disp_drv); lv_indev_drv_init(&indev_drv); indev_drv.type = LV_INDEV_TYPE_POINTER; indev_drv.read_cb = my_touchpad_read; lv_indev_t * my_indev = lv_indev_drv_register(&indev_drv); // register } void setup() { auto cfg = M5.config(); M5Dial.begin(cfg, true, false); M5Dial.Display.setBrightness(80); Serial.begin(115200); tft_lv_initialization(); init_disp_driver(); init_touch_driver(); ui_init(); WIRE.begin(13,15); sensor.begin(&Wire, ENCODER_ADDR, 13, 15, 100000UL); } void loop() { uint32_t wait_ms = lv_timer_handler(); M5.delay(wait_ms); M5Dial.update(); } void SLS_Function_1(lv_event_t *e) { // Squareline Studio Function 1 Code Runs Here bool switch_status = false; sensor.setAllLEDColor(0x00ff00); // GREEN switch_status = sensor.getSwitchStatus(); Serial.println("function-1 Set All Leds Green - Switch Status is: " + String(switch_status)); } void SLS_Function_2(lv_event_t *e) { // Squareline Studio Function 2 Code Runs Here bool switch_status = false; sensor.setAllLEDColor(0x0000ff); // BLUE switch_status = sensor.getSwitchStatus(); Serial.println("function-2 Set All Leds Blue - Switch Status is: " + String(switch_status)); } So, I got there in the end, and a pretty easy fix, once you know. Isn't that half the fun?? I just think that their documentation is a little lacking unless you want to use the "Exact same HW setup" as provided in the limited examples. For example you have to dig into the github repo for this module to find all the functions available for this unit, especially if they are targeting a potentially large STEM customer base? Unless of course you just want to use UIFlow. Anyway, once again thanks for responding and hopefully the above may help anyone else using the Encoder.
  • PaperS3 cannot compile demo

    Arduino
    5
    0 Votes
    5 Posts
    4k Views
    Q
    Hello, I have the same problem. Has anyone found a solution?
  • Problems with BMI270 on M5StampFly (M5StampS3)

    Arduino
    3
    0 Votes
    3 Posts
    2k Views
    K
    @felmue Thanks for answering! Tried it and now I am getting always chip id 0xFF or 0x0 depended on data order in SPISettings (MSB or LSB first). Tried it with and without battery plugged in but there was no difference. Any other ideas?
  • What other M5Stack forums do you folks use?

    Arduino
    8
    0 Votes
    8 Posts
    5k Views
    TomKattT
    @ajb2k3 LOL - Silly that I never thought to check out the forums at Arduino proper... Most questions are probably generally related to generic ESP32 discussions, but there also seems to be a fair number of M5Stack users as well ;-) Perhaps I'll see some of you folks there...
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • M5Stack - Partitioning Schemes

    Arduino
    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Time - RTC vs ESP32 Clocks

    Arduino
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • drawString() - positioning confusion

    Arduino
    5
    0 Votes
    5 Posts
    3k Views
    teastainT
    @TomKatt BTW, I love your Blown Away by Maxell. The ā€˜Canvas’ is M5’s name for TFT_eSPI ! Keep up the good work!