Date post: | 18-Jul-2015 |
Category: |
Technology |
Upload: | sergei-silnov |
View: | 2,451 times |
Download: | 8 times |
Начинаем работать с ESP8266
Иван Грохотков HackIoT #2, 24 декабря 2014
ESP8266
4Mbit Flash25МГц кварц
Антенна
2x GPIO UART
VCC, GND RST, CH_PD
$3.00
• Tensilica Xtensa lx-106 RISC CPU
• 32k IRAM96k RAM (~40k доступно)64k OTP(?) ROM
• 16 GPIO, 1.5x UART, 2x SPI, 1 канал 10-бит АЦП
• 802.11 b/g/n PHY + MACLwIP TCP/IP стэк
• Выполнение приложений из SPI FLASH
ESP-01
ESP-01
1. VCC=3.0 – 3.6В ICC < 200мА
2. RESET, CH_PD – 10кОм к VCC
3. GPIO0 – к GND для загрузки ПО, к VCC для работы
FTDI + ESP-01
FTDI + ESP-01
1. TX, RX ESP — к RX, TX FTDI
2. Отдельный источник питания для ESP
Загрузка программы
Загрузка программы
1. GPIO0 — к GND
2. Перезагрузить, заземлив CH_PD или RESET
Tools
A. crosstool-NGhttps://github.com/esp8266/esp8266-wiki/wiki/Toolchain
B. Ubuntu Virtualbox image (Espressif) http://bbs.espressif.com/viewtopic.php?f=5&t=2
SDK
• ESP8266 SDK v0.9.4 http://bbs.espressif.com/viewtopic.php?f=5&t=90
• FreeRTOS porthttps://github.com/espressif/esp_iot_rtos_sdk
https://github.com/themadinventor/esptool
./esptool.py -—port=/dev/tty.usbserial \ write_flash 0x00000 firmware.bin
ArduinoESP
https://github.com/igrr/Arduino
git checkout -b ide-1.5.x-esp8266
Blink
Arduino IDE
AVR platform
SAM platform ESP8266 platform
BoardsLibraries
Toolchain
Uploadtools
SDK
CoreCore
void loop() { while(true){ delay(1000);
} }
Scheduler
WiFi task
TCP/IP task
Timer
TCP/IP task
User task
User callback
User callback
User callback
TCP/IP task
Scheduler
WiFi task
TCP/IP task
Timer
TCP/IP task
User task
User callback
User callback
User callback
TCP/IP task
void loop() { while(true){
delay(1000); }
}
x
Restore stack & registers
Scheduler
WiFi task
TCP/IP task
Timer
User taskSave stack & registers & PC
Set timer Jump!
delay(1000)
<- schedule user task
User taskreturn from delay
Работает• Большинство встроенных функций:pinMode, digitalRead, digitalWrite, analogRead(0), attachInterrupt, detachInterrupt, shiftIn, shiftOut, millis, micros, delay, delayMicroseconds, yield
• Библиотеки: Serial, Ticker, EEPROM, Wire (I2C), WiFi
• Многие сторонние библиотеки: Zt I2C OLED, DHT11, ArduinoJson, Stepper, etc…
• Встроенные функцииanalogWrite, pulseIn
• SPI, UDP, I2C slave
Еще нет
betaMac OS X 10.7+
http://goo.gl/xS94fi
(http://download.igrr.me/arduino-1.5.9-macosx-signed.zip)
Source:
https://github.com/igrr/Arduino
Demo
ESP8266 + DHT11+ HTTP
Спасибо!