ESP32获取chipID

xsp1989
Posts: 5
Joined: Tue Mar 17, 2020 8:13 am

ESP32获取chipID

Postby xsp1989 » Sat Apr 18, 2020 6:31 am

现在项目里面需要获得芯片的一个唯一ID发送到服务器进行设备绑定。
有如下问题不太了解,
1.在ESP8266里面有个API(system_get_chip_id())能够获得一个唯一ID号,请问在ESP32中是否也有类似的API呢?
2.如果没有相关API的话通过esp_efuse_mac_get_default()这个函数获取到的一个MAC地址是唯一所有芯片的MAC吗?如果不是,需要使用什么api来获得一个唯一ID呢?

3.在ESP-IDF4.0里面: esp_err_t esp_efuse_mac_get_custom(uint8_t *mac);
esp_err_t esp_efuse_mac_get_default(uint8_t *mac);
esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type);
这三个函数获取到的MAC地址有什么区别呢?

ESP_igrr
Posts: 1675
Joined: Tue Dec 01, 2015 8:37 am

Re: ESP32获取chipID

Postby ESP_igrr » Sat Apr 18, 2020 7:05 am

You can use esp_efuse_mac_get_default to get the factory-programmed MAC, which is unique.

esp_efuse_mac_get_custom returns the custom MAC address, if it was programmed in BLK3 eFuse. More details here: https://docs.espressif.com/projects/esp ... s-in-efuse

esp_read_mac is used to generate MAC addresses for each network interface. By default it uses the base MAC address returned by esp_efuse_mac_get_default. However this base MAC address can be overridden if necessary. See https://docs.espressif.com/projects/esp ... ac-address for details.

Who is online

Users browsing this forum: ESP_Alvin, ESP_morris, esp_superuser, lqzero and 3 guests