Dedicated or combined OTA

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Dedicated or combined OTA

Postby brp80000 » Wed Nov 07, 2018 11:01 pm

I wrote a program that has a Web interface to work with, additionally I want to make a button for OTA.
The program itself contains 4 areas
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 0x100000,
storage, data, fat, 0x200000, 2M,
I don't understand how I should make part of the code for an OTA update.
1. Make a separate area with the OTA program, which transfer control to download and place in the same memory areas instead of the old data
2. To make a General program code with the OTA and update all together in a new memory area
2.1 what area of storage (fatfs) because it is also necessary to update
What are the solutions?

gecko242
Posts: 18
Joined: Tue Oct 02, 2018 7:11 am

Re: Dedicated or combined OTA

Postby gecko242 » Thu Nov 08, 2018 10:47 am

Here, have a read of this. Ota is handled through 2 separate "ota" partitions.

https://docs.espressif.com/projects/esp ... m/ota.html

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Dedicated or combined OTA

Postby fly135 » Thu Nov 08, 2018 4:34 pm

If you are using a board with the standard 4MB of flash then you don't really have enough free space.

John A

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: Dedicated or combined OTA

Postby brp80000 » Thu Nov 08, 2018 10:34 pm

I have 16 mb.

nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 1M
ota_0, app, ota_0, 0x110000, 1M
ota_1, app, ota_1, 0x210000, 1M
storage, data, fat, 0x400000, 2M

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Dedicated or combined OTA

Postby Ritesh » Fri Nov 09, 2018 7:31 am

brp80000 wrote:I have 16 mb.

nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 1M
ota_0, app, ota_0, 0x110000, 1M
ota_1, app, ota_1, 0x210000, 1M
storage, data, fat, 0x400000, 2M
Hi,

If above is Partition Mechanism for your 16 MB flash memory then you can use standard OTA Mechanism to update your device firmware without any difficulties.

You can use something like below mechanis to update firmware.

1) Decide Firmware Download Location other then above configuration and store that firmware into that location.

2) Once firmware download process is completed with verification process then check current firmware is running into which partition.

3) Update firmware into other partition and switch current firmware to that location

4) So, Above way you can update firmware using OTA mechanism as per you requirement.

Let me know if need any help regarding that.
Regards,
Ritesh Prajapati

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: Dedicated or combined OTA

Postby brp80000 » Fri Nov 09, 2018 5:24 pm

How can I update fatfs

storage, data, fat, 0x400000, 2M
via OTA?

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: Dedicated or combined OTA

Postby fly135 » Fri Nov 09, 2018 9:46 pm

OTA is incredibly simple once you have the partitions on your flash set up. It's literally just a couple lines of code (caveat, I removed the certificate check in esp_https_ota).

Code: Select all

  memset((void*)&client,0,sizeof(esp_http_client_config_t));
  client.url = "https://www.somedomain.com/mybuild.bin";
  int ret = esp_https_ota(&client);
To write to your file system, you are going to need a method of downloading a file and writing it to your file system. The esp_https_ota source in the components directory would be a good example of using esp_http_client to download it.

John A

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: Dedicated or combined OTA

Postby brp80000 » Sat Nov 10, 2018 3:17 am

Now I am trying to install the certificate but have a problem with .rnd
11.jpg
11.jpg (56.81 KiB) Viewed 10150 times

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Dedicated or combined OTA

Postby Ritesh » Sat Nov 10, 2018 5:15 am

brp80000 wrote:
Sat Nov 10, 2018 3:17 am
Now I am trying to install the certificate but have a problem with .rnd
11.jpg
Hi,

Would you please try without secure connection first to validate OTA process?

If that works fine then I suggest to go for secure connection for same.
Regards,
Ritesh Prajapati

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: Dedicated or combined OTA

Postby brp80000 » Sat Nov 10, 2018 6:58 am

Its too not work. But it once worked and now get error

esp_http_client_config_t config = {
.url = EXAMPLE_SERVER_URL,
//.cert_pem = (char *)server_cert_pem_start,
};
11.jpg
11.jpg (24.65 KiB) Viewed 10120 times

Who is online

Users browsing this forum: leschge, mikecarlos and 142 guests