Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running on esp32 but with Ethernet #49

Closed
alborzs opened this issue Jun 11, 2019 · 0 comments
Closed

Running on esp32 but with Ethernet #49

alborzs opened this issue Jun 11, 2019 · 0 comments

Comments

@alborzs
Copy link

alborzs commented Jun 11, 2019

I have a setup which works fine on esp32 over Wifi using your library, but the esp32 board that I am using has Ethernet port as well and I would like to use Ethernet instead of Wifi to receive DMX data.

This is the board I am refering to, see below: (but there are other boards as well such as wesp32)
https://www.olimex.com/Products/IoT/ESP32/ESP32-POE-ISO/open-source-hardware
I can not seem to be able to receive any Art-net over Ethernet.

Below is one of your examples just slightly modified:

#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
#define ETH_PHY_POWER 12

#include <Artnet.h>
#include <ETH.h>
#include <SPI.h>

static bool eth_connected = false;
byte ip[] = {192, 168, 0, 90};
byte mac[] = {0x30, 0xAE, 0xA4, 0x9F, 0xF7, 0xA7};
Artnet artnet;

void WiFiEvent(WiFiEvent_t event)
{
    switch (event)
    {
    case SYSTEM_EVENT_ETH_START:
        Serial.println("ETH Started");
        // set eth hostname here
        ETH.setHostname("esp32-ethernet");
        break;
    case SYSTEM_EVENT_ETH_CONNECTED:
        Serial.println("ETH Connected");
        break;
    case SYSTEM_EVENT_ETH_GOT_IP:
        Serial.print("ETH MAC: ");
        Serial.print(ETH.macAddress());
        Serial.print(", IPv4: ");
        Serial.print(ETH.localIP());
        if (ETH.fullDuplex())
        {
            Serial.print(", FULL_DUPLEX");
        }
        Serial.print(", ");
        Serial.print(ETH.linkSpeed());
        Serial.println("Mbps");
        eth_connected = true;
        break;
    case SYSTEM_EVENT_ETH_DISCONNECTED:
        Serial.println("ETH Disconnected");
        eth_connected = false;
        break;
    case SYSTEM_EVENT_ETH_STOP:
        Serial.println("ETH Stopped");
        eth_connected = false;
        break;
    default:
        break;
    }
}

void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data, IPAddress remoteIP)
{
  // print out our data
  Serial.print("universe number = ");
  Serial.print(universe);
  Serial.print("\tdata length = ");
  Serial.print(length);
  Serial.print("\tsequence n0. = ");
  Serial.println(sequence);
  Serial.print("DMX data: ");
  for (int i = 0 ; i < length ; i++)
  {
    Serial.print(data[i]);
    Serial.print("  ");
  }
  Serial.println();
  Serial.println();
}

void setup()
{
    Serial.begin(115200);
    WiFi.onEvent(WiFiEvent);

    ETH.begin();

    while (!eth_connected)
    {
        delay(10);
    }

    artnet.begin();
    artnet.setArtDmxCallback(onDmxFrame);
}


void loop()
{
    artnet.read();
}

I can see that the boards start up and aqcuires an IP, but nothing else happen.

ETH Started
ETH Connected
ETH MAC: 30:AE:A4:9F:F7:A7, IPv4: 192.168.1.100, FULL_DUPLEX, 100Mbps

Do you have any similar setup that you could test the code using Ethernet?

@alborzs alborzs closed this as completed Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant