Closed DonatelloX closed 2 years ago
hi thanks for your feedback,
Espressif Arduino core for the ESP32: 2.0.6
can't find this version, the highest currently available is 2.0.5
some thoughts:
don't include BluetoothSerial with quotes but with brackets:
#include <BluetoothSerial.h>
you don't need that, esp32fota pulls the wifi library
#include <stdio.h>
#include <stdlib.h>
#include <Wire.h>
#include <WiFi.h>
this should be in your setup() not in your loop()
SerialBT.begin("BLE NAME");
Have you tried LittleFS instead of SPIFFS? uses the same syntax and may solve some memory issues
#include <SPIFFS.h>
Tobozo, thank you for reply!
The sketch is a part of my code where I use
I wrote the sketch better:
#include <BluetoothSerial.h>
#include <stdio.h>
#include <stdlib.h>
#include <Wire.h>
#include <LittleFS.h>
#include <esp32fota.h>
BluetoothSerial SerialBT;
#define FW_URL_UPGRADE "https://www.mysite.com/fota/fota.json"
// WiFi credentials
const char *ssid = "MySSID";
const char *password = "P@ssword";
// esp32fota esp32fota("<Type of Firmware for this device>", <this version>, <validate signature>, <allow insecure https>);
esp32FOTA esp32FOTA("esp32-fota-http", 100, false, true);
void setup()
{
//esp32FOTA.setManifestURL( FW_URL_UPGRADE );
Wire.begin();
Wire.setClock(100000);
Serial.begin(115200);
delay(3000);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println(WiFi.localIP());
SerialBT.begin("BLE NAME");
esp32FOTA.checkURL = FW_URL_UPGRADE;
bool updatedNeeded = esp32FOTA.execHTTPcheck();
if (updatedNeeded)
{
esp32FOTA.execOTA();
} else {
Serial.println("no update");
}
}
void loop()
{
while(1);
}
If I try to delete SerialBT.begin ("BLE NAME") everything works. If I try to move SerialBT.begin ("BLE NAME") after esp32FOTA.execHTTPcheck() Bluetooth and WiFi don't work while esp32FOTA.execHTTPcheck() works.
These are the debug messages:
[ 4101][I][esp32FOTA.cpp:709] execHTTPcheck(): Getting HTTP: https://www.mysite.com/fota/fota.json
[ 4110][I][BluetoothSerial.cpp:571] esp_bt_gap_cb(): ESP_BT_GAP_CONFIG_EIR_DATA_EVT: stat:0 num:4
[ 4113][I][esp32FOTA.cpp:710] execHTTPcheck(): ------
[ 4127][I][esp32FOTA.cpp:302] setupHTTP(): Connecting to: https://www.mysite.com/fota/fota.json
[ 4122][I][BluetoothSerial.cpp:397] esp_spp_cb(): ESP_SPP_START_EVT
[ 4136][V][HTTPClient.cpp:252] beginInternal(): url: https://www.mysite.com/fota/fota.json
[ 4150][D][HTTPClient.cpp:303] beginInternal(): protocol: https, host: www.mysite.com port: 443 url: /fota/fota.json
[ 4160][D][HTTPClient.cpp:598] sendRequest(): request type: 'GET' redirCount: 0
[ 4167][V][ssl_client.cpp:62] start_ssl_client(): Free internal heap before TLS 69820
[ 4175][V][ssl_client.cpp:68] start_ssl_client(): Starting socket
[ 4469][V][ssl_client.cpp:149] start_ssl_client(): Seeding the random number generator
[ 4474][D][ssl_client.cpp:179] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
[ 4482][V][ssl_client.cpp:257] start_ssl_client(): Setting hostname for TLS session...
[ 4490][V][ssl_client.cpp:272] start_ssl_client(): Performing the SSL/TLS handshake...
[ 7721][V][ssl_client.cpp:293] start_ssl_client(): Verifying peer X.509 certificate...
[ 7721][V][ssl_client.cpp:301] start_ssl_client(): Certificate verified.
[ 7724][V][ssl_client.cpp:316] start_ssl_client(): Free internal heap after TLS 26072
[ 7732][D][HTTPClient.cpp:1156] connect(): connected to www.mysite.com:443
[ 7739][V][ssl_client.cpp:369] send_ssl_data(): Writing HTTP request with 158 bytes...
[ 8099][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Server: aruba-proxy'
[ 8102][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Date: Mon, 17 Oct 2022 07:53:50 GMT'
[ 8110][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Content-Type: application/json'
[ 8119][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Content-Length: 132'
[ 8126][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Connection: keep-alive'
[ 8133][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Last-Modified: Sun, 16 Oct 2022 11:04:38 GMT'
[ 8143][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Accept-Ranges: bytes'
[ 8150][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'X-ServerName: ipvsproxy135.ad.aruba.it'
[ 8159][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: ''
[ 8165][D][HTTPClient.cpp:1307] handleHeaderResponse(): code: 200
[ 8170][D][HTTPClient.cpp:1310] handleHeaderResponse(): size: 132
[ 8176][D][HTTPClient.cpp:628] sendRequest(): sendRequest code=200
[ 8183][D][HTTPClient.cpp:388] disconnect(): still data in buffer (1), clean up.
[ 8190][D][HTTPClient.cpp:393] disconnect(): tcp keep open for reuse
[ 8196][I][esp32FOTA.cpp:603] checkJSONManifest(): Payload type in manifest esp32-fota-http matches current firmware esp32-fota-http
[ 8208][D][esp32FOTA.cpp:610] checkJSONManifest(): JSON version: 201 (int)
[ 8214][I][esp32FOTA.cpp:830] debugSemVer(): Payload firmware version: 201.0.0
[ 8222][I][esp32FOTA.cpp:654] checkJSONManifest(): JSON manifest provided keys: url=false, host: true, port: true, bin: true, fs: []
[ 8233][I][esp32FOTA.cpp:408] execOTA(): This update is for U_FLASH only
Opening item https://www.mysite.com:443/fota/fota201.bin
[ 8250][I][esp32FOTA.cpp:302] setupHTTP(): Connecting to: https://www.mysite.com:443/fota/fota201.bin
[ 8254][V][HTTPClient.cpp:252] beginInternal(): url: https://www.mysite.com:443/fota/fota201.bin
[ 8262][D][HTTPClient.cpp:303] beginInternal(): protocol: https, host: www.mysite.com port: 443 url: /fota/fota201.bin
[ 8273][D][HTTPClient.cpp:598] sendRequest(): request type: 'GET' redirCount: 0
[ 8280][D][HTTPClient.cpp:1116] connect(): already connected, reusing connection
[ 8288][V][ssl_client.cpp:369] send_ssl_data(): Writing HTTP request with 159 bytes...
[ 8448][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'HTTP/1.1 200 OK'
[ 8448][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Server: aruba-proxy'
[ 8451][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Date: Mon, 17 Oct 2022 07:53:51 GMT'
[ 8460][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Content-Type: application/octet-stream'
[ 8469][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Content-Length: 1675824'
[ 8477][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Connection: keep-alive'
[ 8484][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Last-Modified: Sat, 25 Jun 2022 11:11:40 GMT'
[ 8494][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Accept-Ranges: bytes'
[ 8501][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'X-ServerName: ipvsproxy135.ad.aruba.it'
[ 8510][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: ''
[ 8515][D][HTTPClient.cpp:1307] handleHeaderResponse(): code: 200
[ 8521][D][HTTPClient.cpp:1310] handleHeaderResponse(): size: 1675824
[ 8527][D][HTTPClient.cpp:628] sendRequest(): sendRequest code=200
This server supports resume! Accept-Ranges: bytes
[ 8544][D][esp32FOTA.cpp:903] getHTTPStream(): updateSize : 1675824, contentType: application/octet-stream
[ 8547][D][esp32FOTA.cpp:443] execOTA(): compression: disabled
[ 8553][D][Updater.cpp:133] begin(): OTA Partition: app1
[ 8558][E][Updater.cpp:164] begin(): malloc failed
Not enough space to begin OTA, partition size mismatch?
[ 8573][D][HTTPClient.cpp:388] disconnect(): still data in buffer (16110), clean up.
[ 8575][D][HTTPClient.cpp:393] disconnect(): tcp keep open for reuse
[ 22747][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: MySSID, BSSID: e8:94:f6:40:c7:ae, Reason: 200
[ 22748][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 22755][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 200 - BEACON_TIMEOUT
[ 22762][D][WiFiGeneric.cpp:966] _eventCallback(): WiFi Reconnect Running
[ 22770][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[ 24483][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: MySSID, BSSID: 00:00:00:00:00:00, Reason: 201
[ 24483][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
...
I read Not enough space to begin OTA, partition size mismatch? but only if use SerialBT.begin ("BLE NAME"). My partition scheme is Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS). I try with default scheme but this sketch is too big.
lol this got me saying "WTF" out loud
void loop()
{
while(1);
}
I suppose it's empty because you removed the proprietary code before pasting the snippet, however it's very likely the problem is there.
OTA failed because the memory was already exhausted when it was called:
[ 8558][E][Updater.cpp:164] begin(): malloc failed
as a consequence esp32fota failed with an error message, but the problem isn't with esp32fota
your project just hit the limits of your device and these are the symptoms,
possible solutions:
I'll close this issue as there's nothing the esp32fota library can do to solve it.
Feel free to add updates on your situation though.
I have found a solution: Use esp32FOTA 0.1.6 version downloaded from the repository and manually installed in Arduino. While SerialBT.begin("BLE NAME") must be used later esp32FOTA.execHTTPcheck().
@chrisjoyce911 @tobozo Please, can you add version 0.1.6 of esp32FOTA in Arduino Library? This version solves my memory problems and works with https without root. Thank you
see this issue the 0.1.6 contains a symlink
I'll try to delete and re-create the tag, wish me luck :)
ok I had to rename the existing tag, checkout the tag, delete the symlinks, create a separate branch to hold the commit, then create a new tag and finally associate the 0.1.6 release to that tag
I'm not sure how the registries will handle that, but the tarballs for this release don't have symlinks anymore
let's see how they manage this "back to the future" situation :-)
Thank you so much!
Arduino board: ESP32 Dev kit Arduino IDE version: 2.00 Espressif Arduino core for the ESP32: 2.0.6 esp32FOTA version: 0.2.3
Arduino Sketch:
Problem: If I use SerialBT.begin("BLE NAME") (please see the code above) BEFORE the esp32FOTA.execHTTPcheck() has problems, I believe, with heap stack space. If I use SerialBT.begin("BLE NAME") (please see the code above) AFTER the esp32FOTA.execHTTPcheck(), Bluetooth and WiFi are not working.
Please, how can you fix this?