Sunday, December 31, 2017

ESP32

Expressif comes out with ESP32, a more powerful successor to the popular ESP8266.  The ESP-WROOM-32 module can be purchased for under $5.   It is a 25.5 x18 x 3.1 mm PCB with printed antenna, and 38 castellation pins with 1.27mm (0.05") pitch.  A very nice pinouts diagram can be found here.


The ESP32-D0WDQ6 supports 802.11n WiFi (2.4GHz) and Bluetooth v4.2.  It contains dual Xtensa 32-bit LX6 cores (240MHz), 448KB ROM and 520KB SRAM.  ESP-WROOM-32 has 4MB QSPI Flash.  ESP32 can address up to 16MB external Flash.   Parts of the internal SRAM (32KB for each core) serve as the cache for the slow SPI Flash.

There is also a development board which adds a 3.3V regulator and CP2102 USB to serial bridge chip.   It has the more convenient 0.1" pitch pins.  Or we can wire up like this,



Using Arduino is probably a good way to start.  The support for esp32 is not included in Arduino by default; it can be installed following the instructions here .

IO0 has to be pulled low to enter the serial bootloader mode.  esptool.py uses RTS for EN and DTR for IO0.  For the ESP32 development board, CP2102 USB to serial bridge chip handles entering the bootloader mode.  Here it is done manually.  The connections are as follows,
  • GND - GND
  • 3V3 - 3.3V
  • TXD0 - RX
  • RXD0 - TX
  • EN - Pull up 
  • IO0 - Pull down
When EN is float, the current draw is about 5mA.  If EN is low, the current draw is 0mA.  When IO0 is pulled low, the current draw is about 17mA.

We test with the example code WiFiScan, which compiles without a problem.
Sketch uses 480294 bytes (36%) of program storage space. Maximum is 1310720 bytes.

Global variables use 36800 bytes (12%) of dynamic memory, leaving 258112 bytes for local variables. Maximum is 294912 bytes.
sptool.py v2.1
Connecting........
Chip is ESP32D0WDQ6 (revision 1)
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 8192 bytes to 47...

Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.0 seconds (effective 13109.4 kbit/s)...
Hash of data verified.
Compressed 14128 bytes to 9213...

Writing at 0x00001000... (100 %)
Wrote 14128 bytes (9213 compressed) at 0x00001000 in 0.1 seconds (effective 983.4 kbit/s)...
Hash of data verified.
Compressed 481440 bytes to 299651...

Writing at 0x00010000... (5 %)
Writing at 0x00014000... (10 %)
Writing at 0x00018000... (15 %)
Writing at 0x0001c000... (21 %)
Writing at 0x00020000... (26 %)
Writing at 0x00024000... (31 %)
Writing at 0x00028000... (36 %)
Writing at 0x0002c000... (42 %)
Writing at 0x00030000... (47 %)
Writing at 0x00034000... (52 %)
Writing at 0x00038000... (57 %)
Writing at 0x0003c000... (63 %)
Writing at 0x00040000... (68 %)
Writing at 0x00044000... (73 %)
Writing at 0x00048000... (78 %)
Writing at 0x0004c000... (84 %)
Writing at 0x00050000... (89 %)
Writing at 0x00054000... (94 %)
Writing at 0x00058000... (100 %)
Wrote 481440 bytes (299651 compressed) at 0x00010000 in 3.9 seconds (effective 976.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 122...

Writing at 0x00008000... (100 %)
Wrote 3072 bytes (122 compressed) at 0x00008000 in 0.0 seconds (effective 6060.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting...
Not sure how the max memory sizes come about.   The program works.  The current draw is about 110mA@3.3V.
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:13076
entry 0x40078ad0
Setup done
scan start
scan done
10 networks found
1: ...

As the ESP chips gain popularity, many online resources are available,
The data sheet and the reference manual are still missing lots of information.  For instance, there is no performance data on the ADC and DAC.

No comments:

Post a Comment