Hi community…
I am working with esp32 and i want to do a fota update by using the ethernet cable
as suggested in this example…
This is my code…
#include <esp32fota.h>
#include "automatic_ota.h"
#include <ESP32-ENC28J60.h>
const char *firmware_name = "esp32-fota-http";
const bool check_signature = false;
const bool disable_security = true;
#define SPI_HOST 1
#define SPI_CLOCK_MHZ 20
#define INT_GPIO 4
#define MISO_GPIO 12
#define MOSI_GPIO 13
#define SCLK_GPIO 14
#define CS_GPIO 15
int firmware_version_major = 1;
int firmware_version_minor = 0;
int firmware_version_patch = 0;
esp32FOTA FOTA; // empty constructor
static bool eth_connected = false;
// using WiFiEvent to handle Ethernet events :-)
void WiFiEvent(WiFiEvent_t event)
{
switch (event)
{
case ARDUINO_EVENT_ETH_START:
Serial.println("ETH Started");
ETH.setHostname("esp32-ethernet");
break;
case ARDUINO_EVENT_ETH_CONNECTED:
Serial.println("ETH Connected");
break;
case ARDUINO_EVENT_ETH_GOT_IP:
Serial.printf("ETH MAC: %s, IPv4: %s%s, %dMbps\n", ETH.macAddress().c_str(), ETH.localIP().toString().c_str(), ETH.fullDuplex() ? ", FULL_DUPLEX" : "", ETH.linkSpeed());
eth_connected = true;
break;
case ARDUINO_EVENT_ETH_DISCONNECTED:
Serial.println("ETH Disconnected");
eth_connected = false;
break;
case ARDUINO_EVENT_ETH_STOP:
Serial.println("ETH Stopped");
eth_connected = false;
break;
default:
break;
}
}
static bool EthernetConnected()
{
return eth_connected;
}
/**
* @brief Function to do the setup for the ota
* @param None
* @retval None
*/
void Setup_automatic_ota(void)
{
Serial.begin(115200);
{
auto cfg = FOTA.getConfig();
cfg.name = firmware_name;
cfg.manifest_url = FOTA_URL;
cfg.sem = SemverClass(firmware_version_major, firmware_version_minor, firmware_version_patch);
cfg.check_sig = check_signature;
cfg.unsafe = disable_security;
// cfg.root_ca = MyRootCA;
// cfg.pub_key = MyRSAKey;
FOTA.setConfig(cfg);
FOTA.setStatusChecker(EthernetConnected);
}
WiFi.onEvent(WiFiEvent);
ETH.begin(MISO_GPIO, MOSI_GPIO, SCLK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST);
}
/**
* @brief Function to loop the ota
* @param None
* @retval None
*/
void Loop_automatic_ota(void)
{
if (!eth_connected)
{
Serial.println("Connecting...");
delay(1000);
return;
}
FOTA.handle();
delay(20000);
}`
i am getting the following issue…
ETH Started
Connecting…
Connecting…
ETH Connected
Connecting…
Connecting…
Connecting…
ETH MAC: 02:00:00:12:34:56, IPv4: 192.168.0.39, FULL_DUPLEX, 10Mbps
[ 22066][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[ 22067][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[ 52076][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[ 52077][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[ 84085][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[ 84085][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[126096][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[126096][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[159106][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[159106][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[198119][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-80) UNKNOWN ERROR CODE (0050)
[198120][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -80
[236130][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[236130][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[270141][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[270141][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[309151][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-80) UNKNOWN ERROR CODE (0050)
[309152][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -80
[342161][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SSL - The connection indicated an EOF
[342162][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -29312
[376171][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():276]: (-29312) SS
The ethernet connection seems to work but not the ssl part…
Any idea ?
This is the fota.json file already tested with the wifi connection . .
{
“type”: “esp32-fota-http”,
“version”: “2”,
“port”: 443,
“url”: “https://systelfota.000webhostapp.com/update.bin”
}
Thanks a lot again