|
1 |
| -Arduino core for ESP32 WiFi chip |
2 |
| -=========================================== |
3 |
| - |
4 |
| -### Development Status |
5 |
| -Not everything is working yet, you can not get it through package manager, but you can give it a go and help us find bugs in the things that are implemented :) |
6 |
| - |
7 |
| -The framework can also be downloaded as component in an IDF project and be used like that. |
8 |
| - |
9 |
| -Things that "should" work: |
10 |
| -- pinMode |
11 |
| -- digitalRead/digitalWrite |
12 |
| -- attachInterrupt/detachInterrupt |
13 |
| -- Serial (global Serial is attached to pins 1 and 3 by default, there are another 2 serials that you can attach to any pin) |
14 |
| -- SPI (global SPI is attached to VSPI pins by default and HSPI can be attached to any pins) |
15 |
| -- Wire (global Wire is attached to pins 21 and 22 by default and there is another I2C bus that you can attach to any pins) |
16 |
| -- WiFi (about 99% the same as ESP8266) |
17 |
| - |
18 |
| -WiFiClient, WiFiServer and WiFiUdp are not quite ready yet because there are still some small hiccups in LwIP to be overcome. |
19 |
| -You can try WiFiClient but you need to disconnect the client yourself to be sure that connection is closed. |
20 |
| - |
21 |
| -### Installation |
22 |
| -- Install Arduino IDE |
23 |
| -- Go to Arduino IDE installation directory |
24 |
| -- Clone this repository into hardware/espressif/esp32 directory (or clone it elsewhere and create a symlink) |
25 |
| -```bash |
26 |
| -cd hardware |
27 |
| -mkdir espressif |
28 |
| -cd espressif |
29 |
| -git clone https://github.com/espressif/arduino-esp32.git esp32 |
30 |
| -``` |
31 |
| -- Download binary tools (you need Python 2.7) |
32 |
| -```bash |
33 |
| -cd esp32/tools |
34 |
| -python get.py |
35 |
| -``` |
36 |
| -- Restart Arduino |
| 1 | +# Arduino core for ESP32 WiFi chip |
| 2 | + |
| 3 | +[](https://travis-ci.org/espressif/arduino-esp32) |
| 4 | + |
| 5 | +## Need help or have a question? Join the chat at [](https://gitter.im/espressif/arduino-esp32?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
| 6 | + |
| 7 | +- [Development Status](#development-status) |
| 8 | +- [Installation Instructions](#installation-instructions): |
| 9 | + + [Using Arduino IDE](#using-through-arduino-ide) |
| 10 | + + [Windows](https://github.com/espressif/arduino-esp32/blob/master/doc/windows.md) |
| 11 | + + [Mac OS](#instructions-for-mac) |
| 12 | + + [Debian/Ubuntu](#instructions-for-debianubuntu-linux) |
| 13 | + + [Decoding Exceptions](#decoding-exceptions) |
| 14 | + + [Using PlatformIO](#using-platformio) |
| 15 | + + [Using as ESP-IDF component](#using-as-esp-idf-component) |
| 16 | +- [ESP32Dev Board PINMAP](#esp32dev-board-pinmap) |
| 17 | + |
| 18 | +## Development Status |
| 19 | +Most of the framework is implemented. Most noticable is the missing analogWrite. While analogWrite is on it's way, there are a few other options that you can use: |
| 20 | +- 16 channels [LEDC](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-ledc.h) which is PWM |
| 21 | +- 8 channels [SigmaDelta](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-sigmadelta.h) which uses SigmaDelta modulation |
| 22 | +- 2 channels [DAC](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-dac.h) which gives real analog output |
| 23 | + |
| 24 | +## Installation Instructions |
| 25 | + |
| 26 | +### Using through Arduino IDE |
| 27 | + |
| 28 | +###[Instructions for Windows](doc/windows.md) |
| 29 | + |
| 30 | +#### Instructions for Mac |
| 31 | +- Install latest Arduino IDE from [arduino.cc](https://www.arduino.cc/en/Main/Software) |
| 32 | +- Open Terminal and execute the following command (copy->paste and hit enter): |
| 33 | + |
| 34 | + ```bash |
| 35 | + mkdir -p ~/Documents/Arduino/hardware/espressif && \ |
| 36 | + cd ~/Documents/Arduino/hardware/espressif && \ |
| 37 | + git clone https://github.com/espressif/arduino-esp32.git esp32 && \ |
| 38 | + cd esp32/tools/ && \ |
| 39 | + python get.py |
| 40 | + ``` |
| 41 | +- Restart Arduino IDE |
| 42 | + |
| 43 | +#### Instructions for Debian/Ubuntu Linux |
| 44 | +- Install latest Arduino IDE from [arduino.cc](https://www.arduino.cc/en/Main/Software) |
| 45 | +- Open Terminal and execute the following command (copy->paste and hit enter): |
| 46 | + |
| 47 | + ```bash |
| 48 | + sudo usermod -a -G dialout $USER && \ |
| 49 | + sudo apt-get install git && \ |
| 50 | + mkdir -p ~/Arduino/hardware/espressif && \ |
| 51 | + cd ~/Arduino/hardware/espressif && \ |
| 52 | + git clone https://github.com/espressif/arduino-esp32.git esp32 && \ |
| 53 | + cd esp32/tools/ && \ |
| 54 | + python get.py |
| 55 | + ``` |
| 56 | +- Restart Arduino IDE |
| 57 | + |
| 58 | +#### Decoding exceptions |
| 59 | + |
| 60 | +You can use [EspExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecoder) to get meaningful call trace. |
| 61 | + |
| 62 | +### Using PlatformIO |
| 63 | + |
| 64 | +[PlatformIO](http://platformio.org) is an open source ecosystem for IoT |
| 65 | +development with cross platform build system, library manager and full support |
| 66 | +for Espressif ESP32 development. It works on the popular host OS: Mac OS X, Windows, |
| 67 | +Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard). |
| 68 | + |
| 69 | +- [What is PlatformIO?](http://docs.platformio.org/page/what-is-platformio.html) |
| 70 | +- [PlatformIO IDE](http://platformio.org/platformio-ide) |
| 71 | +- Quick Start with [PlatformIO IDE](http://docs.platformio.org/page/ide/atom.html#quick-start) or [PlatformIO Core](http://docs.platformio.org/page/core.html) |
| 72 | +- [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/page/ide.html) - |
| 73 | + Cloud9, Codeanywehre, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM and Visual Studio |
| 74 | +- [Project Examples](https://github.com/platformio/platform-espressif32/tree/develop/examples) |
| 75 | +- [Using "Stage" (Git) version of Arduino Core](http://docs.platformio.org/page/platforms/espressif32.html#using-arduino-framework-with-staging-version) |
| 76 | + |
| 77 | +### Building with make |
| 78 | + |
| 79 | +[makeEspArduino](https://github.com/plerup/makeEspArduino) is a generic makefile for any ESP8266/ESP32 Arduino project. |
| 80 | +Using make instead of the Arduino IDE makes it easier to do automated and production builds. |
| 81 | + |
| 82 | +### Using as ESP-IDF component |
| 83 | +- Download and install [esp-idf](https://github.com/espressif/esp-idf) |
| 84 | +- Create blank idf project (from one of the examples) |
| 85 | +- in the project folder, create a folder called components and clone this repository inside |
| 86 | + |
| 87 | + ```bash |
| 88 | + mkdir -p components && \ |
| 89 | + cd components && \ |
| 90 | + git clone https://github.com/espressif/arduino-esp32.git arduino && \ |
| 91 | + cd .. && \ |
| 92 | + make menuconfig |
| 93 | + ``` |
| 94 | +- ```make menuconfig``` has some Arduino options |
| 95 | + - "Autostart Arduino setup and loop on boot" |
| 96 | + - If you enable this options, your main.cpp should be formated like any other sketch |
| 97 | + |
| 98 | + ```arduino |
| 99 | + //file: main.cpp |
| 100 | + #include "Arduino.h" |
| 101 | + |
| 102 | + void setup(){ |
| 103 | + Serial.begin(115200); |
| 104 | + } |
| 105 | + |
| 106 | + void loop(){ |
| 107 | + Serial.println("loop"); |
| 108 | + delay(1000); |
| 109 | + } |
| 110 | + ``` |
| 111 | + |
| 112 | + - Else you need to implement ```app_main()``` and call ```initArduino();``` in it. |
| 113 | + |
| 114 | + Keep in mind that setup() and loop() will not be called in this case. |
| 115 | + If you plan to base your code on examples provided in [esp-idf](https://github.com/espressif/esp-idf/tree/master/examples), please make sure move the app_main() function in main.cpp from the files in the example. |
| 116 | + |
| 117 | + ```arduino |
| 118 | + //file: main.cpp |
| 119 | + #include "Arduino.h" |
| 120 | + |
| 121 | + extern "C" void app_main() |
| 122 | + { |
| 123 | + initArduino(); |
| 124 | + pinMode(4, OUTPUT); |
| 125 | + digitalWrite(4, HIGH); |
| 126 | + //do your own thing |
| 127 | + } |
| 128 | + ``` |
| 129 | + - "Disable mutex locks for HAL" |
| 130 | + - If enabled, there will be no protection on the drivers from concurently accessing them from another thread/interrupt/core |
| 131 | + - "Autoconnect WiFi on boot" |
| 132 | + - If enabled, WiFi will start with the last known configuration |
| 133 | + - Else it will wait for WiFi.begin |
| 134 | +- ```make flash monitor``` will build, upload and open serial monitor to your board |
| 135 | + |
| 136 | +## ESP32Dev Board PINMAP |
37 | 137 |
|
38 | 138 | 
|
0 commit comments