Page 1 of 1

Flash ESP32 programmatically using Java/Android

Posted: Mon Jan 13, 2020 8:22 pm
by macieljr
Hi guys!

I’m developing an Android app that is directly connected via USB to consume data from an ESP32 with sensors attached. I’m using https://github.com/felHR85/UsbSerial to manage the connection. Since the app will be running on an internet connected tablet, I think it’s obvious to update ESP32 code, if needed, through the app, giving the user an option do download it (.bin) and then upload it to ESP32.

But I have no idea how...

Tried searching for and Android/Java lib, but I wonder it can be done by the same lib I’m using to establish the serial communication already.

So, If you have done such thing or know how to do and/or can point some direction, please share it with me.

Kind regards,

Vicente Maciel Jr

Re: Flash ESP32 programmatically using Java/Android

Posted: Fri Jan 17, 2020 6:55 pm
by gunar.kroeger
To upload the .bin to the esp you would need to control the reset and the boot pins as well. Then you can transfer the .bin through uart0 using the SLIP interface. There is the python program that does this called esptool.py that comes with esp-idf.

The second, easier option, is to use the OTA example and change it to use uart instead of http. This way you can update the esp, but the first time you will have to flash it with a PC.

Re: Flash ESP32 programmatically using Java/Android

Posted: Sat Jan 18, 2020 3:08 am
by macieljr
First, thank you so much for the reply!

I’ll look for some references regarding the tips you mentioned and try them.

I’ll post the results here. Or the questions, if I have. Thank you again!

Kind regards,

Vicente Maciel Jr

Re: Flash ESP32 programmatically using Java/Android

Posted: Fri Jun 12, 2020 8:18 pm
by drradao
Hi!

Did you have any success?

I've tried to flash it with python via chaquopy but got stuck at a permission denied.
I'm going to try to request it from python.

Thanks!

Re: Flash ESP32 programmatically using Java/Android

Posted: Tue Aug 10, 2021 7:07 am
by raymondshi
Hi there,

I come across the posts here today, and am also very interested on flashing ESP32 over the serial connection in Android app.

From what I read on https://github.com/espressif/esptool/wi ... -Selection, seems like this can be achieved as follows,

1. Android app instructs ESP32 app to set GPIO0 to low, as well as reset itself
2. Android app sends the new ESP32 binary image on the serial connection

Just wondering if anyone has managed to get this (or something similar) working end-to-end, is willing to share it.

Best regards
Raymond

Re: Flash ESP32 programmatically using Java/Android

Posted: Mon Oct 10, 2022 3:27 pm
by bdureau
Hello
For those interested I did a quick port of the ESPtool to Java that works for the ESP32
https://github.com/bdureau/ESPLoader
I also did a port to Android using Physicaloid
https://github.com/bdureau/BearConsole2 ... sole/Flash
However it needs improvement, I have added some timers so that it worked .... but is is slow!!!!
I also have some issues with Android for entering bootloader mode and doing a reset (workaround is to use the button on the board). If someone could help to fix those that would be appreciated
Regards
Boris