Flash ESP32 programmatically using Java/Android

macieljr
Posts: 5
Joined: Mon Jan 13, 2020 7:31 pm

Flash ESP32 programmatically using Java/Android

Postby macieljr » Mon Jan 13, 2020 8:22 pm

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

User avatar
gunar.kroeger
Posts: 143
Joined: Fri Jul 27, 2018 6:48 pm

Re: Flash ESP32 programmatically using Java/Android

Postby gunar.kroeger » Fri Jan 17, 2020 6:55 pm

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.
"Running was invented in 1612 by Thomas Running when he tried to walk twice at the same time."

macieljr
Posts: 5
Joined: Mon Jan 13, 2020 7:31 pm

Re: Flash ESP32 programmatically using Java/Android

Postby macieljr » Sat Jan 18, 2020 3:08 am

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

drradao
Posts: 1
Joined: Fri Jun 12, 2020 8:13 pm

Re: Flash ESP32 programmatically using Java/Android

Postby drradao » Fri Jun 12, 2020 8:18 pm

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!

raymondshi
Posts: 6
Joined: Fri Jul 09, 2021 2:46 am

Re: Flash ESP32 programmatically using Java/Android

Postby raymondshi » Tue Aug 10, 2021 7:07 am

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

bdureau
Posts: 1
Joined: Mon Oct 10, 2022 2:27 pm

Re: Flash ESP32 programmatically using Java/Android

Postby bdureau » Mon Oct 10, 2022 3:27 pm

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

Who is online

Users browsing this forum: Baidu [Spider] and 200 guests