diff --git a/fet.c b/fet.c index ce41520..4e12d52 100644 --- a/fet.c +++ b/fet.c @@ -105,6 +105,10 @@ struct fet_device { #define C_WRITEI2C 0x23 #define C_ENTERBOOTLOADER 0x24 +#define C_IDENT1 0x28 +#define C_IDENT2 0x29 +#define C_IDENT3 0x2b + /* Constants for parameters of various FET commands */ #define FET_CONFIG_VERIFICATION 0 #define FET_CONFIG_EMULATION 1 @@ -489,8 +493,8 @@ static int identify_new(struct fet_device *dev, const char *force_id) { const struct fet_db_record *r; - if (xfer(dev, 0x28, NULL, 0, 2, 0, 0) < 0) { - fprintf(stderr, "fet: command 0x28 failed\n"); + if (xfer(dev, C_IDENT1, NULL, 0, 2, 0, 0) < 0) { + fprintf(stderr, "fet: command C_IDENT1 failed\n"); return -1; } @@ -520,13 +524,13 @@ static int identify_new(struct fet_device *dev, const char *force_id) printf("Device: %s\n", r->name); printf("Code memory starts at 0x%04x\n", dev->code_start); - if (xfer(dev, 0x2b, r->msg2b_data, FET_DB_MSG2B_LEN, 0) < 0) - fprintf(stderr, "fet: warning: message 0x2b failed\n"); + if (xfer(dev, C_IDENT3, r->msg2b_data, r->msg2b_len, 0) < 0) + fprintf(stderr, "fet: warning: message C_IDENT3 failed\n"); - if (xfer(dev, 0x29, r->msg29_data, FET_DB_MSG29_LEN, + if (xfer(dev, C_IDENT2, r->msg29_data, FET_DB_MSG29_LEN, 3, r->msg29_params[0], r->msg29_params[1], r->msg29_params[2]) < 0) { - fprintf(stderr, "fet: message 0x29 failed\n"); + fprintf(stderr, "fet: message C_IDENT2 failed\n"); return -1; } diff --git a/fet_db.c b/fet_db.c index 3875191..1b412fd 100644 --- a/fet_db.c +++ b/fet_db.c @@ -41,6 +41,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0xf3, 0x30, 0xd3, 0x30, 0xc0, 0x30, }, + .msg2b_len = 0x4a, .msg2b_data = { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -73,6 +74,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0xf3, 0x30, 0xd3, 0x30, 0xc0, 0x30 }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -106,6 +108,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0xf3, 0x30, 0xd3, 0x30, 0xc0, 0x30 }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -139,6 +142,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0xF3, 0x30, 0xD3, 0x30, 0xC0, 0x30 }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x0C, 0xFF, 0x0F, 0x00, 0x02, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -172,6 +176,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x0f, 0x1f, 0x0f, 0xff, 0xff }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -205,6 +210,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x0F, 0x1F, 0x0F, 0xFF, 0xFF }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x0C, 0xFF, 0x0F, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -238,6 +244,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x0f, 0x1f, 0x0f, 0xff, 0xff }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -271,6 +278,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x10, 0xff, 0x17, 0x00, 0x02, 0x02, 0x00, 0x0a, 0x00, 0x40, 0x00, 0x0a, 0x91, 0x8e, 0x9d, @@ -304,6 +312,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x10, 0xff, 0x17, 0x00, 0x02, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -337,6 +346,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x10, 0xff, 0x17, 0x00, 0x02, 0x01, 0x00, 0x04, 0x00, 0x40, 0x00, 0x0a, 0x91, 0x8e, 0x00, @@ -370,6 +380,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x0f, 0x1f, 0x0f, 0xff, 0xff }, + .msg2b_len = 0x4a, .msg2b_data = { /* Copied from MSP430F2616 */ 0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -403,6 +414,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x0f, 0x1f, 0x0f, 0xff, 0xff }, + .msg2b_len = 0x4a, .msg2b_data = { /* Copied from MSP430F2616 */ 0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -439,6 +451,7 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + .msg2b_len = 0x4a, .msg2b_data = { 0x00, 0x10, 0xff, 0x17, 0x00, 0x02, 0x02, 0x00, 0x0a, 0x00, 0x40, 0x00, 0x0a, 0x91, 0x8e, 0x9d, @@ -451,6 +464,37 @@ static const struct fet_db_record fet_db[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } + }, + { + .name = "MSP430F169", + .msg28_data = { + 0xF1, 0x69, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x61, 0x01, 0x00, 0xb1, 0x68, + 0x10, 0x00 + }, + .msg29_params = {0x00, 0x28, 0x21}, + .msg29_data = { + 0x00, 0x11, 0xff, 0xff, 0x00, 0x00, 0x00, 0x10, + 0xff, 0x10, 0x80, 0x00, 0x00, 0x02, 0xff, 0x09, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x03, 0x00, + 0x02, 0x00, 0xd7, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x07, 0x10, 0x0e, 0xc4, 0x09, 0x70, 0x17, + 0x58, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf3, 0x30, 0xd3, 0x30, + 0xc0, 0x30 + }, + .msg2b_len = 0x34, + .msg2b_data = { + 0x00, 0x0c, 0xff, 0x0f, 0x00, 0x02, 0x02, 0x00, + 0x08, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00 + }, } }; diff --git a/fet_db.h b/fet_db.h index c535b4a..f48df29 100644 --- a/fet_db.h +++ b/fet_db.h @@ -33,6 +33,7 @@ struct fet_db_record { int msg29_params[FET_DB_MSG29_PARAMS]; uint8_t msg29_data[FET_DB_MSG29_LEN]; uint8_t msg2b_data[FET_DB_MSG2B_LEN]; + int msg2b_len; }; /* Find a record in the database by its response to message 0x28. The