Core 2 and COMMU

  • Hello,

    I recently purchased an M5Stack Core 2.
    I want to use it with the Arduino IDE in its latest version (Windows 10) .

    I try to run example touch.ino while choosing board "M5Stack-Core-Esp32" or "M5Stack-Core2".

    if I add the COMMU extension (I need the CAN Bus) I get the following error message regardless of the card:

    Configuring flash size ...
    Warning: Could not auto-detect Flash size (FlashID = 0x0, SizeID = 0x0), defaulting to 4MB
    Compressed 8192 bytes to 47 ...
    Writing at 0x0000e000 ... (100%)
    Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 21845.2 kbit / s) ...

    A fatal error occurred: Timed out waiting for packet header

    No solution found on internet.

    Thanks for your help.


  • Hello, could you try to change the USB cable to different one and try to write the program again?

  • @zontex Hello,

    I try with the USB cable delivered with Core 2 or one of mine, nothing change.

  • @benjo51 Could you please try to use M5Burner to burn the UIFlow firmware and see if you get the same error?

  • @zontex Without COMMU of course no error but with COMMU I have this one

    Start Burn

    --chip esp32 --port COM3 --baud 921600 --before default_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 D:\F - Locoduino\M5Stack\M5Burner\packages\fw\core\UIFlow_Core2-v1.7.0-core2.bin v2.5.0
    Serial port COM3

    Chip is ESP32D0WDQ6 (revision 1)
    Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse
    MAC: 84:cc:a8:60:ed:ac
    Uploading stub...
    Running stub...
    Stub running...
    Changing baud rate to 921600
    Configuring flash size...
    Warning: Could not auto-detect Flash size (FlashID=0xffffff, SizeID=0xff), defaulting to 4MB

    A fatal error occurred: File D:\F - Locoduino\M5Stack\M5Burner\packages\fw\core\UIFlow_Core2-v1.7.0-core2.bin (length 8376320) at offset 4096 will not fit in 4194304 bytes of flash. Use --flash-size argument, or change flashing address.

    Burn Failed

  • Hello @Benjo51

    just to be clear. You are able to flash your M5Core2 as long as the COMMU module is not connected (stacked) to it, correct?

    It looks like when the COMMU module is connected (stacked) it blocks / uses the default UART pins which then prevent the download.

    Have you verified the COMMU jumpers J6, J7, J9 and J10 are set correctly to use UART2? (The default UART is required for the firmware download.)

    Please note that compared to M5Stack (Gray, Fire, etc.) in M5Core2 UART2 pins have changed from GPIO16/GPIO17 to GPIO13/GPIO14 so you might need to adapt your code accordingly.


  • Hello @felmue

    @felmue said in Core 2 and COMMU:

    just to be clear. You are able to flash your M5Core2 as long as the COMMU module is not connected (stacked) to it, correct?

    Yes that's right.

    About COMMU jumpers it's not very easy to find information about it. Not easy also to find them on the board whithout a good magnifying glass. I found a picture on the net more easy to read.
    And when I bought the COMMU, I didn't think I had to understand the schematic. I thought it was more plug & play as the presentation suggests.
    Anyway thank you very much for your help. I will persevere.

  • Hello @Benjo51

    from my experience in general M5Stack devices and modules are simply stackable without any issues but over time some GPIOs needed to be rearranged in later products to accommodate for newer functions etc. which can cause issues like you most likely are encountering right now.

    Most modules have been created for M5Stack devices (Gray, Fire etc.) and while they still can be used with the newer M5Core2 device some of them might require some modifications (hardware or software).

    I agree, it can be a bit frustrating at times but on the bright side you will probably learn some new skills, like reading and understanding schematics.

    I am positive you'll figure it out.


  • @felmue said in Core 2 and COMMU:

    I agree, it can be a bit frustrating at times but on the bright side you will probably learn some new skills, like reading and understanding schematics.
    I am positive you'll figure it out.

    Of course, I have been playing with Arduino and ESP8266 / 32 for 3 years and several years ago with the PIC16 ... and all my pleasure is to learn and to discover.
    I have already read many schematics and created myself some PCBs for my project.
    Thank you Felix

  • @felmue - UART2 has moved, really? the "current" espressif module data sheet in the download section of the current M5 Stack (Core 2) products still indicate GPIO 16 & 17. I feel a rabbit hole in the making....

    In general, I would like at least 2 UART Rx channels. The M5 Stack comes with 3x UARTS according to the spec sheet.

    From another internet source on the subject of UART and ESP32, I found the following:

    • U0UXD is used to communicate with the ESP32 for programming and during reset/boot.
    • U1UXD is unused and can be used for your projects. Some boards use this port for SPI Flash access though
    • U2UXD is unused and can be used for your projects.

    So, I thought, easy-peasy....I can count on being able to use UART1 and 2 - the M5 Stack (Core2) should be able to manage this, correct?
    (I don't plan attaching any GPS-Module, etc, so....2x UARTs should be the minimum available)

    But your having mentioned that the pin layout is different makes we question how reliable the M5 documentation really is (?).

    Appreciate any feedback...also bookmarked your pinning page, thanks.

  • Hello @Camier

    the GPIO information regarding M5Core2 UART2 is correct here - check section M5Core2 M-BUS Schematic diagram and Section M5Core2 BUS(compared to M5Stack). M5Stack even has linked my comparison sheet. Yay!

    Where exactly did you find the incorrect information? Never mind - found it. The GPIO list in the Espressif document you mentioned shows each pin and its possible (default) functionality. Luckily though ESP32 has a GPIO Matrix which allows to reassign almost any pin to any function. Unfortunately GPIO16 / GPIO17 are required for PSRAM and therefore M5Stack was forced to assign two other GPIOs for UART2.

    BTW: GPIO7, GPIO8, GPIO9, GPIO10, GPIO16, GPIO17 are used for PSRAM.


  • @felmue appreciate the quick response and link - will have to wrap my head around the specific info to the Core2 configuration. I'll try my best to decipher it but don't be surprised if I come back with my tail between my legs and a few questions ;-).

  • And how do you fix that you can not burn/flash the Core2 when the COMMU is installed?
    I have the same Problem. Can not flash Core2 when Commu is connected.
    Commu works at my Core, Fire and Core2.
    Flash works when Commu is installed at Core and Fire, but NOT on Core2. There i must remove COMMU to flash!!!

  • I encountered this same problem, the COMMU module works, but I cannot upload a sketch without detatching it first. I don't see the pin conflict with the core-2. Anyone found a solution? I'm not using the uart, only the CAN(SPI) and RS485 (Serial2).

  • I just acquired the Core 2 and COMMU unit.

    I need the CAN bus, but can't seem to get it to work.

    What pins did you find work for this device in order to access the CAN bus?

    Note, I also have the CAN I2C module that I am also trying to use, but can't get it to work either.

  • Hi, about the problem not being able to upload a sketch when the commu is attached to the core2; I found the culprit: it's gpio2-pin (core2) to the M5-bus pin 15, which is the INT-output of the MCP2515-chip. Pin 2 of the ESP is a strapping pin which needs to be low when uploading a sketch, while the MCP-chip pulls it to high-level. A dirty fix is to wire-wrap the pin2 to a button that can ground the pin during sketch-upload.

  • @tls thank you for that! I had the same problem and had a ticket open with the very nice but otherwise clueless M5 support team, who ended up sending me a 2nd COMMU module, which - of course - also didn't work.
    Just to be 100% sure that I understand what you write here:
    When you write "Pin 2 of the ESP is a strapping pin", that would be the "EN" or "RESET" pin, which is Pin 2 on some ESP32 DEV boards and Pin 15 on some others - correct? On the Core2 M-BUS it would be the Pin labeled "RST" or "EN" (3rd from the top in the right row).
    I'm assuming that the old trick with the 22 uF condensator between "EN" and GND wouldn't work here, because the MCP chip immediately pulls it high?

  • @chriszang quick update: I just gave it a try: I soldered a wire to the "EN" pin and grounded it for a moment as soon as the ....... started to show when upload starts.. Never got it to work, getting basically the same error message as before. Bummer.

  • Hello @ChrisZang

    no, not EN, but pin 15 on the M-Bus (which on M5Core2 is pin 2). Please also see the COMMU schematic here. Pin 15 is labelled CAN_INT.


  • @felmue Thanks, gotcha (at least I think I gotacha ;-). So if i scroll down further on your link to "MBUS PinMap" it would be the pin labeled "IISOUT" ?