-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for serial port "touch" functionality using libserialport #1507
Changes from 10 commits
6e4c005
51d0b5b
4ce53cb
57e2356
ae00c8a
d1c8e64
f7a9b37
efe0649
a99137e
354a5bb
deb314d
6897a3f
7a3de48
c72cc7b
e7e1e0e
6c4f6ba
27654c2
43a5c2b
39f094e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -469,6 +469,12 @@ ATmega328P MCU properties; for more information run @code{avrdude -p x/h}. | |
Override the RS-232 connection baud rate specified in the respective | ||
programmer's entry of the configuration file. | ||
|
||
@item -r @var{baudrate} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
Opens the serial port at 1200 baud and immedeatly closes it, prior to | ||
establishing communication with the programmer. This is commonly knows as A | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. known as a |
||
"1200bps touch", and is used to trigger programming mode for certain boards | ||
like Arduino Leonardo, Arduino Micro/Pro Micro and the Arduino Nano Every. | ||
|
||
@item -B @var{bitclock} | ||
Specify the bit clock period for the JTAG, PDI, TPI, UPDI, or ISP | ||
interface. The value is a floating-point number in microseconds. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,8 @@ static void usage(void) | |
" -p <wildcard>/<flags> Run developer options for matched AVR devices,\n" | ||
" e.g., -p ATmega328P/s or /S for part definition\n" | ||
" -b <baudrate> Override RS-232 baud rate\n" | ||
" -r Open and close (\"touch\") the serial port at\n" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps say why this is needed? The manual can (and does) go into the gory details. "Touch" the serial port before programming; needed for XXX, YYY etc bootloader uploads |
||
" 1200 baud before establishing connection\n" | ||
" -B <bitclock> Specify bit clock period (us)\n" | ||
" -C <config-file> Specify location of configuration file\n" | ||
" -c <programmer> Specify programmer; -c ? and -c ?type list all\n" | ||
|
@@ -526,6 +528,7 @@ int main(int argc, char * argv []) | |
char * e; /* for strtod() error checking */ | ||
const char *errstr; /* for str_int() error checking */ | ||
int baudrate; /* override default programmer baud rate */ | ||
bool touch_1200bps = false; /* "touch" serial port prior to programming */ | ||
double bitclock; /* Specify programmer bit clock (JTAG ICE) */ | ||
int ispdelay; /* Specify the delay for ISP clock */ | ||
int init_ok; /* Device initialization worked well */ | ||
|
@@ -635,7 +638,7 @@ int main(int argc, char * argv []) | |
/* | ||
* process command line arguments | ||
*/ | ||
while ((ch = getopt(argc,argv,"?Ab:B:c:C:DeE:Fi:l:np:OP:qstT:U:uvVx:yY:")) != -1) { | ||
while ((ch = getopt(argc,argv,"?Ab:B:c:C:DeE:Fi:l:np:OP:qrstT:U:uvVx:yY:")) != -1) { | ||
|
||
switch (ch) { | ||
case 'b': /* override default programmer baud rate */ | ||
|
@@ -766,6 +769,10 @@ int main(int argc, char * argv []) | |
quell_progress++ ; | ||
break; | ||
|
||
case 'r' : | ||
touch_1200bps = true; | ||
break; | ||
|
||
case 't': /* enter terminal mode */ | ||
ladd(updates, cmd_update("interactive terminal")); | ||
break; | ||
|
@@ -1231,6 +1238,9 @@ int main(int argc, char * argv []) | |
free(port_tok[i]); | ||
} | ||
|
||
if(touch_1200bps && pgm->conntype == CONNTYPE_SERIAL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe move into the preceding if(pgm->conntype == CONNTYPE_SERIAL) block? Simplifies code
(and saves an empty line) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And, of course, we should resolve whether a failed touch is
I lean towards the first as |
||
touch_serialport(&port, 1200); | ||
|
||
/* | ||
* open the programmer | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
known as a