Hi,
I'm trying to set the Mac, this is my code:
void user_init(void)
{
struct softap_config acfg;
struct station_config scfg;
char ssid[10] = { 0 };
char buf[64] = { 0 };
char mac[6] = { 0 };
char sofap_mac[6] = { 0x1a, 0xfe, 0x36, 0x97, 0xd5, 0x7b };
char sta_mac[6] = { 0x1a, 0xfe, 0x36, 0x97, 0xd5, 0x7b };
wifi_softap_dhcps_stop();
wifi_station_dhcpc_stop();
wifi_station_set_auto_connect(false);
wifi_set_opmode(3);
wifi_set_macaddr(STATION_IF, sta_mac);
wifi_set_macaddr(SOFTAP_IF, sofap_mac);
sclr((uint8 *)&acfg, 0, sizeof(acfg));
sclr((uint8 *)&scfg, 0, sizeof(scfg));
os_strcpy(ssid, "ATcmd_2");
os_memcpy(acfg.ssid, ssid, os_strlen(ssid));
os_memcpy(scfg.ssid, ssid, os_strlen(ssid));
wifi_softap_set_config(&acfg);
wifi_station_set_config(&scfg);
at_init();
at_cmd_array_regist(&at_custom_cmd[0], sizeof(at_custom_cmd) / sizeof(at_custom_cmd[0]));
wifi_get_macaddr(STATION_IF, mac);
os_sprintf(buf,"Compilado: %s %s\r\nSSID: %s\r\nSMAC: "MACSTR"\r\n",
__DATE__,__TIME__,scfg.ssid, MAC2STR(mac));
at_set_custom_info(buf);
at_port_print(buf);
at_port_print("Iniciado..\r\n");
}
void sclr(uint8 *dest, uint8 c, size_t n) {
while (n--)
*dest++ = c;
}
and this the result:
14:11:57 Compilado: Apr 25 2016 13:52:59
SSID: ATcmd_2
SMAC: 12:0d:f0:0c:02:0d
Iniciado..
why MAC did not set to that I want..?
Thank you very much
sdk wifi_set_macaddr
Re: sdk wifi_set_macaddr
Postby ESP_Faye » Wed Apr 27, 2016 2:19 pm
Hi,
1. Do not set ESP8266 station and softAP to be the same MAC address, it will cause unexpected test result.
2. Did you download blank.bin into flash as initialization ? For example, if your flash size is 8Mbit, you need to download blank.bin to both 0x7E000 and 0xFE000 to initialize AT firmware.
Thanks for your interest in ESP8266 !
1. Do not set ESP8266 station and softAP to be the same MAC address, it will cause unexpected test result.
2. Did you download blank.bin into flash as initialization ? For example, if your flash size is 8Mbit, you need to download blank.bin to both 0x7E000 and 0xFE000 to initialize AT firmware.
Thanks for your interest in ESP8266 !
Who is online
Users browsing this forum: No registered users and 14 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.