8266-01 with 4m flash trying to get OTA to work

Good afternoon all
I tried to get OTA to work on the little 8266 – 01 sometimes it compiles with no errors but other times it comes up with:

15:19:54 [INFO]: Starting on 0.0.0.0:58007
15:19:54 [INFO]: Upload size: 382704
15:19:54 [INFO]: Sending invitation to: 192.168.1.111
15:19:54 [ERROR]: Bad Answer: ERR: ERROR[4]: Not Enough Space

I think I need to tell platformio to increase the memory size, I have had a good poke around Google and tried one or two examples but obviously I’m still doing something wrong.
If I keep an identical code and upload it to a standard 8266 it appears to work fine.

Please can somebody point me in the right direction.
Thank you in advance for your time.

[env:esp12e]
platform = espressif8266
;board = esp07s
board = esp01_1m
;board = esp12e
framework = arduino
;board_build.flash_mode = dout
upload_speed=921600
monitor_speed = 115200
upload_protocol = espota
upload_port=192.168.1.111
lib_deps=
   TaskScheduler
   sparkfun/SparkFun SHTC3 Humidity and Temperature Sensor Library @ ^1.1.3
   ThingSpeak
   ESP8266_SSD1306
#include <Arduino.h>
#include "Wifi_Setup.h"
#include "main_Setup.h"
#include <ArduinoOTA.h>

IPAddress ip(192, 168, 1, 111);
IPAddress gateway(192, 168, 1, 254);    // Set your network Gateway usually your Router base address
IPAddress subnet(255, 255, 255, 0); 
IPAddress dns(192,168,1,254); 
const char* WLAN_SSID = "BTHub6";
const char* WLAN_PASSWD = "************************";

unsigned long myChannelNumber1 =  1**********So what is it might be;
const char *myWriteAPIKey1 = "**************";

String webpage="";
//long Rssi=0;
int SensorNumber =0;
String UploadData="";

bool rtcValid = false;
//WiFiClient client;
ESP8266WebServer server(80);

//######################  HTML INPUT ##########################################  
void Web_Listen(){
server.handleClient();
}
//###########################################################################
//#####################################################################################################
void WiFi_ON(){
  WiFi.forceSleepWake();
  delay( 1 );
  WiFi.config(ip, dns, gateway, subnet);
  WiFi.persistent( false );   // Disable the WiFi persistence.  The ESP8266 will not load and save WiFi settings unnecessarily in the flash memory.
  WiFi.begin(WLAN_SSID,WLAN_PASSWD);
  Rssi = WiFi.RSSI();             //Detect and print signal strength
  Serial.print("RSSI:");
  Serial.println(Rssi);

  server.on("/",        homepagePL);
  server.on("/test", []()  {server.send(200, "text/plain", "Server status is OK"); }); // Simple server test by providing a status response
  server.on("/homepage", homepagePL);
  server.begin();
  
ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH)
      type = "sketch";
    else // U_SPIFFS
      type = "filesystem";

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    Serial.println("Start updating " + type);
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
    else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
    else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
    else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
    else if (error == OTA_END_ERROR) Serial.println("End Failed");
  });
  ArduinoOTA.begin();
  Serial.println("Ready");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
}
//#################################################################################################
void OTA() {
ArduinoOTA.handle();
}
//###################################################################################################
void rssi(){
  int xx=0;
  Rssi = WiFi.RSSI();
  Serial.print("RSSI:");
  Serial.println(Rssi);
  ThingSpeak.setField(7,Rssi );
  xx=ThingSpeak.writeFields(myChannelNumber1, myWriteAPIKey1);

  if(xx ==200){
    t1_disable(); 
  }
  else{
    t1_enable();
  }
}

With this config you’re telling PIO that you’re using an ESP8266 with 1MByte of flash.

So if you do have a board with 4Mbyte of flash it’s best to directly choose a board = value that has 4MB. See PlatformIO Registry and search for “ESP8266” in the MCU column and sort by flash size. You could e.g. use a standard board = nodemcuv2 config.

Otherwise you can configure the flash size as seen in docs by controlling which linker script is used, from the available ones at Arduino. For a 1MB application(s), and 1 MB SPIFFS allocation you can e.g. choose board_build.ldscript = eagle.flash.4m1m.ld
.

Thank you for the information above, but I must be doing something wrong yet again.
Here is my .ini file

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp12e]
platform = espressif8266
board_build.ldscript = eagle.flash.4m1m.ld
;board = esp07s
;board = esp01_1m
;board = esp12e
framework = arduino
;board_build.flash_mode = dout
upload_speed=921600
monitor_speed = 115200
;upload_protocol = espota
;upload_protocol = esptool
;upload_port=192.168.1.111
lib_deps=
   TaskScheduler
   sparkfun/SparkFun SHTC3 Humidity and Temperature Sensor Library @ ^1.1.3
   ThingSpeak
   ESP8266_SSD1306

this is the error I am now receiving how do I define the board?
I seem to be missing this step. Sorry for troubling you yet again.


Processing esp12e (platform: espressif8266; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
Error: BoardConfig: Board is not defined
================================================ [FAILED] Took 0.40 seconds ================================================
The terminal process "C:\Users\Paul\.platformio\penv\Scripts\pio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

You’ve commented out all board = .. expressions now, but one has to still be on. Either use board = nodemcuv2 (example) without the ldscript directive or keep board = esp01_1m while also keeping the ldscript directive.

Sorry about that, it is now working fine thank you.
PS if I try using the board = nodemcuv2 I cannot programme the board using one of these devices

doesn’t really matter as the other way works just wondering why?

Ah then keep board = esp01_1m with the ldscript definition. The reason why it’s not working with the nodemcuv2 board is because it’s defaulting to a different reset method (to get the chip into bootloader mode).

That’s

vs

Or keep nodemcu and add another line with board_upload.resetmethod = ck to match the behavior of the esp01_m board.

1 Like

Maxgerhardt
Again thank you very much for your clear and understandable replies.
I learned something new every day, and you’ve certainly been a great help today.

Thank you