Open vovagorodok opened 2 years ago
@vovagorodok,
If you take a look at: https://github.com/fbiego/ESP32_BLE_OTA_Arduino/blob/fa90638f2997d7965880c2cd6aca1e9b05c83ba2/esp32_ble_ota_lib_compact/ota_updater.py#L26-L175
Reading the above, you will have a rough idea of how the process works (I'm using a slightly different method compared to the main code).
As you can see, no security mechanism has been implemented in the code. No pin code for the pairing, no checksum at the end of the upload, no version number hard-coded—sometimes, I had a version date and git version hash at compilation time, but not here —, etc. That could also be something to implement in your library.
I do not have much time to help you at the moment, but I like your idea, even if there are still some mechanisms to be thought.
Regards, Vincent
Ok, just let me know if you find corner case or bug in my considerations. Will be nice to implement minimal working version and than extend it. For example checksum can be added in future by optional command:
-> CHECKSUM <checksum>
<- OK
before INSTALL
command. And developer of mobile app will decide if send it or not. But lets consider it after basic implementation.
I am also interested in @fbiego's point of view
Hi guys,\ New library created: https://github.com/vovagorodok/ArduinoBleOTA \ It has built in checksum integrity protection and software/hardware type/version indication.\ Security/Authorization protection decided to not implement here, because it can be implemented as separate library (for whole bluetooth connection, not for one OTA service).
Library can be simply added to any project like this:\ https://github.com/vovagorodok/ArduinoBleOTA/blob/main/examples/basic/main.ino Or if there is any additional service:\ https://github.com/vovagorodok/ArduinoBleOTA/blob/main/examples/multiservice/main.ino
Next steps:
samd
and other using ArduinoBLE library)According to step 2.\ Achieved ~12kB/s (usually ~10kB/s) even on default.csv. Now data partition type doesn't meter, because uploading does directly to ota partition. Problem was only on bluetooth side, because responses was sent after each package. I'll update main branch tomorrow
Step 1. Done. Added new (not esp32
/NimBLE-Arduino lib
) platforms like samd,megaavr,mbed,apollo3,mbed_nano,mbed_portenta,mbed_nicla
based on ArduinoBLE
library. Plans to add stm32
and other
Step 2. Done. Works fine with BLE_OTA_ATTRIBUTE_SIZE=512
and BLE_OTA_BUFFER_SIZE~=512 * 10
. Can be tuned or buffer can be completely disabled in order to save static memory: https://github.com/vovagorodok/ArduinoBleOTA/blob/main/doc/ADVANCED.md
Step3. Still open
I was referred to this URL on BLE performance.. https://punchthrough.com/ble-throughput-part-4/ one reported 50k/sec thruput..
Thanks for Your fullstack solution (from esp32 to android app)! I have forked this repository in order to create PlatformIO Arduino library: https://github.com/vovagorodok/ArduinoBleOTA
At the and will be nice to move it to: https://github.com/arduino-libraries
I'm trying to make it as simple as possible with reusing of NimBLE-Arduino and ArduinoOTA(support only WIFI) libraries. Proposed interface will be similar to ArduinoOTA:
Or if bluetooth is used not only for OTA:
Additionally I have plan to add support of Atmel based boards using ArduinoBLE library.
I see that @Vincent-Stragier begin with that. Lets connect our forces and create easy library with simple/lightweight protocol.
Draft protocol proposal will have small number of commands (names and numbers can be another like 0x01 or 0xFE):
Designations for examples:\
->
- recived from phone\<-
- send to phoneSunny day scenario:
Size to big:
Connection terminated:
Unexpected package:
Instalation error:
I thing that most/all corner cases are covered or something is missed? @fbiego can you describe scenarios(corner cases) that are currently covered with command names (because from code I see some magic numbers 0xFB, 0xFC, 0xFD, FE ..)? What do you think generally about this idea?
Thanks!