Skip to content

Commit 1919728

Browse files
authored
Merge pull request #242 from arduino-libraries/portenta-feed-watchdog-during-ota
Feed Portenta H7 watchdog during OTA.
2 parents 27dda89 + 4ecf3b1 commit 1919728

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ArduinoIoTCloudTCP.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -583,24 +583,34 @@ void ArduinoIoTCloudTCP::onOTARequest()
583583
#endif /* OTA_STORAGE_SNU */
584584

585585
#if OTA_STORAGE_PORTENTA_QSPI
586+
mbed_watchdog_reset();
587+
586588
Arduino_Portenta_OTA::Error ota_portenta_err = Arduino_Portenta_OTA::Error::None;
587589
/* Use 2nd partition of QSPI (1st partition contains WiFi firmware) */
588590
Arduino_Portenta_OTA_QSPI ota_portenta_qspi(QSPI_FLASH_FATFS_MBR, 2);
589591

592+
mbed_watchdog_reset();
593+
590594
/* Initialize the QSPI memory for OTA handling. */
591595
if((ota_portenta_err = ota_portenta_qspi.begin()) != Arduino_Portenta_OTA::Error::None) {
592596
DEBUG_ERROR("Arduino_Portenta_OTA_QSPI::begin() failed with %d", static_cast<int>(ota_portenta_err));
593597
return;
594598
}
595599

600+
mbed_watchdog_reset();
601+
596602
/* Just to be safe delete any remains from previous updates. */
597603
remove("/fs/UPDATE.BIN");
598604
remove("/fs/UPDATE.BIN.LZSS");
599605

606+
mbed_watchdog_reset();
607+
600608
/* Download the OTA file from the web storage location. */
601609
int const ota_portenta_qspi_download_ret_code = ota_portenta_qspi.download((char*)(_ota_url.c_str()), true /* is_https */);
602610
DEBUG_VERBOSE("Arduino_Portenta_OTA_QSPI::download(%s) returns %d", _ota_url.c_str(), ota_portenta_qspi_download_ret_code);
603611

612+
mbed_watchdog_reset();
613+
604614
/* Decompress the LZSS compressed OTA file. */
605615
int const ota_portenta_qspi_decompress_ret_code = ota_portenta_qspi.decompress();
606616
DEBUG_VERBOSE("Arduino_Portenta_OTA_QSPI::decompress() returns %d", ota_portenta_qspi_decompress_ret_code);
@@ -610,6 +620,8 @@ void ArduinoIoTCloudTCP::onOTARequest()
610620
return;
611621
}
612622

623+
mbed_watchdog_reset();
624+
613625
/* Schedule the firmware update. */
614626
if((ota_portenta_err = ota_portenta_qspi.update()) != Arduino_Portenta_OTA::Error::None) {
615627
DEBUG_ERROR("Arduino_Portenta_OTA_QSPI::update() failed with %d", static_cast<int>(ota_portenta_err));

0 commit comments

Comments
 (0)