ESP8266 Support WIKI

User Tools

Site Tools


esp8266_gpio_pin_allocations

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
esp8266_gpio_pin_allocations [2015/07/06 21:42]
tytower [Pin Functions]
esp8266_gpio_pin_allocations [2016/01/13 20:43]
acropup
Line 1: Line 1:
-===== Basic Wiring functions =====+====== Basic Wiring functions ​======
  
 pinMode(), digitalRead(),​ digitalWrite(),​ analogWrite() work as usual. pinMode(), digitalRead(),​ digitalWrite(),​ analogWrite() work as usual.
Line 10: Line 10:
 from reversed voltages with diodes. from reversed voltages with diodes.
  
-GPIO0-GPIO15 can be INPUT, OUTPUT, INPUT_PULLUP, and INPUT_PULLDOWN.\\  +At startup, pins are configured as INPUT.\\ 
-GPIO16 can be INPUT, OUTPUT or INPUT_PULLDOWN. It is also XPD for deepSleep() (Perhaps via a small capacitor.) +GPIO0-GPIO15 can be INPUT, OUTPUT, ​or INPUT_PULLUP.\\  
 +GPIO16 can be INPUT, OUTPUTor INPUT_PULLDOWN_16. It is also XPD for deepSleep() (Perhaps via a small capacitor.)\\ 
 +Note that GPIO6-GPIO11 are typically used to interface with the flash memory ICs on most esp8266 modules, so these pins should not generally be used.
  
 analogRead(A0) reads the value of the ADC channel connected to the TOUT pin .\\  analogRead(A0) reads the value of the ADC channel connected to the TOUT pin .\\ 
Line 24: Line 25:
  
 ===Interupts=== ===Interupts===
-Pin interrupts are supported through attachInterrupt(),​ detachInterrupt() functions. Interrupts may be attached to any GPIO pinexcept GPIO16. Standard Arduino interrupt types are supported: CHANGE, RISING, FALLING.+Pin interrupts are supported through attachInterrupt(),​ detachInterrupt() functions. Interrupts may be attached to any GPIO pin except GPIO16, but since GPIO6-GPIO11 are typically used to interface with the flash memory ICs on most esp8266 modules, applying interrupts to these pins are likely to cause problems. Standard Arduino interrupt types are supported: CHANGE, RISING, FALLING.
    
 ==== PWM ==== ==== PWM ====
Line 48: Line 49:
  
 You can activate any "​FUNCTION_"​ with pinMode(pin,​ FUNCTION_1)for example\\ ​ You can activate any "​FUNCTION_"​ with pinMode(pin,​ FUNCTION_1)for example\\ ​
 +Note : func number 1-5 in Expressife table correspond to FUNCTION 0-4 in SDK\\
 +http://​bbs.espressif.com/​download/​file.php?​id=442
  
 {{:​pin_functions.png|}} {{:​pin_functions.png|}}
Line 59: Line 62:
 ^FLASH (NormalRunning) | 0                 | 1              | x or 1  |   ​\\ ​ ^FLASH (NormalRunning) | 0                 | 1              | x or 1  |   ​\\ ​
  
-__Note__ :-  GPIO2 It is considered safer to pull it high with a resitor ​on boot rather than leave it floating to avoid possible chip damage if pin is pulled high by your program but I use it as a general IO pin .\\  ​+__Note__ :-  GPIO2 It is considered safer to pull it high with a resistor ​on boot rather than leave it floating to avoid possible chip damage if pin is pulled high by your program but also see [[http://​www.esp8266.com/​viewtopic.php?​f=6&​t=3862&​p=22524#​p22524|http://​www.esp8266.com/​viewtopic.php?​f=6&​t=3862&​p=22524#​p22524]]. \\  ​
    
 FLASH mode is when running the program. Take GPIO0 high or float  or it will stall on first reset,​intentional or not\\  FLASH mode is when running the program. Take GPIO0 high or float  or it will stall on first reset,​intentional or not\\ 
Line 65: Line 68:
 UART mode is how the code is uploaded to the chip and GPIO0 and GPIO15 must be low on boot to enter this mode.  .\\  UART mode is how the code is uploaded to the chip and GPIO0 and GPIO15 must be low on boot to enter this mode.  .\\ 
  
-SDIO mode is where the chip boots from an SD card. I dont think this is available to us yet \\    ​+SDIO mode is where the chip boots from an SD card. I don'​t ​think this is available to us yet \\    ​
        
  
Line 108: Line 111:
  
 ===== Maximum Current ===== ===== Maximum Current =====
-When using a GPIO as output (i.e. to drive something such as an LED) it is important to note that the maximum output current is 12mA. (I<​sub>​MAX</​sub>​=12mA per Expressif ​datasheet) +When using a GPIO as output (i.e. to drive something such as an LED) it is important to note that the maximum output current is 12mA. (I<​sub>​MAX</​sub>​=12mA per Espressif ​datasheet) 
- If you try and output more current than that, you run the risk of damaging the device. ​ Since many LEDs are able to draw 20mA you should adjust your current limiting resistor to be 12mA or less.  Using [[https://​en.wikipedia.org/​wiki/​Ohm'​s_law|Ohms law]] - R=V/I so 3.3V at 12mA = 275Ω min so use 330Ω or higher.+ If you try and output more current than that, you run the risk of damaging the device. ​ Since many LEDs are able to draw 20mA you should adjust your current limiting resistor to be 12mA or less.  Using https://​en.wikipedia.org/​wiki/​LED_circuit ​- R=(Vout-Vled)/I so (3.3V-1.8Vred) ​at 12mA = 125Ω min for a red LED.
esp8266_gpio_pin_allocations.txt · Last modified: 2017/11/10 02:18 by ekriirke