I was programming wifi scan example with nrf7002dk_nrf5340_cpuapp configuration. The mac address was not setting by default so I did it manually by using the function provided below.
Still not working.
void wifi_set_mac_address(){
struct net_if *iface = net_if_get_default();
char mac_addr_change[]={0xF3,0xF7,0xB9,0x21,0x68,0x24};
struct ethernet_req_params params;
int ret;
memcpy(params.mac_address.addr, mac_addr_change, 6);
net_if_down(iface);
ret = net_mgmt(NET_REQUEST_ETHERNET_SET_MAC_ADDRESS, iface,
¶ms, sizeof(struct ethernet_req_params));
if(ret != 0) {
LOG_ERR("unable to change mac address");
return;
}
ret = memcmp(net_if_get_link_addr(iface)->addr, mac_addr_change,
sizeof(mac_addr_change));
if(ret != 0) {
LOG_ERR("mac address change failed");
return;
}
LOG_DBG("MAC changed to %x:%x:%x:%x:%x:%x\n", \
mac_addr_change[0], mac_addr_change[1], mac_addr_change[2], \
mac_addr_change[3], mac_addr_change[4], mac_addr_change[5]);
net_if_up(iface);
}
Also enabled
CONFIG_NET_NATIVE=y in prj.conf file