aboutsummaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-06-16 22:41:08 -0700
committerpx4dev <px4@purgatory.org>2013-06-16 22:41:08 -0700
commit3163d7ac0908dfee0978992137500f11f8a42c43 (patch)
tree61beecd09d8981deb8fd9476534d99891af7ff5a /src/drivers
parent8eb4a03274b3012f5631f9a25f3a3f98f4d19159 (diff)
downloadpx4-firmware-3163d7ac0908dfee0978992137500f11f8a42c43.tar.gz
px4-firmware-3163d7ac0908dfee0978992137500f11f8a42c43.tar.bz2
px4-firmware-3163d7ac0908dfee0978992137500f11f8a42c43.zip
Set the serial port speed before trying to talk to IO
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/px4io/uploader.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/drivers/px4io/uploader.cpp b/src/drivers/px4io/uploader.cpp
index 15524c3ae..c2f9979b0 100644
--- a/src/drivers/px4io/uploader.cpp
+++ b/src/drivers/px4io/uploader.cpp
@@ -49,6 +49,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <poll.h>
+#include <termios.h>
#include <sys/stat.h>
#include "uploader.h"
@@ -121,6 +122,12 @@ PX4IO_Uploader::upload(const char *filenames[])
return -errno;
}
+ /* adjust line speed to match bootloader */
+ struct termios t;
+ tcgetattr(_io_fd, &t);
+ cfsetspeed(&t, 115200);
+ tcsetattr(_io_fd, TCSANOW, &t);
+
/* look for the bootloader */
ret = sync();
@@ -256,7 +263,7 @@ PX4IO_Uploader::recv(uint8_t &c, unsigned timeout)
}
read(_io_fd, &c, 1);
- //log("recv 0x%02x", c);
+ log("recv 0x%02x", c);
return OK;
}
@@ -283,7 +290,7 @@ PX4IO_Uploader::drain()
ret = recv(c, 1000);
if (ret == OK) {
- //log("discard 0x%02x", c);
+ log("discard 0x%02x", c);
}
} while (ret == OK);
}
@@ -291,7 +298,7 @@ PX4IO_Uploader::drain()
int
PX4IO_Uploader::send(uint8_t c)
{
- //log("send 0x%02x", c);
+ log("send 0x%02x", c);
if (write(_io_fd, &c, 1) != 1)
return -errno;