Skip to content

Porting ESP8266WebServer to ESP32 (Issue #425) #430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 89 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
5e89f5e
Porting ESP8266WebServer to ESP32
salqadri Jun 10, 2017
ea4e169
Set a pin for LED_BUILTIN if it is not already defined
salqadri Jun 10, 2017
81abd13
Merged from upstream
salqadri Jul 29, 2017
b3fdfda
Bugfix: Put every SPI access between begin / end Transaction (#509)
APokorny Jul 31, 2017
2eaf846
Spi pattern fix (#502)
mcgillan Jul 31, 2017
37ef5a4
Handle partial socket send (#503)
bbx10 Jul 31, 2017
b34d18f
Add ThaiEasyElec's ESPino32 (#506)
narongrat Jul 31, 2017
ca7f6cc
Update IDF libs to 9314bf0
me-no-dev Aug 1, 2017
0accabc
Fix some compilation errors
me-no-dev Aug 1, 2017
706bf48
EEPROM_library_ported_Partition_table_updated (#535)
pbecchi Aug 1, 2017
f54b0fc
Create Issue template (#504)
copercini Aug 1, 2017
91d02cc
Change disconnect function (#466)
sticilface Aug 1, 2017
2aed417
Enable 1bit SDMMC for Olimex ESP32-EVB
me-no-dev Aug 1, 2017
5c1b10f
Small improvements in update example (#552)
copercini Aug 1, 2017
3af1710
Add initial support for Ethernet and examples
me-no-dev Aug 1, 2017
4495659
Increase the memory for loop task
me-no-dev Aug 1, 2017
a1bef8b
improve Serial repeated begin/baud change
me-no-dev Aug 1, 2017
9618eec
Set DNS IP to type V4
me-no-dev Aug 2, 2017
41e36a7
uartEnd: Unlock mutex before detaching rx and tx (#554)
Raienryu97 Aug 4, 2017
3a8e28d
change esp_wifi_scan_start to async mode (#574)
toomasz Aug 17, 2017
e6ba0f6
DOCUMENTATION: Moved installation instructions to separate page (#561)
Raienryu97 Aug 17, 2017
1b3e8fa
Add "M5Stack-Core-ESP32" boards support
M5StackJimmyLai Aug 17, 2017
20d40f0
fix OTA
me-no-dev Aug 17, 2017
7d643df
Update espota for Windows
me-no-dev Aug 17, 2017
77b0347
Set uart queue to NULL after free
me-no-dev Aug 17, 2017
be34c9e
Add Heltec Automation WIFI Kit 32 and WIFI LoRa 32 2 board. (#584)
SDpower Aug 17, 2017
856823e
Add support for 2MB flash and future option for different partition s…
me-no-dev Aug 17, 2017
8bca8d5
Update IDF libs to 969f1bb (skip BT commits)
me-no-dev Aug 18, 2017
4649db5
Add ESPectro32 board definition (#586)
alwint3r Aug 20, 2017
adff071
add mhetesp32devkit and mhetesp32minikit boards (#587)
reaper7 Aug 20, 2017
04044e2
Use correct extra_flags property in recipe.S.o.pattern (#589)
per1234 Aug 23, 2017
ad17954
SNI support (#592)
copercini Aug 24, 2017
ff65a51
Parking code
salqadri Aug 24, 2017
6707d4d
Optimize timer drift
me-no-dev Aug 25, 2017
a710896
Missing missing xcrun fix. (#601)
rvdende Aug 31, 2017
fd9cc00
Fix support for some arduino libraries which don't put source files u…
imxieyi Sep 3, 2017
0f83dbc
Fix PlatformIO build
me-no-dev Sep 4, 2017
234c855
add configTzTime() to setup sntp using TZ environment variable (#608)
markyad Sep 5, 2017
9edf65d
Static IP example
copercini Sep 9, 2017
59a6800
Enable clocks for UART1 and 2
me-no-dev Sep 10, 2017
bb078ca
Add Dongsen Tech Pocket 32 and fake "WeMos" WiFi&Bluetooth Battery (w…
markheloking Sep 10, 2017
0bce98e
add Microduino-esp32 (#621)
radiumray Sep 11, 2017
ba929be
Update IDF to 9a26296
me-no-dev Sep 12, 2017
39fb8c3
Fix header deprecation
me-no-dev Sep 12, 2017
29a253a
Add initial SPIFFS library (#627)
me-no-dev Sep 12, 2017
9fc3f1e
Fix wrong SPI peripheral enabled
me-no-dev Sep 13, 2017
27d54b3
Very slight difference between LoRa kit and WiFi kit. (#629)
pnewb Sep 13, 2017
658acfe
Add missing headers
me-no-dev Sep 14, 2017
79ee46e
beautify partition
me-no-dev Sep 14, 2017
ab0ea2f
Fix missing method from SPI HAL
me-no-dev Sep 18, 2017
db79c2e
Add api to get CPU temperature
me-no-dev Sep 18, 2017
f648ad7
Allow WiFi Event Callback to read the event info
me-no-dev Sep 18, 2017
4cf0e98
Fix desync with IDF in dhcpserver
me-no-dev Sep 20, 2017
17add63
Add Example Code for WPS Functionality (#648)
Raienryu97 Sep 21, 2017
4092fc4
Add baudRate function (#651)
Sep 21, 2017
c66a020
Add guards to not compile BT code if not enabled
me-no-dev Sep 21, 2017
1407654
Must include sdkconfig.h before testing defines
me-no-dev Sep 21, 2017
eb28213
Allow DHCP to be started again by giving a zero IP address to STA config
me-no-dev Sep 22, 2017
e2bd93c
Fix UART0 not able to read/available
me-no-dev Sep 22, 2017
d27d297
Update IDF to c4e65d6
me-no-dev Sep 22, 2017
4c36e03
Added ESPNow basic example (#667)
arvindr21 Sep 26, 2017
dbf7b10
Update README.md with install instructions for openSUSE (#585)
joba1 Sep 26, 2017
cc00af3
Update opensuse.md
me-no-dev Sep 26, 2017
db77195
Fix Serial
me-no-dev Sep 27, 2017
2b6d47a
Fix race in SPI endTransaction
me-no-dev Sep 27, 2017
a66b544
Added ESPNow Multi-Slave example (#669)
arvindr21 Sep 27, 2017
3ba46c7
Add totalBytes / usedBytes to SD/SDMMC (#673)
Sep 28, 2017
28b7b4e
Move network events to their own task
me-no-dev Sep 28, 2017
7991161
Change Pin Interrupt Allocator
me-no-dev Sep 28, 2017
f9b2d42
Change Touch interrupt allocator
me-no-dev Sep 28, 2017
6d98555
Change timer interrupt allocator
me-no-dev Sep 28, 2017
17ece1b
Revert Timer Interrupt setup
me-no-dev Sep 28, 2017
af35773
OK Really change timer allocator
me-no-dev Sep 28, 2017
4230aec
Allow HTTPClient to access HTTPS without providing a certificate
me-no-dev Sep 28, 2017
7aa1913
Allow HTTPS without certificate to use begin(url)
me-no-dev Sep 29, 2017
e72895b
Quiet SSL and HTTPClient debug
me-no-dev Sep 29, 2017
10ff1de
Add example to update ESP32 via SD card (#628)
Curclamas Sep 29, 2017
0cd6285
I2c reset functionality (#678)
lonerzzz Sep 29, 2017
28be506
uncomment I2C debug so it can be used
me-no-dev Sep 29, 2017
c240674
Add mkspiffs
me-no-dev Sep 30, 2017
a20f94c
Revert "Add mkspiffs"
me-no-dev Sep 30, 2017
d208a36
Use correct sign of offset for TZ variable (#685)
Oct 1, 2017
17a1a24
fix SPIFFS example
me-no-dev Oct 1, 2017
171032b
Print an error when serial number is invalid (#691)
copercini Oct 4, 2017
3b972e8
Link cxx_guards from IDF libcxx not from libstdc++ (#695)
projectgus Oct 4, 2017
2479035
Porting ESP8266WebServer to ESP32
salqadri Jun 10, 2017
0ebf60e
Set a pin for LED_BUILTIN if it is not already defined
salqadri Jun 10, 2017
22abd19
Parking code
salqadri Aug 24, 2017
a22beb2
Merge branch 'master' of https://github.com/salqadri/arduino-esp32
salqadri Oct 7, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
155 changes: 21 additions & 134 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,160 +2,47 @@

[![Build Status](https://travis-ci.org/espressif/arduino-esp32.svg?branch=master)](https://travis-ci.org/espressif/arduino-esp32)

## Need help or have a question? Join the chat at [![https://gitter.im/espressif/arduino-esp32](https://badges.gitter.im/espressif/arduino-esp32.svg)](https://gitter.im/espressif/arduino-esp32?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
### Need help or have a question? Join the chat at [![https://gitter.im/espressif/arduino-esp32](https://badges.gitter.im/espressif/arduino-esp32.svg)](https://gitter.im/espressif/arduino-esp32?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Contents
- [Development Status](#development-status)
- [Installation Instructions](#installation-instructions):
+ [Using Arduino IDE](#using-through-arduino-ide)
+ [Windows](https://github.com/espressif/arduino-esp32/blob/master/doc/windows.md)
+ [Mac OS](#instructions-for-mac)
+ [Debian/Ubuntu](#instructions-for-debianubuntu-linux)
+ [Decoding Exceptions](#decoding-exceptions)
+ [Using PlatformIO](#using-platformio)
+ [Using as ESP-IDF component](#using-as-esp-idf-component)
- [Installation Instructions](#installation-instructions)
- [Decoding Exceptions](#decoding-exceptions)
- [Issue/Bug report template](#issuebug-report-template)
- [ESP32Dev Board PINMAP](#esp32dev-board-pinmap)

## Development Status
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:
- 16 channels [LEDC](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-ledc.h) which is PWM
- 8 channels [SigmaDelta](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-sigmadelta.h) which uses SigmaDelta modulation
- 2 channels [DAC](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-dac.h) which gives real analog output
- 16 channels [LEDC](cores/esp32/esp32-hal-ledc.h) which is PWM
- 8 channels [SigmaDelta](cores/esp32/esp32-hal-sigmadelta.h) which uses SigmaDelta modulation
- 2 channels [DAC](cores/esp32/esp32-hal-dac.h) which gives real analog output

## Installation Instructions

### Using through Arduino IDE

#### [Instructions for Windows](doc/windows.md)

#### Instructions for Mac
- Install latest Arduino IDE from [arduino.cc](https://www.arduino.cc/en/Main/Software)
- Open Terminal and execute the following command (copy->paste and hit enter):

```bash
mkdir -p ~/Documents/Arduino/hardware/espressif && \
cd ~/Documents/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
cd esp32/tools/ && \
python get.py
```
- Restart Arduino IDE

#### Instructions for Debian/Ubuntu Linux
- Install latest Arduino IDE from [arduino.cc](https://www.arduino.cc/en/Main/Software)
- Open Terminal and execute the following command (copy->paste and hit enter):

```bash
sudo usermod -a -G dialout $USER && \
sudo apt-get install git && \
wget https://bootstrap.pypa.io/get-pip.py && \
sudo python get-pip.py && \
sudo pip install pyserial && \
mkdir -p ~/Arduino/hardware/espressif && \
cd ~/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
cd esp32/tools/ && \
python get.py
```
- Restart Arduino IDE

#### Instructions for Fedora
- Install the latest Arduino IDE from [arduino.cc](https://www.arduino.cc/en/Main/Software). `$ sudo dnf -y install arduino` will most likely install an older release.
- Open Terminal and execute the following command (copy->paste and hit enter):

```bash
sudo usermod -a -G dialout $USER && \
sudo dnf install git python3-pip python3-pyserial && \
mkdir -p ~/Arduino/hardware/espressif && \
cd ~/Arduino/hardware/espressif && \
git clone https://github.com/espressif/arduino-esp32.git esp32 && \
cd esp32/tools/ && \
python get.py
```
- Restart Arduino IDE
- Using Arduino IDE
+ [Instructions for Windows](docs/arduino-ide/windows.md)
+ [Instructions for Mac](docs/arduino-ide/mac.md)
+ [Instructions for Debian/Ubuntu Linux](docs/arduino-ide/debian_ubuntu.md)
+ [Instructions for Fedora](docs/arduino-ide/fedora.md)
+ [Instructions for openSUSE](docs/arduino-ide/opensuse.md)
- [Using PlatformIO](docs/platformio.md)
- [Building with make](docs/make.md)
- [Using as ESP-IDF component](docs/esp-idf_component.md)

#### Decoding exceptions

You can use [EspExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecoder) to get meaningful call trace.

### Using PlatformIO

[PlatformIO](http://platformio.org) is an open source ecosystem for IoT
development with cross platform build system, library manager and full support
for Espressif ESP32 development. It works on the popular host OS: Mac OS X, Windows,
Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).

- [What is PlatformIO?](http://docs.platformio.org/page/what-is-platformio.html)
- [PlatformIO IDE](http://platformio.org/platformio-ide)
- 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)
- [Integration with Cloud and Standalone IDEs](http://docs.platformio.org/page/ide.html) -
Cloud9, Codeanywehre, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM and Visual Studio
- [Project Examples](https://github.com/platformio/platform-espressif32/tree/develop/examples)
- [Using "Stage" (Git) version of Arduino Core](http://docs.platformio.org/page/platforms/espressif32.html#using-arduino-framework-with-staging-version)

### Building with make
#### Issue/Bug report template
Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labelled as [for reference](https://github.com/espressif/arduino-esp32/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3A%22for%20reference%22%20).

[makeEspArduino](https://github.com/plerup/makeEspArduino) is a generic makefile for any ESP8266/ESP32 Arduino project.
Using make instead of the Arduino IDE makes it easier to do automated and production builds.
Finally, if you're sure no one else had the issue, follow the [ISSUE_TEMPLATE](docs/ISSUE_TEMPLATE.md) while reporting any issue.

### Using as ESP-IDF component
- Download and install [esp-idf](https://github.com/espressif/esp-idf)
- Create blank idf project (from one of the examples)
- in the project folder, create a folder called components and clone this repository inside

```bash
mkdir -p components && \
cd components && \
git clone https://github.com/espressif/arduino-esp32.git arduino && \
cd .. && \
make menuconfig
```
- ```make menuconfig``` has some Arduino options
- "Autostart Arduino setup and loop on boot"
- If you enable this options, your main.cpp should be formated like any other sketch

```arduino
//file: main.cpp
#include "Arduino.h"

void setup(){
Serial.begin(115200);
}

void loop(){
Serial.println("loop");
delay(1000);
}
```

- Else you need to implement ```app_main()``` and call ```initArduino();``` in it.

Keep in mind that setup() and loop() will not be called in this case.
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.

```arduino
//file: main.cpp
#include "Arduino.h"

extern "C" void app_main()
{
initArduino();
pinMode(4, OUTPUT);
digitalWrite(4, HIGH);
//do your own thing
}
```
- "Disable mutex locks for HAL"
- If enabled, there will be no protection on the drivers from concurently accessing them from another thread/interrupt/core
- "Autoconnect WiFi on boot"
- If enabled, WiFi will start with the last known configuration
- Else it will wait for WiFi.begin
- ```make flash monitor``` will build, upload and open serial monitor to your board

## ESP32Dev Board PINMAP

![Pin Functions](doc/esp32_pinmap.png)
![Pin Functions](docs/esp32_pinmap.png)

## Hint

Sometimes to program ESP32 via serial you must keep GPIO0 LOW during the programming process

Loading