Skip to content

Commit

Permalink
software: Fix serial connection issue on OSX/Linux
Browse files Browse the repository at this point in the history
Turns out that on Ubuntu 14 and OSX El Capitan setting DTR to true
alone does not appear to send the command to the IOIO. Setting it
to false first seems to fix the issue.
  • Loading branch information
ytai committed Dec 27, 2015
1 parent 154d793 commit f322d8c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions software/IOIOBridge/src/main/java/ioio/bridge/Main.java
Expand Up @@ -148,6 +148,7 @@ private static SerialPort openPort(String portName) {
port = (SerialPort) commPort;
port.enableReceiveThreshold(1);
port.enableReceiveTimeout(500);
port.setDTR(false);
port.setDTR(true);
Thread.sleep(100);
return port;
Expand Down
Expand Up @@ -63,7 +63,9 @@ public void waitForConnect() throws IOException {
serialPort_.getInputStream());
outputStream_ = serialPort_.getOutputStream();

// This is only required on Windows, but otherwise harmless.
// This is only required on Windows and OSX El Capitan, but otherwise
// harmless.
serialPort_.setDTR(false);
serialPort_.setDTR(true);
Thread.sleep(100);
return;
Expand Down
Expand Up @@ -71,7 +71,9 @@ public void waitForConnect() throws ConnectionLostException {
1024);
outputStream_ = new BufferedOutputStream(serialPort_.getOutputStream(), 256);

// This is only required on Windows, but otherwise harmless.
// This is only required on Windows and OSX El Capitan, but otherwise
// harmless.
serialPort_.setDTR(false);
serialPort_.setDTR(true);
Thread.sleep(100);
return;
Expand Down

0 comments on commit f322d8c

Please sign in to comment.