Hello
I have 2 boards connected to each other using Modbus
The master board is connected to the internet using Ethernet
I can ota the master board using the http_ota example
Is there a way to perform ota for the slave board through master board since slave board has no access to internet?
OTA for slave MODBUS
Re: OTA for slave MODBUS
Hi,
I'm using UART or TCP communication to update slave ESP32 MCU. All you have to do is use these steps:
Begin update with:
Then write data to partition:
End then finish update with:
I think the source partition can be read in a similar way to ota write. But maybe it better is to read flash to most send unused empty space after firmware.
I'm using UART or TCP communication to update slave ESP32 MCU. All you have to do is use these steps:
Begin update with:
Code: Select all
static esp_ota_handle_t update_handle = 0;
static const esp_partition_t *update_partition = NULL;
...
update_partition = esp_ota_get_next_update_partition(NULL);
esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle);
Code: Select all
esp_ota_write(update_handle, (const void *)buff, len);
Code: Select all
if (esp_ota_end(update_handle) != ESP_OK)
{
ESP_LOGE(TAG, "esp_ota_end failed!");
return;
}
err = esp_ota_set_boot_partition(update_partition);
if (err != ESP_OK)
{
ESP_LOGE(TAG, "esp_ota_set_boot_partition failed! err=0x%x", err);
return;
}
Re: OTA for slave MODBUS
Thank you, will test that. The code is on the receiving end, how about the sending end?marbalon wrote: ↑Thu Jun 23, 2022 12:50 pmHi,
I'm using UART or TCP communication to update slave ESP32 MCU. All you have to do is use these steps:
Begin update with:
Then write data to partition:Code: Select all
static esp_ota_handle_t update_handle = 0; static const esp_partition_t *update_partition = NULL; ... update_partition = esp_ota_get_next_update_partition(NULL); esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle);
End then finish update with:Code: Select all
esp_ota_write(update_handle, (const void *)buff, len);
I think the source partition can be read in a similar way to ota write. But maybe it better is to read flash to most send unused empty space after firmware.Code: Select all
if (esp_ota_end(update_handle) != ESP_OK) { ESP_LOGE(TAG, "esp_ota_end failed!"); return; } err = esp_ota_set_boot_partition(update_partition); if (err != ESP_OK) { ESP_LOGE(TAG, "esp_ota_set_boot_partition failed! err=0x%x", err); return; }
I get the fw using http ota library already provided by esp32
Re: OTA for slave MODBUS
If you haev toe hsame firmware in two boards you can use esp_partition_read() to get data from first device and send it to second one. If the firmware is different you can use bin files embedded into the firmware of the first/master device.
Who is online
Users browsing this forum: No registered users and 67 guests