如何计算芯片的ESP mac 地址

如何判断芯片是 ESP32 or ESP8266 ?

ESP32

detect_chip 0x60000078

UART_DATE_REG_ADDR = 0x60000078  # used to differentiate ESP8266 vs ESP32*
UART_DATE_REG2_ADDR = 0x3f400074  # used to differentiate ESP32S2 vs other models

uart_register.h` 中定义如下所示:(这里为何读取0x60000078, REG_UART_BASE( i )的确定在哪里)

#define DR_REG_UART_BASE                        0x3ff40000
#define REG_UART_BASE( i )  (DR_REG_UART_BASE + (i) * 0x10000 + ( (i) > 1 ? 0xe000 : 0 ) )
#define REG_UART_AHB_BASE(i)  (0x60000000 + (i) * 0x10000 + ( (i) > 1 ? 0xe000 : 0 ) )
#define UART_FIFO_AHB_REG(i)  (REG_UART_AHB_BASE(i) + 0x0)
#define UART_FIFO_REG(i)          (REG_UART_BASE(i) + 0x0)

#define UART_DATE_REG(i)          (REG_UART_BASE(i) + 0x78)
/* UART_DATE : R/W ;bitpos:[31:0] ;default: 32'h15122500 ; */

(1) 从esp32 的技术手册未查找到的 0x60000078 的内容

(2) 该寄存器在 esptool.py 的注释

​ “”" Use serial access to detect the chip type.

​ We use the UART’s datecode register for this, it’s mapped at

​ the same address on ESP8266 & ESP32 so we can use one

​ memory read and compare to the datecode register for each chip

​ type.

​ This routine automatically performs ESPLoader.connect() (passing

​ connect_mode parameter) as part of querying the chip.

​ “”"

而在 esp32.peripherals.ld 中,UART 的外设地址如下:

PROVIDE ( UART0 = 0x3ff40000 );
PROVIDE ( UART1 = 0x3ff50000 );
PROVIDE ( UART2 = 0x3ff6E000 );

则,读该寄存器,内容为 0x15122500,那么识别此芯片为 ESP32.

ESP8266

detect_chip 0x60000078

UART_DATE_REG_ADDR = 0x60000078  # used to differentiate ESP8266 vs ESP32*

uart_register.h 中定义如下所示:

#define REG_UART_BASE(i)                (0x60000000 + (i)*0xf00)
//version value:32'h062000
...
#define UART_DATE(i)                    (REG_UART_BASE(i) + 0x78)

esp8266 的技术手册中描述如下:

在这里插入图片描述

则,读该寄存器,内容为 0x60000200,那么识别此芯片为 ESP8266.

如何判断芯片是 ESP8285 or ESP8286 ?

ESP8266 技术手册中只有 GPIO, SPI, UART 寄存器的介绍, 然而并没有将介绍 efuse 寄存器,只能从代码中获取此部分信息。

esp8266/efuse_register.h 的定义如下图所示:

#define DR_REG_EFUSE_BASE   0x3FF00050
#define EFUSE_DATA0_REG     (DR_REG_EFUSE_BASE +
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值