How to change the wifi MAC address?

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

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?

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:

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.

Please refer to this SDK repo for more info. You may rise a issue there.

Arduino do not have AT command build-in.

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.

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

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:

[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

[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?