ESP8266 下载模式 GPIO 研究
首先 找到ESP8266 的芯片手册
https://www.espressif.com/zh-hans/products/hardware/esp8266ex/overview
ESP8266EX技术规格表
https://www.espressif.com/sites/default/files/documentation/0a-esp8266ex_datasheet_cn.pdf
nodemcu/nodemcu-devkit-v1.0 管脚布局图
https://github.com/nodemcu/nodemcu-devkit-v1.0
管脚布局
管脚号 | 名称 | 类型 | 管脚 | 功能 |
---|---|---|---|---|
1 | VDDA | P | Analog Power 2.5V ~ 3.6V | |
2 | LNA | I/O | RF antenna interface Chip output impedance=39+j6 Ω. It is suggested to retain theπ-type matching network to match the antenna. | |
3 | VDD3P3 | P | Amplifier Power 2.5V ~ 3.6V | |
4 | VDD3P3 | P | Amplifier Power 2.5V ~ 3.6V | |
5 | VDD_RTC | P | NC (1.1V) | |
6 | TOUT | I | ADC pin. It can be used to test the power-supply voltage ofVDD3P3 (Pin3 and Pin4) and the input power voltage of TOUT(Pin 6). However, these two functions cannot be used simultaneously. | |
7 | CHIP_PU | I | Chip Enable High: On, chip works properly Low: Off, small current consumed | |
8 | XPD_DCDC | I/O | GPIO16 | Deep-sleep wakeup (need to be connected to EXT_RSTB);GPIO16 |
9 | MTMS | I/O | GPIO14 | HSPI_CLK |
10 | MTDI | I/O | GPIO12 | HSPI_MISO |
11 | VDDPST | P | Digital/IO Power Supply (1.8V ~ 3.6V) | |
12 | MTCK | I/O | GPIO13 | HSPI_MOSI; UART0_CTS |
13 | MTDO | I/O | GPIO15 | HSPI_CS; UART0_RTS |
14 | GPIO2 | I/O | GPIO2 | UART Tx during flash programming; |
15 | GPIO0 | I/O | GPIO0 | SPI_CS2 |
16 | GPIO4 | I/O | GPIO4 | |
17 | VDDPST | P | Digital/IO Power Supply (1.8V ~ 3.6V) | |
18 | SDIO_DATA_2 | I/O | GPIO9 | Connect to SD_D2 (Series R: 200Ω); SPIHD; HSPIHD; GPIO9 |
19 | SDIO_DATA_3 | I/O | GPIO10 | Connect to SD_D3 (Series R: 200Ω); SPIWP; HSPIWP; GPIO10 |
20 | SDIO_CMD | I/O | GPIO11 | Connect to SD_CMD (Series R: 200Ω); SPI_CS0; GPIO11 |
21 | SDIO_CLK | I/O | GPIO6 | Connect to SD_CLK (Series R: 200Ω); SPI_CLK; GPIO6 |
22 | SDIO_DATA_0 | I/O | GPIO7 | Connect to SD_D0 (Series R: 200Ω); SPI_MISO; GPIO7 |
23 | SDIO_DATA_1 | I/O | GPIO8 | Connect to SD_D1 (Series R: 200Ω); SPI_MOSI; GPIO8 |
24 | GPIO5 | I/O | GPIO5 | |
25 | U0RXD | I/O | GPIO3 | UART Rx during flash programming; GPIO3 |
26 | U0TXD | I/O | GPIO1 | UART Tx during flash programming; GPIO1; SPI_CS1 |
27 | XTAL_OUT | I/O | Connect to crystal oscillator output, can be used to provide BT clock input | |
28 | XTAL_IN | I/O | Connect to crystal oscillator input | |
29 | VDDD | P | Analog Power 2.5V ~ 3.6V | |
30 | VDDA | P | Analog Power 2.5V ~ 3.6V | |
31 | RES12K | I | Serial connection with a 12 kΩ resistor and connect to the ground | |
32 | EXT_RSTB | I | External reset signal (Low voltage level: active) |
启动模式
GPIO2, GPIO0, and GPIO15 are configurable on PCB as the 3-bit strapping register that determines the
booting mode and the SDIO timing mode.
Flash Boot 的意思 应该是 从Flash启动
串口
串口号 | 管脚名称 | 管脚号 | IO类型 | 功能 |
---|---|---|---|---|
UART0 | U0RXD | 25 | IO3 | U0RXD |
UART0 | U0TXD | 26 | IO1 | U0TXD |
UART0 | MTDO | 13 | IO15 | U0RTS |
UART0 | MTCK | 12 | IO13 | U0CTS |
UART1 | GPIO2 | 14 | IO2 | U1TXD |
UART1 | SD_D1 | 23 | IO8 | U1RXD |
UART0 can be used for communication. It supports fluid control. Since UART1 features
only data transmit signal (Tx), it is usually used for printing log
By default, UART0 outputs some printed information when the device is powered on and booting up. The
baud rate of the printed information is relevant to the frequency of the external crystal oscillator. If the
frequency of the crystal oscillator is 40 MHz, then the baud rate for printing is 115200; if the frequency of
the crystal oscillator is 26 MHz, then the baud rate for printing is 74880. If the printed information exerts
any influence on the functionality of the device, it is suggested to block the printing during the power-on
period by changing (U0TXD, U0RXD) to (MTDO, MTCK).
外接SPI Flash
In the QUAD mode flash, 6 IO interfaces are used for flash communication.
In the DUAL mode flash, 4 IO interfaces are used for flash communication.
GPIO
NanoMCU 原理图:
https://www.electrodragon.com/w/images/3/3b/NODEMCU_DEVKIT_V1.0.PDF
MATTERS NEEDING ATTENTION
On every boot/reset/wakeup,
GPIO15 MUST keep LOW, GPIO2 MUST keep HIGH.
GPIO0 HIGH ->RUN MODE, LOW -> FLASH MODE.
When you need to use the sleep mode,GPIO16 and RST should be connected,
and GPIO16 will output LOW to reset the system at the time of wakeup.
nRST 默认为高电平
GPIO0 默认为高电平
原来 DTR 和 RTS 的电平是可以在API控制的
看论坛上好多朋友都很疑惑DTR和RTS线控制电平的问题,我发表个人的见解:
mcuisp下载软件所设置的DTR和RTS是针对RS232C接口的,而战舰开发板上的DTR#和RTS#是CH340芯片输出的。由于232芯片和CH340逻辑反向,因此CH340芯片上的DTR#和RTS#线应该和下载软件上的设置取反。
然后我们看看下载过程:DTR#高电平—-RTS#低电平(BOOT0为1,同时RESET)—-DTR#低电平(释放RESET)—-开始下载—-下载完成后两条线恢复高电平,再次复位同时BOOT0=0,即可正常启动。
http://www.openedv.com/posts/list/0/41396.htm
ESP8285解析
https://arduino-esp8266.readthedocs.io/en/latest/boards.html#generic-esp8266-module
芯片手册:
https://www.espressif.com/sites/default/files/0a-esp8285_datasheet_en_v1.0_20160422.pdf
Generic ESP8285 Module
ESP8285 (datasheet) is a multi-chip package which contains ESP8266 and 1MB flash. All points related to bootstrapping resistors and recommended circuits listed above apply to ESP8285 as well.
Note that since ESP8285 has SPI flash memory internally connected in DOUT mode, pins 9 and 10 may be used as GPIO / I2C / PWM pins.
ESP8255 是芯片内部 封装了一个ESP8266 和一个1MB的flash,对应的管脚pin8 之类的已经被占用了。
可以对应 ESP8266 外接一个1MB的SPI FLash的板子 正常使用,对等使用。
推荐阅读