aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sidrane <david_s5@nscdg.com>2015-01-22 05:57:51 -1000
committerDavid Sidrane <david_s5@nscdg.com>2015-01-22 05:57:51 -1000
commitaf5c9876c469fdf71d309eb8812359f5feba6569 (patch)
treedb919e4e33dd2af1fc2e3a69fada8e3a4fc49bfd
parent561481f26a19021b9a13d616cc606be72663f96c (diff)
parent527ac0dbb555e730dc1d62aa6acd1b62ed10af9b (diff)
downloadpx4-firmware-af5c9876c469fdf71d309eb8812359f5feba6569.tar.gz
px4-firmware-af5c9876c469fdf71d309eb8812359f5feba6569.tar.bz2
px4-firmware-af5c9876c469fdf71d309eb8812359f5feba6569.zip
Merge branch 'nuttx_bringup' of https://github.com/PX4/Firmware into nuttx_bringup
-rw-r--r--ROMFS/px4fmu_common/init.d/rcS2
-rw-r--r--src/drivers/px4io/px4io.cpp9
2 files changed, 9 insertions, 2 deletions
diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS
index 2c9387ff0..043e0bc17 100644
--- a/ROMFS/px4fmu_common/init.d/rcS
+++ b/ROMFS/px4fmu_common/init.d/rcS
@@ -214,7 +214,7 @@ then
if px4io forceupdate 14662 $IO_FILE
then
- usleep 500000
+ usleep 10000
if px4io checkcrc $IO_FILE
then
echo "PX4IO CRC OK after updating" >> $LOG_FILE
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp
index 556eebab6..5e3d28fe9 100644
--- a/src/drivers/px4io/px4io.cpp
+++ b/src/drivers/px4io/px4io.cpp
@@ -618,8 +618,15 @@ PX4IO::init()
return ret;
/* get some parameters */
- unsigned protocol = io_reg_get(PX4IO_PAGE_CONFIG, PX4IO_P_CONFIG_PROTOCOL_VERSION);
+ unsigned protocol;
+ hrt_abstime start_try_time = hrt_absolute_time();
+ do {
+ usleep(2000);
+ protocol = io_reg_get(PX4IO_PAGE_CONFIG, PX4IO_P_CONFIG_PROTOCOL_VERSION);
+ } while (protocol == _io_reg_get_error && (hrt_elapsed_time(&start_try_time) < 700U * 1000U));
+
+ /* if the error still persists after timing out, we give up */
if (protocol == _io_reg_get_error) {
log("failed to communicate with IO");
mavlink_log_emergency(_mavlink_fd, "[IO] failed to communicate with IO, abort.");