Raspi Pico set ethernet mac address via wifi

I have the raspi pico w hardware and I have a mac address that belongs to the wifi chip. I want to plug w5500 series ethernet into pico and I want the mac address to be more than 1 Wifi mac address how can I do it

Were it possible, the lengthy reference manual would be the source I would consult. But, from Advance Setup guide, I do not see a direct mechanism:
Advanced Setup of W5500 Ethernet Shield for Internet and LAN — XOD

The W5500 chip does not hard-code its MAC as many consumer devices do, so you have to provide it manually.

you use the Ethernet library or the lwIP_Ethernet library?

Hi i will try LwIP_Ethernet Library,

Here is my code

#include <WiFi.h>


void setup() {

  Serial.begin(115200);
  delay(5000);
  WiFi.mode(WIFI_STA);
  WiFi.setHostname("PicoW2");
   // start WiFi to read current mac
  
  Serial.print("Wifi Mac Address : ");
  Serial.println(WiFi.macAddress().c_str());
  byte mac[6] ;
  WiFi.macAddress(mac );
  
  //const size_t arrlen = sizeof(mac);
  //Serial.println(arrlen);
  //mac[0]=0xEA;
  for(int i= 5; i<6; i++)
  {
    int a = ((mac[i]%100)/10)*16;
    int b = ((mac[i]%100)%10);
    mac[i]=a+b;
  }

  
  
  
  Serial.print("ETH MAC address : ");
  for(int i=0; i<5; i++)
  {
    Serial.print(mac[i], HEX);
    Serial.print(":");
  }
  Serial.println(mac[5], HEX);
  	
  //Ethernet.init(WIZ_CS);
  //Ethernet.begin(mac);run once:

}

void loop() {
  // put your main code here, to run repeatedly:

  

}

But it doesn't show the numbers 0 in the screen output

I am not sure if the LwIP_Ethernet is ready to use,
the MAC address for the W5500 is your responsibility. it is not a good idea to use the MAC address of the WiFi adapter. see the examples of the Ethernet library

I update code corret value return

#include <WiFi.h>


void setup() {

  Serial.begin(115200);
  delay(5000);
  WiFi.mode(WIFI_STA);
  WiFi.setHostname("PicoW2");
   // start WiFi to read current mac
  
  Serial.print("Wifi Mac Address : ");
  Serial.println(WiFi.macAddress().c_str());
  byte mac[6] ;
  WiFi.macAddress(mac );
  
  //const size_t arrlen = sizeof(mac);
  //Serial.println(arrlen);
  //mac[0]=0xEA;
  for(int i= 5; i<6; i++)
  {
    int a = ((mac[i]%100)/10)*16;
    int b = ((mac[i]%100)%10);
    
    mac[i]=a+b;
    
  }

  
  
  char s[18];
  Serial.print("ETH MAC address : ");
  sprintf(s, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5],mac[6]);
  Serial.println(s);
   
  	
  //Ethernet.init(WIZ_CS);
  //Ethernet.begin(s);

}

void loop() {
  // put your main code here, to run repeatedly:

  

}

But i wan to change wifi -> Eth last character

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.