🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to adapt Core code to Core2?

    Arduino
    2
    4
    5.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      Thomasx
      last edited by

      Hi

      I have some code that compiles and runs fine for Core
      So I replaced M5Stack.h with M5core.h and compiled it for the Core2 and downloaded.
      But it just keeps rebooting.

      Here's what I get in the serial window. Any suggestions on what is wrong and needs to be adapted to make Core-code work in a Core2?

      Rebooting...
      M5Core2 initializing...axp: vbus limit off
      axp: gpio1 init
      axp: gpio2 init
      axp: rtc battery charging enabled
      axp: esp32 power voltage was set to 3.35v
      axp: lcd backlight voltage was set to 2.80v
      axp: lcd logic and sdcard voltage preset to 3.3v
      axp: vibrator voltage preset to 2v
      E (1455) ledc: ledc_channel_config(369): gpio_num argument is invalid
      touch: FT6336 ready (fw id 0x10 rel 1, lib 0x300E)
      OK
      E (3029) rmt: rmt_set_gpio(526): RMT GPIO ERROR
      E (3029) rmt: rmt_config(686): set gpio for RMT driver failed
      [i] SDK:          'v4.4-beta1-189-ga79dc75f0a'
      [i] CPU Speed:    240 MHz
      [i] Chip Id:      43F23A08
      [i] Flash Mode:   00000002
      [i] Flash Size:   01000000
      [i] Flash Speed:  80 MHz
      [i] Heap          261868/288324
      [i] SPIRam        4192139/4192139
      
      [i] Starting
      [WiFi] Connecting...
      OTA Ready
      [i] read status from SPIFFS
      [i]   Setup MQTT
      [REL] setting 0 to OFF
      [REL] setting 1 to OFF
      [REL] setting 0 to ON
      [REL] setting 1 to ON
      [REL] setting 0 to OFF in 2000 ms
      [REL] setting 1 to OFF in 5000 ms
      Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
      
      Core  1 register dump:
      PC      : 0x400df248  PS      : 0x00060733  A0      : 0x800dfae4  A1      : 0x3ffb2710  
      A2      : 0xffffffff  A3      : 0x00000003  A4      : 0x00060720  A5      : 0x00000000  
      A6      : 0x007b764c  A7      : 0x003fffff  A8      : 0x3f410ab4  A9      : 0x00000058  
      A10     : 0xffffffab  A11     : 0x00000084  A12     : 0x3ffc9ebc  A13     : 0x00060723  
      A14     : 0x00060720  A15     : 0x00000001  SAR     : 0x0000000a  EXCCAUSE: 0x0000001c  
      EXCVADDR: 0x00000058  LBEG    : 0x40086565  LEND    : 0x4008656d  LCOUNT  : 0x00000027  
      
      
      Backtrace:0x400df245:0x3ffb27100x400dfae1:0x3ffb2740 0x400dff3f:0x3ffb2770 0x400d4031:0x3ffb27b0 0x400d4170:0x3ffb27e0 0x400d5bc3:0x3ffb2800 0x400ea60d:0x3ffb2820 
      
      
      
      
      ELF file SHA256: 0000000000000000
      
      Rebooting...
      
      1 Reply Last reply Reply Quote 0
      • felmueF
        felmue
        last edited by

        Hello @Thomasx

        my best guess (w/o knowing the actual code you wish to compile) is that some GPIOs need to be adapted from M5Stack to M5Core2. This table might help you.

        The Error lines in your log file might give you some hints as well:

        E (1455) ledc: ledc_channel_config(369): gpio_num argument is invalid
        E (3029) rmt: rmt_set_gpio(526): RMT GPIO ERROR
        E (3029) rmt: rmt_config(686): set gpio for RMT driver failed
        

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        T 1 Reply Last reply Reply Quote 0
        • T
          Thomasx @felmue
          last edited by

          @felmue

          Yes, but since none of these function calls reside in my code, but (I assume) in libraries, I would have expected this to be handled by using M5Core2.h and choosing the correct target in the IDE.

          I can't see what else to change, other than replacing some libraries, but what to replace, and with what, in that case.

          1 Reply Last reply Reply Quote 0
          • felmueF
            felmue
            last edited by felmue

            Hello @Thomasx

            sorry to disappoint you, but sadly not every library has been written in a way that it can automatically adapt to a new product. Or sometimes the init() or begin() functions need to be provided with different parameters to account for a specific product which doesn't use default values. And I am afraid in some cases you have to directly modify the library yourself to make it work with a specific product.

            Thanks
            Felix

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            1 Reply Last reply Reply Quote 0
            • First post
              Last post