Page 1 of 3
Dedicated or combined OTA
Posted: Wed Nov 07, 2018 11:01 pm
by brp80000
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?
Re: Dedicated or combined OTA
Posted: Thu Nov 08, 2018 10:47 am
by gecko242
Here, have a read of this. Ota is handled through 2 separate "ota" partitions.
https://docs.espressif.com/projects/esp ... m/ota.html
Re: Dedicated or combined OTA
Posted: Thu Nov 08, 2018 4:34 pm
by fly135
If you are using a board with the standard 4MB of flash then you don't really have enough free space.
John A
Re: Dedicated or combined OTA
Posted: Thu Nov 08, 2018 10:34 pm
by brp80000
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
Re: Dedicated or combined OTA
Posted: Fri Nov 09, 2018 7:31 am
by Ritesh
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.
Re: Dedicated or combined OTA
Posted: Fri Nov 09, 2018 5:24 pm
by brp80000
How can I update fatfs
storage, data, fat, 0x400000, 2M
via OTA?
Re: Dedicated or combined OTA
Posted: Fri Nov 09, 2018 9:46 pm
by fly135
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
Re: Dedicated or combined OTA
Posted: Sat Nov 10, 2018 3:17 am
by brp80000
Now I am trying to install the certificate but have a problem with .rnd
- 11.jpg (56.81 KiB) Viewed 11499 times
Re: Dedicated or combined OTA
Posted: Sat Nov 10, 2018 5:15 am
by Ritesh
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.
Re: Dedicated or combined OTA
Posted: Sat Nov 10, 2018 6:58 am
by brp80000
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 (24.65 KiB) Viewed 11469 times