Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Samighi11
#29973 I won't have much time to play w ota for the next two weeks, but if someone can point me to a definitive guide on ota, I would appreciate that. As in how to make any sketch or nodemcu/esp be prepetually ota enabled.

I can devise some simple server code for the esp to consume.

Come to think of it, the esp doesn't need to ask for the update. It can be pushed to it. So think about that also. Ask the esp for version, push if you need to might be easier.
User avatar
By willfly
#30026
Samighi11 wrote:lmac.c 662


I pointed to this in another thread. Espressif libraries throw this exception when interrupts are disabled for more then 10us. Presumably it is fixed in the beta version of IDE. If you want to fix it manually, comment out noInterrupts() line in bool UpdaterClass::_writeBuffer(){ in file Arduino15\packages\esp8266\hardware\esp8266\**\cores\esp8266\Updater.cpp. OTA will start working after this.
User avatar
By Samighi11
#30115
willfly wrote:
Samighi11 wrote:lmac.c 662


I pointed to this in another thread. Espressif libraries throw this exception when interrupts are disabled for more then 10us. Presumably it is fixed in the beta version of IDE. If you want to fix it manually, comment out noInterrupts() line in bool UpdaterClass::_writeBuffer(){ in file Arduino15\packages\esp8266\hardware\esp8266\**\cores\esp8266\Updater.cpp. OTA will start working after this.


I gave this a try with no luck. Still running CURL -F to get the BIN loaded.

Modified Updater.cpp code (I commented NoInterrupts twice. I closed the IDE and ensure the Updater.cpp was complied again. (I made a syntax error on purpose to ensure the update would take, and complier complained, so I know it was the right file)

Code: Select allbool UpdaterClass::_writeBuffer(){
  // noInterrupts();
  int rc = SPIEraseSector(_currentAddress/FLASH_SECTOR_SIZE);
  interrupts();
  yield();
  if(!rc){
   // noInterrupts();
    rc = SPIWrite(_currentAddress, _buffer, _bufferLen);
    interrupts();
  }
  interrupts();
  if (rc) {
    _error = UPDATE_ERROR_WRITE;
    _currentAddress = (_startAddress + _size);
#ifdef DEBUG_UPDATER
    printError(DEBUG_UPDATER);
#endif
    return false;
  }
  _currentAddress += _bufferLen;
  _bufferLen = 0;
  return true;
}


Serial output (NodeMCU .9) (if it had updated, it would say V2.0)

Code: Select allBooting Sketch...
Ready! Open http://esp8266-webupdate.local in your browser v1.0
Update: Webupdate.cpp.bin

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld

Booting Sketch...
Ready! Open http://esp8266-webupdate.local in your browser v1.0


I can continue to work on this as needed or wait till 1.6.6 IDE comes out (should I uninstall and reinstall ESP board support?)
User avatar
By Anand Lobo
#30232 For clarity, I am using a generic ESP-12E board to which I manually soldered wires to plug into a breadboard (since the pin spacing is smaller, 2mm instead of the usual 2.54mm). I'm using the Arduino IDE 1.6.5

Samighi11 wrote:Come to think of it, the esp doesn't need to ask for the update. It can be pushed to it. So think about that also. Ask the esp for version, push if you need to might be easier.

It seems to me that the webUpdate sketch and the curl -F command might seem the best way. I used the OTA sketch but it requires that the listening subroutine must always be running, and if your program engages in another task or a delay() and you push the update, it misses it. However, using the webUpdate example, it nearly always seems to work as long as the line server.handleClient() is regularly called. It's worked for me, anyway. Perhaps I'm lucky.