[SOLVED] Portenta Machine Control (PMC) WiFi Access Point using Arduino PLC IDE

Managed to solve the issue. Had to update the WiFi firmware as instructed here. I am attaching the example code bellow for anybody who is interested. The code also passes variables between the sketch layer and the LD program.

#include <WiFi.h>

char ssid[] = "PMC";    // your network SSID (name)
char pass[] = "123456789";    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;             // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;

WiFiServer server(80);

bool a = false;
int ct=0;

void setup() {
Serial.begin(9600);
delay(1500);
while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
Serial.println("Access Point Web Server");
Serial.print("Creating access point named: ");
Serial.println(ssid);

  //Create the Access point
  status = WiFi.beginAP(ssid,pass);
  if(status != WL_AP_LISTENING){
    Serial.println("Creating access point failed");
    // don't continue
    while (true);
  }

  // wait 10 seconds for connection:
  delay(10000);

  // start the web server on port 80
  server.begin();

  // you're connected now, so print out the status
  printWiFiStatus();
}

void loop() {
    ct++;
    Serial.println(ct);
    a=true;
    PLCIn.a_sh=a;
    delay(1000);
    a=false;
    PLCIn.a_sh=a;
    delay(2000);
    if (status != WiFi.status()) {
    // it has changed update the variable
    status = WiFi.status();

    if (status == WL_AP_CONNECTED) {
      // a device has connected to the AP
      Serial.println("Device connected to AP");
    } else {
      // a device has disconnected from the AP, and we are back in listening mode
      Serial.println("Device disconnected from AP");
    }
  }
}

void printWiFiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your Wi-Fi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print where to go in a browser:
  Serial.print("To see this page in action, open a browser to http://");
  Serial.println(ip);
}

After uploading you have to open the serial com in order for the setup to complete. The board also connects to the PLC IDE without trouble. Apparently it got stuck when opening the serial com and that is why the IDE would freeze.