Core2 with PoE Base



  • Hi All,

    I have just purchased myself a Core2 and a PoE Base. New to M5Stack but 5 years experience on ESP32's.

    I am battling to get the Core2 to "see" the W5500 on the PoE Base with no luck, I have tried the M5-Ethernet WebClient.ino and I keep seeing "Failed to configure Ethernet using DHCP, Ethernet shield was not found. Sorry can't run without hardware. :(

    What am I missing something? I am using the stock M5 Arduino library's, do I need to adjust some #define's?

    Thanking you in advance, any assistance will much appreciated.

    Regards
    Paul



  • Hello @PaulB

    I can get it to work when I include M5Core2.h at the top, set the correct CS pin and initialize the M5Core2 LCD, Serial etc. at the top of setup(), e.g.

    #include <M5Core2.h>
    ...
    void setup() {
      Ethernet.init(GPIO_NUM_26);
      M5.begin();
    
    //  // Open serial communications and wait for port to open:
    //  Serial.begin(115200);
    //  while (!Serial) {
    //    ; // wait for serial port to connect. Needed for native USB port only
    //  }
    

    Thanks
    Felix



  • Thank you so much, it works



  • Next question...

    How do I force my Core2 to be powered only from the PoE Base, I have tried this and it still needs the USB cable plugged for a power source.

    M5.begin(true, true, true, false, kMBusModeInput);



  • Hello @PaulB

    this should work automatically when you power from PoE exclusivly. The code (see here) checks if external power (e.g. on the M5 bus) is available and switches to use that. (But I think that only works if USB wasn't already plugged in.)

    Note: kMBusMode* is no longer used.

    Thanks
    Felix



  • I have also tried just M5.begin(); same result as M5.begin(true, true, true, false, kmBusModeInput); where LCD briefly "flashes" (which appears like its trying initialize), internal Green Led flashes and both LCD and Green Led then go off, only difference is the speaker has a low volume "sequel" that is produced with just M5.begin(); the entire time there after, with the other M5.begin(.....) command the speaker is quiet.

    I can only get functionality from the Core2 if USB is plugged in.

    What should my setup look like?

    Here is my code so far... I don't know how to indicate code in a post, so sorry if this is not the correct way to do this.

    #include <M5Core2.h>
    #include <SPI.h>
    #include <M5_Ethernet.h>

    byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
    char server[] = "www.google.com"; // name address for Google (using DNS)

    IPAddress ip(192, 168, 0, 177);
    IPAddress myDns(192, 168, 0, 1);

    EthernetClient client;

    void setup {
    M5.begin(true, true, true, false, kmBusModeInput);
    Ethernet.init(GPIO_NUM_26);
    M5.Lcd.setTextSize(2);
    M5.Lcd.setTextColor(TFT_WHITE, TFT_BLACK);
    M5.Lcd.println("Ethernet Test!");

    M5.Lcd.println("Initialize Ethernet with DHCP:");
    if (Ethernet.begin(mac) == 0) {
    M5.Lcd.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    M5.Lcd.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
    while (true) {
    delay(1); // do nothing, no point running without Ethernet hardware
    }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
    M5.Lcd.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
    } else {
    M5.Lcd.print(" DHCP assigned IP ");
    }
    // give the Ethernet shield a second to initialize:
    delay(1000);
    M5.Lcd.print("Connecting to ");
    M5.Lcd.print(server);
    M5.Lcd.println("...");

    // if you get a connection, report back via serial:
    if (client.connect(server, 80)) {
    M5.Lcd.print("Connected");
    } else {
    // if you didn't get a connection to the server:
    M5.Lcd.println("Connection failed");
    }

    }

    void loop() {

    }

    Is the sequence of commands critical?

    Is there a command to force the Axp to use MBus seeing that kmBusMode* is no longer used



  • Just a heads up I can get this to work if I use M5Unified.h instead of M5Core2.h