Moderator: igrr
martinayotte wrote:There is a small graph about the flash layout :
https://github.com/esp8266/Arduino/blob ... ash-layout
Is your ESP has 512K or more ? Old ESP-12 have 512K, newer ones have 4M.
Because, effectively, if you have a 512K, you can not do OTA with sketch of that size.
Hello,
Here is some news about OTA:
Now i work on linux (lubuntu 14.10).
I use Arduino 1.6.10
I use stable librairies.
Here is my code :
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
const char* ssid = "aaaaaaaaa";
const char* password = "bbbbbbbbbb";
boolean OTAProgress = false;
#define HOSTNAME "WiWiRe-OTA-"
char* strToChar(String s) {
unsigned int bufSize = s.length() + 1; //String length + null terminator
char* ret = new char[bufSize];
s.toCharArray(ret, bufSize);
return ret;
}
void setup() {
Serial.begin(115200);
Serial.println("Booting");
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Connection Failed! Rebooting...");
delay(5000);
ESP.restart();
}
// Port defaults to 8266
ArduinoOTA.setPort(8266);
Serial.println("\r\n");
Serial.print("Chip ID: 0x");
Serial.println(ESP.getChipId(), HEX);
// Set Hostname.
String hostname(HOSTNAME);
hostname += String(ESP.getChipId(), HEX);
WiFi.hostname(hostname);
// Print hostname.
Serial.println("Hostname: " + hostname);
//Serial.println(WiFi.hostname());
// Hostname defaults to esp8266-[ChipID]
ArduinoOTA.setHostname(strToChar(hostname));
// No authentication by default
//ArduinoOTA.setPassword((const char *)"xxxxxx");
Serial.printf("Taille du programme : %u\n", ESP.getSketchSize());
Serial.printf("Taille disponible : %u\n", ESP.getFreeSketchSpace());
Serial.printf("Taille du chipset : %u\n", ESP.getFlashChipSize());
Serial.printf("Taille réelle du chipset : %u\n", ESP.getFlashChipRealSize());
Serial.printf("Type de mémoire du chipset : %u\n", (ESP.getFlashChipId(), HEX));
ArduinoOTA.onStart([]() {
Serial.println("Start");
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
Serial.println("\nWaiting for reboot .");
pinMode(2,OUTPUT);
digitalWrite(2,HIGH);
int i;
int n;
// Code to get some value of "n"
for (i = 0; i < 8; i++) {// Loop to do "something" n times
Serial.print(".");
pinMode(2,OUTPUT);
digitalWrite(2,HIGH);
delay(500);
Serial.print(".");
digitalWrite(2,LOW);
delay(500);
}
ESP.restart();
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
if (OTAProgress != true){
//Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
Serial.printf("Progress: .");
OTAProgress = true;
} else {
Serial.printf(".");
}
});
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 loop() {
ArduinoOTA.handle();
yield();
}
I lauch update with :
sudo python /home/sxx/esptool/espota.py -i 192.168.1.21 -f "/home/sxx/Arduino Projects/BasicOTA/BasicOTA.ino.generic.bin" -r -d
19:03:52 [INFO]: Starting on 0.0.0.0:42342
19:03:52 [INFO]: Upload size: 250832
19:03:52 [INFO]: Sending invitation to: 192.168.1.21
19:03:52 [INFO]: Waiting for device...
Uploading: [= ] 1%
19:04:02 [ERROR]: Error Uploading
Here is debug /dev/ttyUSB0
Chip ID: 0xD58
Hostname: xxxxx-OTA-d58
Taille du programme : 250832
Taille disponible : 2891776
Taille du chipset : 4194304
Taille réelle du chipset : 4194304
Type de mémoire du chipset : 16
Ready
IP address: 192.168.1.21
Start
Progress: ...
Soft WDT reset
ctx: cont
sp: 3ffef9f0 end: 3ffefcc0 offset: 01b0
>>>stack>>>
3ffefba0: 00000000 4000444e 0000000c 00000000
I can't get it work correctly ....
If you have any idea ....
Thanks,
Best regards
Windows 10
Arduino IDE 1.6.13
ESP8266 2.3-RC-2 + git ESP8266 core
Me-no-dev wrote:can you OTA upload through the IDE?
Not at all,
IDE always ask me for a password (wich is not set)
Heres is what i tried on IDE :
Board V1.6.5xxx
Board 2.0
Board 2.1
Board 2.2
Board 2.3
Board 2.3RC2
ESP8266 dev board
I tried with ESP07, ESP12F ESP14
Whatever i always get error pending upload , but not at same time , sometime 1% , sometime 25%
I also tried with windows , but .... i cant get python working well
Is there something i mess ?
Windows 10
Arduino IDE 1.6.13
ESP8266 2.3-RC-2 + git ESP8266 core