Added voltage control command-line switch.

This commit is contained in:
Daniel Beer 2010-01-06 21:08:01 +13:00
parent ce308c5823
commit 187bcb283c
2 changed files with 17 additions and 9 deletions

12
fet.c
View File

@ -860,12 +860,6 @@ const struct device *fet_open(const struct fet_transport *tr,
printf("Configured for %s\n", printf("Configured for %s\n",
(proto_flags & FET_PROTO_SPYBIWIRE) ? "Spy-Bi-Wire" : "JTAG"); (proto_flags & FET_PROTO_SPYBIWIRE) ? "Spy-Bi-Wire" : "JTAG");
/* Identify the chip */
if (do_identify() < 0) {
fprintf(stderr, "fet: identify failed\n");
return NULL;
}
/* set VCC */ /* set VCC */
if (xfer(C_VCC, NULL, 0, 2, vcc_mv, 0) < 0) { if (xfer(C_VCC, NULL, 0, 2, vcc_mv, 0) < 0) {
fprintf(stderr, "fet: set VCC failed\n"); fprintf(stderr, "fet: set VCC failed\n");
@ -874,6 +868,12 @@ const struct device *fet_open(const struct fet_transport *tr,
printf("Set Vcc: %d mV\n", vcc_mv); printf("Set Vcc: %d mV\n", vcc_mv);
/* Identify the chip */
if (do_identify() < 0) {
fprintf(stderr, "fet: identify failed\n");
return NULL;
}
/* I don't know what this is, but it appears to halt the MSP. Without /* I don't know what this is, but it appears to halt the MSP. Without
* it, memory reads return garbage. This is RF2500-specific. * it, memory reads return garbage. This is RF2500-specific.
*/ */

14
main.c
View File

@ -648,12 +648,15 @@ static void reader_loop(void)
static void usage(const char *progname) static void usage(const char *progname)
{ {
fprintf(stderr, "Usage: %s [-u device] [-j] [command ...]\n" fprintf(stderr,
"Usage: %s [-u device] [-j] [-v voltage] [command ...]\n"
"\n" "\n"
" -u device\n" " -u device\n"
" Open the given tty device (MSP430 UIF compatible devices).\n" " Open the given tty device (MSP430 UIF compatible devices).\n"
" -j\n" " -j\n"
" Use JTAG, rather than spy-bi-wire (UIF devices only).\n" " Use JTAG, rather than spy-bi-wire (UIF devices only).\n"
" -v voltage\n"
" Set the supply voltage, in millivolts.\n"
"\n" "\n"
"By default, the first RF2500 device on the USB bus is opened.\n" "By default, the first RF2500 device on the USB bus is opened.\n"
"\n" "\n"
@ -669,6 +672,7 @@ int main(int argc, char **argv)
int opt; int opt;
int flags = 0; int flags = 0;
int want_jtag = 0; int want_jtag = 0;
int vcc_mv = 3000;
puts( puts(
"MSPDebug version 0.3 - debugging tool for the eZ430\n" "MSPDebug version 0.3 - debugging tool for the eZ430\n"
@ -676,12 +680,16 @@ int main(int argc, char **argv)
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
while ((opt = getopt(argc, argv, "u:j")) >= 0) while ((opt = getopt(argc, argv, "u:jv:")) >= 0)
switch (opt) { switch (opt) {
case 'u': case 'u':
uif_device = optarg; uif_device = optarg;
break; break;
case 'v':
vcc_mv = atoi(optarg);
break;
case 'j': case 'j':
want_jtag = 1; want_jtag = 1;
break; break;
@ -704,7 +712,7 @@ int main(int argc, char **argv)
/* Then initialize the device */ /* Then initialize the device */
if (!want_jtag) if (!want_jtag)
flags |= FET_PROTO_SPYBIWIRE; flags |= FET_PROTO_SPYBIWIRE;
msp430_dev = fet_open(trans, flags, 3000); msp430_dev = fet_open(trans, flags, vcc_mv);
if (!msp430_dev) if (!msp430_dev)
return -1; return -1;