Here I made a short demo movie. All of firmware is uploaded through OTA (over the air), The case of nRF, firmware uploading is quite safe because boot loader and application are separated in memory, but the case of ESP32, the OTA code and user code are mixed up in the program and it's very, very easy to make it BRICK (lose control, turns into static object..)
Here is the way to make it brick in ESP32 OTA
void loop() {
ArduinoOTA.handle();
pinMode(LED, HIGH);
delay(1000);
pinMode(LED, LOW);
delay(1000);
}
The function, "ArduinoOTA.handle()" must be kept in running in loop function but blinking LED (especially delay() function) will interrupt its operation. Once this code is uploaded through OTA, it will "brick" the module and we need wired firmware uploading (but in the epoxy, no way.)
The correct way is, (not the only way, just example)
void loop() {
ArduinoOTA.handle();
long int hoge=millis();
if(hoge%1000==0){
digitalWrite(LED,HIGH);
}
if(hoge%1500==0){
digitalWrite(LED,LOW);
}
Taking a time from mills() and delay() should never be used in loop function. This case ArduinoOTA.handle() keeps running and sometimes LED will switch HIGH and LOW.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Can we get some details on the epoxy that you used? I would love to do something similar on one of my projects.
Are you sure? yes | no
I don't know for sure, but I think the ESP32 OTA mode will let you upload code to one area of memory which it then reboots and runs from the new code when it is updated. So the original code is still there and you just need a way to run it. What about setting up something like a magnetic reed switch to trigger it to go back to a known good bootloader?
Are you sure? yes | no