# How to change the wifi MAC address?

**URL:** <https://forum.amebaiot.com/t/how-to-change-the-wifi-mac-address/3719>\
**Category:** AT Cmd\
**Tags:** evb-bw16, rtl872xd\
**Created:** [January 16, 2025, 11:55am UTC](https://forum.amebaiot.com/t/how-to-change-the-wifi-mac-address/3719 "2025-01-16T11:55:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Joe](https://forum.amebaiot.com/u/Joe)\
**Post date:** [January 16, 2025, 11:55am UTC](https://forum.amebaiot.com/t/how-to-change-the-wifi-mac-address/3719/1 "2025-01-16T11:55:28Z")

</div>

AT commands like ATW? / ATPM don’t work on my (brand-new, unflashed, unerased) BW16 board (connected to UART PB1 / PB2):

```auto
AT
argc=0
OK
[MEM] After do cmd, available heap 176544

ATS?
Unknown cmd:ATS?
[MEM] After do cmd, available heap 176544

ATW?
Unknown cmd:ATW?
[MEM] After do cmd, available heap 176544

ATPM=112233445566
Unknown cmd:ATPM=112233445566
[MEM] After do cmd, available heap 176544

```

Ameba\_ATCMD\_ESP is also no option as it does not support the ATPM command.  
So what to do?

---

<div class="post-metadata">

**Author:** ![Pammy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/pammy/32/936_2.png) [@Pammy](https://forum.amebaiot.com/u/Pammy)\
**Post date:** [January 17, 2025, 1:37am UTC](https://forum.amebaiot.com/t/how-to-change-the-wifi-mac-address/3719/2 "2025-01-17T01:37:40Z")

</div>

Hi @Joe ,

You may search online for **AN0025 Realtek at command** and try the WiFi AT command in it to see if it works for you.

May I know if you are using FreeRTOS SDK or Arduino SDK? Thank you

---

<div class="post-metadata">

**Author:** ![Joe](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Joe](https://forum.amebaiot.com/u/Joe)\
**Post date:** [January 17, 2025, 2:44am UTC](https://forum.amebaiot.com/t/how-to-change-the-wifi-mac-address/3719/3 "2025-01-17T02:44:19Z")

</div>

> [@Pammy](#):
>
> Hi @Joe ,
> 
> You may search online for **AN0025 Realtek at command** and try the WiFi AT command in it to see if it works for you.
> 
> May I know if you are using FreeRTOS SDK or Arduino SDK? Thank you

This is funny, according to AN0025 the command to change the MAC address is “ATWZ=write\_mac[00e04c870102]”. According to AN0075 the command is “ATPM”. However - both commands do not work on my BW16:

```auto
ATPM=112233445566
Unknown cmd:ATPM=112233445566
[MEM] After do cmd, available heap 176544

ATWZ=write_mac[00e04c870102]
Unknown cmd:ATWZ=write_mac[00e04c870102]
[MEM] After do cmd, available heap 176544

ATWZ=read_mac
Unknown cmd:ATWZ=read_mac
[MEM] After do cmd, available heap 176544

```

My BW16 has  
AT version: release/V4.18\_P2.40.1  
SDK version:amebad\_v6.2C  
Firmware version: release/V4.18\_P6.3.1(Nov 17 2023-11:54:16)  
Arch: RTL8720DX,NULL  
Company: Ai-Thinker|B&T

I don’t understand your question concerning FreeRTOS or Arduino SDK. AT commands are simply sent to the board over serial connection to UART, you don’t need any SDK for this.

---

<div class="post-metadata">

**Author:** ![M-ichae-l](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/m-ichae-l/32/33_2.png) [@M-ichae-l](https://forum.amebaiot.com/u/M-ichae-l)\
**Post date:** [January 20, 2025, 5:54am UTC](https://forum.amebaiot.com/t/how-to-change-the-wifi-mac-address/3719/4 "2025-01-20T05:54:14Z")

</div>

Please refer to this [SDK repo](https://github.com/Ameba-AIoT/ameba-rtos-d) for more info. You may rise a issue there.

Arduino do not have AT command build-in.

---

<div class="post-metadata">

**Author:** ![Joe](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Joe](https://forum.amebaiot.com/u/Joe)\
**Post date:** [January 23, 2025, 6:50am UTC](https://forum.amebaiot.com/t/how-to-change-the-wifi-mac-address/3719/5 "2025-01-23T06:50:07Z")

</div>

> [@M-ichae-l](#):
>
> Please refer to this [SDK repo](https://github.com/Ameba-AIoT/ameba-rtos-d) for more info. You may rise a issue there.

Thanks for your answer, I read the documentation on your website. Now I know how to setup up the development environment, but not how to change the wifi MAC.

---

<div class="post-metadata">

**Author:** ![Joe](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Joe](https://forum.amebaiot.com/u/Joe)\
**Post date:** [January 23, 2025, 6:57am UTC](https://forum.amebaiot.com/t/how-to-change-the-wifi-mac-address/3719/6 "2025-01-23T06:57:07Z")

</div>

I experimented more with AT commands and found out that AT+HELP shows a list of all implemented commands:

```auto
AT+HELP:Show cmd list
AT+RST:Soft restart
AT+RESTORE:Restore setting
ATE1:Enable echo
ATE0:Disable echo
AT+SYSMSG:Query and set system message
AT+GMR:Show version info
AT+SLEEP:Set low power mode
AT+UARTCFG:Query and set AT UART config
AT+OTA:Firmware OTA
AT+SYSIOMAP:Query and set IO map
AT+SYSGPIOWRITE:Set GPIO out level
AT+SYSGPIOREAD:Get GPIO level
AT+PWMCFG:Set PWM config
AT+PWMCFGS:Set PWM config
AT+PWMSTOP:Stop PWM function
AT+PWMDUTYSET:Update PWM duty
AT+PWMDUTYSETS:Update PWM duty
AT+WMODE:Query an set WIFI mode
AT+WDISCONNECT:Disconnect wifi connect
AT+WSCAN:Scan WIFI list
AT+WSCANACTIVE:Scan WIFI active
AT+WSCANOPT:Scan WIFI list option
AT+WSDHCP:Query and set STA DHCP
AT+WJAP:Join AP
AT+STAINFO:Query Sta info
AT+WJEAP:Join EAP
AT+WAUTOCONN:Set WIFI auto connect
AT+WAPDHCP:Query and set AP DHCP
AT+WAP:Query and set AP config
AT+PING:Ping test
AT+CIPSTAMAC_DEF:Query and set WIFI station MAC
AT+WCOUNTRY:Query and set country code
AT+WCONFIG:Query and set wifi config
AT+WRSSI:Query RSSI
AT+SOCKET:Create socket
AT+SOCKETSEND:Socket send data
AT+SOCKETSENDLINE:Socket send data in one line
AT+SOCKETREAD:Socket read data
AT+SOCKETDEL:Delete socket
AT+SOCKETRECVCFG:Set socket recive mode
AT+SOCKETTT:Start socket transparent transmission
AT+SOCKETAUTOTT:Set socket auto transparent transmission
AT+SSLCRET:Query and set SSL Cret
AT+WDOMAIN:Input host name to get IP
AT+WDNS:Query and set DNS Server 
AT+MQTT:Config and connect MQTT
AT+MQTTVER:Query and set MQTT version
AT+MQTTPUB:Publish MQTT message
AT+MQTTPUBRAW:Publish long MQTT message
AT+MQTTSUB:Subscribe MQTT Topic
AT+MQTTUNSUB:Unsubscribe MQTT Topic
AT+HTTTPCLIENTLINE:Initiate an http or https request
AT+HTTPCLIENTLINE:Initiate an http or https request
AT+HTTPRAW:Initiate an http or https request
AT+SNTPTIME:Query SNTP time
AT+SNTPTIMECFG:Query and set SNTP config
AT+SNTPINTV:Query and set SNTP refresh interval
AT+BLEMAC:Query and set BLE MAC
AT+BLEMODE:Query and set BLE mode
AT+BLERFPWR:Query and set BLE RF power
AT+BLESTATE:Query BLE connect status
AT+BLEDISCON:Dissconnect BLE
AT+BLEMTU:Query and set BLE MTU
AT+BLESEND:Send by BLE transparent transmission
AT+BLESENDRAW:Send by BLE transparent transmission
AT+BLESERUUID:Query and set BLE TT server UUID
AT+BLETXUUID:Query and set BLE Tx UUID
AT+BLERXUUID:Query and set BLE Rx UUID
AT+TRANSENTER:Start BLE transparent transmission
AT+BLENAME:Query and set BLE name
AT+BLECONINTV:Query and set BLE connect interval
AT+BLEAUTH:Query and set BLE PIN code
AT+BLEADVINTV:Query and set BLE broadcast time
AT+BLEADVDATA:Query and set BLE broadcast data
AT+BLEADVEN:Query and set BLE broadcast status
AT+BLESCAN:Start BLE scan
AT+BLECONNECT:Start BLE connect
AT+BLEAUTOCON:Start BLE atuo connect
AT+BLEDISAUTOCON:Turn off BLE atuo connect
AT+BLEIBCNUUID:Query and set BLE iBeacon UUID
AT+BLEIBCNDATA:Set BLE iBeacon data
AT+NodeMCUTEST:Set development board test function
AT+GPIOTEST:Start GPIO test
AT+LEDTEST:Start test board LED test

```

The command `AT+CIPSTAMAC_DEF` shows the current wifi MAC:

```auto
[rltk_wlan_statistic] tx stat: tx_packets=0, tx_dropped=0, tx_bytes=0
[rltk_wlan_statistic] rx stat: rx_packets=0, rx_dropped=0, rx_bytes=0, x_overflow=0
[rltk_wlan_statistic] rx stat: rx_reorder_drop_cnt=0, rx_reorder_timeout_cnt=0
[rltk_wlan_statistic] min_free_heap_size=144928, current heap free size=176544
[rltk_wlan_statistic] max_skbbuf_used_num=0, skbbuf_used_num=0
[rltk_wlan_statistic] max_skbdata_used_num=0, skbdata_used_num=0
[rltk_wlan_statistic] max_timer_used_num=31
+CIPSTAMAC_DEF:00e04c870000
OK
[MEM] After do cmd, available heap 176544

```

Unfortunately changing the MAC does not work:  
`AT+CIPSTAMAC_DEF=00e04c870002`

```auto
[AI_FAtCipStaMacDef()-1618]set mac:00e04c870002
[AI_FAtCipStaMacDef()-1630]AI_HalWifiSetMac not fit
+CIPSTAMAC_DEF:2
ERROR
[MEM] After do cmd, available heap 176544

```

Anyone an idea what the message “AI\_HalWifiSetMac not fit” does mean?
