Logo   Development Environment

Home
Dragonnorth...
Modules
Published Source License
Screen Shots
SD Card Issues
Updating Firmware

Reference Information
Airflow Setup
Development Environment
I2C Addresses
Module Setup
MQTT
Network Setup
Processor Module Pinning
WattNode Modbus Adapter

Development History
Breadboard
Project Status
Software Revisions

References
PJRC hardware
ESP8266 Information

Development Environment

Contents

Development Environment Setup
ESP32 Setup
Build Environment Notes
Firmware Releases

Build Environment Notes

LOGGER was developed on a computer that is also used to develop Teensy applications and ESP8266 applications. The Arduino environent is shared. This environment setup has been tried and found to work on machines without the Teensy environment, but, that testing is not continuous. There may be issues if the Teensy environment is missing.

An excellent discussion of how to load the ESP8266 is at http://www.allaboutcircuits.com/projects/update-the-firmware-in-your-esp8266-wi-fi-module/

Espressif, the designers of the ESP8266 integrated circuit, have created a specific piece of software to update the firmware in their chips. It's the ESP Flash Download Tool.

This might be a way to decode a stack dump: https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.md

Reboot

To reboot the module press the SW2 button.

Loading a New Image

Press and hold the SW1 Button then press SW2 to reboot while still holding SW1. The D1 LED should be on at a dim level. Then initiate the upload in the Arduino environment.

Development Environment Setup

Download and install the Arduino development environment from https://www.arduino.cc/en/Main/Software. Version 1.8.13 was used (1.8.13 local copy as a zip file).
Previously development was done on Arduino (1.8.12 local copy as a zip file).
Previously development was done on Arduino (1.8.10 local copy as a zip file).
Early development was done on Arduino (1.8.1 local copy as a zip file) and (1.8.2 local copy as a zip file).

Early development was done on a system that had the Teensyduino development environment installed. This should not be necessary development continued using Arduino 1.8.2, 1.8.10, 1.8.12 and 1.8.13 without the Teensyduino installation. The Teensyduino development environment from PJRC http://www.pjrc.com/teensy/td_download.html was used. Development was done with Teensy 1.34 beta for Arduino 1.8.1 (local copy). Arduino must be installed first. Teensy modifies the installation.

Adafruit has add on boards for the ESP8266 wifi module. Discussion at: https://learn.adafruit.com/adafruit-huzzah-esp8266-breakout/overview Update the Arduino installation by going to Arduino >> File >> Preferences and adding:

https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
http://arduino.esp8266.com/stable/package_esp8266com_index.json
to the Additional Boards Manager. Then going to Tools >> Board >> Boards Manager locating ESP8266 in the list and INSTALLing that board. (Select Type: Contributed to narrow the search). Version 3.0.0 was used. Previous development used version 2.7.4, 2.7.1 and 2.5.2. Early development was on version 2.3.0. Later versions are likely to work. Development will continue on later versions when they are released.

Adafruit circuit playground was installed version 1.11.2 is being used.

Adafruit GFX library was installed version 1.10.2 is used. Version 1.10.1 was used previously.

Adafruit RTClib was installed version 1.12.0 is used. Version 1.11.2 was used previously.

The onewire library from the Teensy world is used. Version 2.3.5 was used. Earlier development was done on 2.3.3 and 2.3.0. It is required and may have to be manually added. It comes from https://github.com/PaulStoffregen/OneWire (local copy of 2.3.5) (local copy of 2.3.0) Go to Sketch >> Include Library >> Add .ZIP Library... Then update to the latest version.

The SparkFun BME280 library is installed. Version 2.0.9 was used.

The SparkFun CCS811 library is installed. Version 2.0.1 was used.

The SparkFun Micro OLED Breakout library is installed. Version 1.3.3 was used.

The SparkFun VCNL4040 Proximity Sensor library is installed. Version 1.0.2 was used.

The SparkFun VL53L1X 4m Laser Distance Sensor library is installed. Version 1.2.9 was used.

The TimeLib library is also common with the Teensy install. Version 1.6.0 was used. Earlier development used version 1.5.0. It is required and will have to be manually added. It comes from: https://github.com/PaulStoffregen/Time (local copy of 1.6.0) (local copy of 1.5.0) Go to Sketch >> Include Library >> Add .ZIP Library...

The ATT M2X environment is used to uplink data to the cloud. The library used does not report a version it came from https://github.com/attm2x/m2x-arduino (local copy) and is packaged as a zip file for inclusion at M2XStreamClient.zip Go to Sketch >> Include Library >> Add .ZIP Library...
(Note: ATT has stopped supporting M2X and this will soon be eliminated from the LOGGER.)

There is a bug in core_esp8266_si2c.cpp the patched file is in the logger release. Copy this file to the appropriate directory if the library has not yet been patched or fixed. A simple note about the patch is in the file. Search for MJN and ???.

A path similar to: c:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\core_esp8266_si2c.cpp finds the file with the bug. In core releases prior to 2.6.1 there were two changes, some special debugging code is inserted in twi_writeTo() this returns special error codes in certain conditions. When twi_readFrom() is passed a 0 length the original code does not test for this condition and reads many bytes instead of reading none.

Starting with core 2.6.1 the library code changed substantially and only the second change is needed. In paths that look like c:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.1\cores\esp8266\core_esp8266_si2c.cpp or c:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_si2c.cpp the first change is eliminated and in Twi::readFrom the same failure to test for a 0 length exists and is fixed. Find the Twi::readFrom subroutine. There is a for loop in that subroutine that runs from 0 to len-1. If len is 0 this for loop must be suppressed, the variable is unsigned so counting from 0 to len-1 when len is 0 counts from 0 to the largest possible integer and takes a very long time.

Once all of the environment is installed remember to set the target platform, Generic ESP8266 was used. A flash size of 4M with 1M SPIFFS was used.

A common debugging module for the ESP8266 is the FTDI Friend from ADAfruit. Drivers for this module must be installed, they are available from: FTDI Friend Drivers. Windows 10 automatically installs the drivers. Other versions differ. Once the device is connected figure out which port is used. The Logger uses 115200 baud. Several of the line endings work, Newline seems best.
NOTE: It is possible that Arduino 1.8.10 and above installs these drivers.

Development Environment Setup

To enable building for the ESP32 update the Arduino installation by going to Arduino >> File >> Preferences and adding:

https://dl.espressif.com/dl/package_esp32_index.json
to the Additional Boards Manager. Then going to Tools >> Board >> Boards Manager locate ESP32 in the list and INSTALLing that board. (Select Type: Contributed to narrow the search). Version 1.0.6 was used.

This is a place to collect instructions minimal testing has been done on the ESP32 platform to date using the 'ESP32 Dev Module' board.

Documentation for the ESP32_DevKitc_V4 among others is found at the Experssif Devkit Getting Started Guide.

Schematics and Layout Releases

You must be logged in to see the hardware designs.

LOGGER Firmware Releases

See Binary Images for images released in support of the LOGGER.

See the Code History for a complete history of changes to the LOGGER code.

                                                                                                                                                       
LOGGER pages copyright 2016-2021 by Dragonnorth Group (Michael Newman).
Send comments and corrections to:
Webmaster: mnewman@dragonnorth.com