Portenta Peer-to-Peer Ethernet Connection (Not Internet Connected)

Hello,

I’ve been playing around with a Portenta Machine Control Board. It has onboard Ethernet connectivity and the Portenta itself has a dedicated Ethernet chip. It is not the same as the Wiznet family line. It requires the use of the mbed OS connectivity library.

My issue is that I’m trying to set up a peer-to-peer TCP connection to a “smart motor” to send packet commands to. I’m not sure how to make heads or tails of the mbed library with the copious amount of source files it uses just for connectivity. I’ve tried using the example by Arduino. This example does work with my board to connect to the internet, so the board is working correctly. However, when I try to adjust the code to fit my needs, I can’t make any headway.

    SocketAddress addr("192.168.XX.X", (uint16_t)PortX);    //"XX.X" & "PortX" are placeholders only for this forum post
    int NSAPI_DHCP_Error = motor.set_dhcp(true);
    if(NSAPI_DHCP_Error == 0){
      Serial.println("DHCP set TRUE");
    }
    else{
      Serial.print("DHCP Error: ");
      Serial.println(NSAPI_DHCP_Error);
    }
    Serial.print("Network Interface Connect Status: ");
    int NSAPI_Error = motor.connect();
    if(NSAPI_Error == 0){
      Serial.println("Motor Connected");
    }
    else if(NSAPI_Error == -3004){
       Serial.println("--> NSAPI_ERROR_NO_CONNECTION");
       Serial.println("Halting Program!");
       while(1);
    }
    else{
      Serial.print("Error: ");
      Serial.println(NSAPI_Error);
      Serial.println("Halting Program!");
      while(1);
    }
    Serial.print("\t\tIP address: ");
    Serial.println(addr.get_ip_address() ? addr.get_ip_address() : "None");

    TCPSocket socket;
    socket.open(&motor);

    motor.gethostbyname("192.168.33.1",&addr);
    addr.set_port(503);   //Lexium Motor Default Port
    socket.connect(addr);

I get negative values from the socket methods, indicating failures.

Has anyone set up anything similar and got it working?

Is there any general notes about how this library works that I might be over looking?

Opened a forum post in the Arduino community and I did get a working solution. For anyone needing this in the future: https://forum.arduino.cc/t/machine-cont … t/980755/1