Skip to content

Commit

Permalink
Merge pull request #78 from aswild/arduino-reset
Browse files Browse the repository at this point in the history
wait after Arduino 1200 baud reset to allow chip to reboot and re-enumerate
  • Loading branch information
shumatech authored Feb 1, 2020
2 parents b42fc6d + c704f9f commit 3532de8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/bossac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <sys/time.h>
#include <unistd.h>

#include "CmdOpts.h"
#include "Samba.h"
Expand Down Expand Up @@ -370,6 +371,7 @@ main(int argc, char* argv[])
SerialPort::Ptr port;
port = portFactory.create(config.portArg, config.usbPortArg != 0);

printf("Arduino 1200 baud reset\n");
if(!port->open(1200))
{
fprintf(stderr, "Failed to open port at 1200bps\n");
Expand All @@ -379,6 +381,12 @@ main(int argc, char* argv[])
port->setRTS(true);
port->setDTR(false);
port->close();

// wait for chip to reboot and USB port to re-appear
sleep(1);

if (config.debug)
printf("Arduino reset done\n");
}

if (config.portArg.empty())
Expand Down

0 comments on commit 3532de8

Please sign in to comment.