hi,
I am trying to OTA update the esp32 working in ARDUINO code to ESP-IDF code. I just used the an GPRS module for downloading the bin file from the server. it receive complete data from the server successfully . I am using update.h library for OTA update. Is the arduino bootloader is compatible with esp idf version 4.4 bootloader
#include "EC200.h"
#include "EC200_GPRS.h"
#include "Flashops.h"
#include "wifi.h"
#include "update.h"
#include "external_spimemory.h"
#include "idc_setup.h"
#include "fileffat_system.h"
void setup() {
int i=0;
int j=0;
pinMode(14, OUTPUT);
Serial.begin(230400);
unsigned char recbuff=(unsigned char )pvPortMalloc(321024);
delay(2000);
//
while (!inital_check()); // modem turn on
Auto_Accesspoint_config(NULL, NULL, NULL); //to set access point
HTTP_Config();
delay(1000);
delay(1000);
//
//
Flash_init();
delay(1000);
ota_update(url) ; // ota bin url
delay(1000);
/***/
uint32_t addr=4096;
int len1=get_Server_Data_length(url); // bootloader bin url
Serial.println(len1);
char buff[4096];
int iPcktcount=checkpacketsize(len1,4096);
Serial.printf("pckt num=%d\n",iPcktcount);
int recbuffbytes=0;
memset(recbuff,0,32*1024);
while(iPcktcount>0)
{
if((iPcktcount==1) && (iLASTPCKT>0))
{
while(download_http_server_data_through_modem_to_buffer(iSEEK_POS,buff,iLASTPCKT)==0)
{
tryouts++;
if(tryouts>=2)
{
break;
}
}
for(i=0;i<iLASTPCKT;i++)
{
recbuff[recbuffbytes++]=buff[i];
Serial.printf("%c",buff[i]);
}
iSEEK_POS=iSEEK_POS+iLASTPCKT;
iLASTPCKT=0;
}
else
{
while(download_http_server_data_through_modem_to_buffer(iSEEK_POS,buff,4096)==0)
{
tryouts++;
if(tryouts>=2)
{
break;
}
}
for(i=0;i<4096;i++)
{
recbuff[recbuffbytes++]=buff[i];
Serial.printf("%c",buff[i]);
}
memset(buff,0,4096);
iSEEK_POS=iSEEK_POS+4096;
}
iPcktcount--;
}
delay(1000);
Flash_erase(4096,BOOTLOADER_MAX_SIZE);
Flash_write(recbuff,4096, len1);
ESP.restart();
vPortFree(recbuff);
}
void loop()
{
}
The code uploaded below can easily change the bootloader from Arduino ide 2.0.5 to IDF VER 4.4. I am using Quectel EC200U-EU module for data downloading.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.