Category Archives: ESP8266

ESP8266 Arduino `.text’ will not fit in region `iram1_0_seg’ Error

I’ve been writing some software for a Wifi based CAN data logger for the ESP8266 in the Arduino platform, and have been getting a bit of a strange error. It appeared to be related to using the std::string functions in my code – and although I have used this in other sketches without issue, I suddenly received the following error as soon as I simply declared a std::string variable:

c:/users/scott/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: C:\Users\Scott\AppData\Local\Temp\build525647f6f8500d071cfab5cccf314276.tmp/ESPCANLogger.ino.elf section `.text' will not fit in region `iram1_0_seg'

collect2.exe: error: ld returned 1 exit status

A bit of googling appears to show that this is something to do with where those std libraries are stored in the code memory of the ESP8266 (I don’t fully understand the details of the chip). The issue is described in this issue in the Arduino ESP8266 github issues log:

https://github.com/esp8266/Arduino/issues/2794

There is a fix shown in this pull request

https://github.com/esp8266/Arduino/pull/2804/files

I had a bit of trouble locating the file referred to, because the Arduino boards manager doesn’t appear to store the added boards in the Program Files location anymore, but these are now located in the AppData folder in your user profile (on Windows 8)

C:\Users\USERNAME\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\tools\sdk\ld\eagle.app.v6.common.ld

The line which appears to fix it all should be added around line 163:

*libstdc++.a:(.literal .text .literal.* .text.*)

So my file then looked like this:

*libsmartconfig.a:(.literal .text .literal.* .text.*)
*libstdc++.a:(.literal .text .literal.* .text.*)
*(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text .irom.text.*)

There is some more detailed explanation about memory inside the ESP8266 here: https://tech.scargill.net/esp8266-ram/

ILI9341 and XPT2046 TFT display on ESP8266

For my own future reference more than anything else, to get the ILI9341 (either Adafruit or otherwise) working on the ESP8266 using the Arduino development environment isn’t completely straightforward. I knew I had this working previously, but couldn’t find the info again, so am copying it here.

It would appear that the ILI9341 library currently available through the Arduino Sketch -> Include Library -> Manage Libraries is not currently compatible with the ESP8266. Thus you have to download the working library directly from the Adafruit Github repository. However, I also had issues with this version. Finally I used the examples on http://nailbuster.com/?page_id=341 to get it working.

Additionally, the XPT2046 library available in the Arduino manage libraries feature does not support Hardware SPI, however there is an alternative developed by [spapadim] on Github. I took the following steps to compile some example code.

  1. Wire up ESP and Touch screen according to http://nailbuster.com/?page_id=341
  2. Download the zip file from the end of the page on http://nailbuster.com/?page_id=341 this includes some working examples
  3. Download XPT2046 library from Github https://github.com/spapadim/XPT2046
  4. Go to Arduino IDE -> Sketch -> Include Library -> Manage Libraries -> Search GFX and install the “Adadfruit GFX Library”
  5. Open the example sketch from Nailbuster and compile and upload

I have a feeling these libraries may be a little out of date now so I’ll have a look at whether they can be updated to use the latest versions available from Adafruit.

ESP8266 Successor – ESP32 released with CAN bus support 

So, the interesting little ESP8266 WiFi SoC finally has a younger brother which appears to be even more capable. Among other expansive updates, the 32 bit Dual Core microcontroller still supports WiFi, but also Bluetooth Low Energy, a DAC, many more ADCs, GPIO pins, etc. etc. Lots of good details here: http://esp32.net/ 

Continue reading

ESP8266 CAN Bus with MCP2515

I have just bought another ESP8266/NodeMCU development board cheapy from eBay (this one) with an ESP-12E chip on board. I’ve also bought an SPI-CAN bus interface with the common Microchip MCP2515 CAN controller to try and create a CAN-Wifi gateway.

The pinout for the ESP-12E NodeMCU board is apparently as below:
ESP-12E NodeMCU Pinout

Continue reading

ESP8266 Lua DHT11 Temperature and Humidity Sensor

After receiving my ESP8266 Development/breakout board I have been attempting to create a WiFi enabled thermostat to control my central heating from my mobile phone and give me a means of timer programming my central heating. To be a true thermostat requires a temperature sensor. The ESP8266 board came with a DHT11 sensor and already has pins directly compatible with one. I therefore just required the software to interface with it.

Continue reading

ESP8266 Useful Links

ESP8266 Flasher Tool: https://github.com/nodemcu/nodemcu-flasher/blob/master/Win32/Release/ESP8266Flasher.exe

Latest nodeMCU firmware: https://github.com/nodemcu/nodemcu-firmware/blob/master/pre_build/latest/nodemcu_latest.bin

Benlo.com LuaLoader for NodeMCU files and ESP8266 configuration:
http://benlo.com/esp8266/

Simple ESP8266 GPIO Websserver:
http://www.esp8266.com/viewtopic.php?f=19&t=611

ESP 8266 Development Board Schematic:
http://www.bpower.nl/pic/ESP-201-DEV-bw.png

Write up of the ESP8266 Development Board:
http://myesp8266.blogspot.de/2015/03/other-interesting-board-is-this-board.html

ESP8266 Development Board Update

I have now determined that The DIP switch no 8 does indeed connect GND to GPIO pin 0, and switch S2 is also connected to the same pin. This means that to put the board into reprogramming mode to reflash the ESP8266, the DIP switch 8 should be ON (or hold down S2, but probably not a good idea)

Switch S3 connects GND to GPIO Pin 2.

 

ESP8266 Development/Breakout board Arrived

Warning: do not connect the DHT11 temperature sensor as indicated in the eBay pictures, it is the wrong way around and will fry your board!

I’ve just received my ESP8266 development/SDK board in the post and am now starting to try and work out what everything on it does.

With Relay, RGB LED, Serial to USB chip, DHT11 temperature and humidity sensor, buzzer, and switches

With Relay, RGB LED, Serial to USB chip, DHT11 temperature and humidity sensor, buzzer, and switches

Continue reading

ESP8266 Development/SDK Board

Warning: do not connect the DHT11 temperature sensor as indicated in the eBay pictures, it is the wrong way around and will fry your board!

Update: Board has arrived, more details and pinout here

It would seem that the ESP8266 is quickly becoming a pretty well supported WiFI microcontroller within the DIY/hacker community, and certainly presents itself as a pretty good alternative to an Arduino for projects requiring simple IO and WiFi. There’s even a project looking at using compiling the Arduino IDE and compatible code for the ESP8266!

Chinese ESP8266 Breakout board

Chinese ESP8266 Breakout board

I have one of the original versions of these units, but ave struggled to get anything sensible out of it, and so was looking on Ebay for some more items and came across this breakout/development board. For £9.99 I thought I’d give it a go, and ordered it a couple of weeks ago. Will give more details when it arrives. More details and pics after the break

Continue reading