From b184b61457aabee0001e68d9efe52a6f24c7cd00 Mon Sep 17 00:00:00 2001 From: Simon Laube Date: Thu, 11 Jan 2018 14:08:39 +0100 Subject: [PATCH] IO: fix px4io uploader to work reliably on F7 platform. - Missing get_sync() in verify function - Allow some time to reboot before closing the serial port (closing the serial port drives TX low) --- src/drivers/px4io/px4io_uploader.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/drivers/px4io/px4io_uploader.cpp b/src/drivers/px4io/px4io_uploader.cpp index 70337c5a0c..c222509323 100644 --- a/src/drivers/px4io/px4io_uploader.cpp +++ b/src/drivers/px4io/px4io_uploader.cpp @@ -645,6 +645,13 @@ PX4IO_Uploader::verify_rev3(size_t fw_size_local) return ret; } + ret = get_sync(); + + if (ret != OK) { + log("did not receive CRC checksum"); + return ret; + } + /* compare the CRC sum from the IO with the one calculated */ if (sum != crc) { log("CRC wrong: received: %d, expected: %d", crc, sum); @@ -657,11 +664,19 @@ PX4IO_Uploader::verify_rev3(size_t fw_size_local) int PX4IO_Uploader::reboot() { + int ret; + send(PROTO_REBOOT); up_udelay(100 * 1000); // Ensure the farend is in wait for char. send(PROTO_EOC); - return OK; + ret = get_sync(); + + if (ret == OK) { + up_udelay(10 * 1000); // Ensure that we do not close UART too soon + } + + return ret; } void