From 3602ed39f982e73de500545f9c039b4162ee54c5 Mon Sep 17 00:00:00 2001 From: sys64738 Date: Mon, 9 May 2022 01:42:57 +0200 Subject: [PATCH] fix MSP430FR5994 identification issue, handle NO_BSL config failure gracefully --- chipinfo.db | 12 +++++++++++- drivers/v3hil.c | 21 ++++----------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/chipinfo.db b/chipinfo.db index b36244c..cc8fd62 100644 --- a/chipinfo.db +++ b/chipinfo.db @@ -85042,7 +85042,7 @@ const struct chipinfo chipinfo_db[] = { { {0}, {0}, }, - .id = { + /*.id = { .ver_id = 0x82a1, .ver_sub_id = 0x0000, .revision = 0x10, @@ -85051,6 +85051,16 @@ const struct chipinfo chipinfo_db[] = { { .config = 0x00, .fuses = 0x00, .activation_key = 0x00000000, + },*/ + .id = { + .ver_id = 0x82a1, + .ver_sub_id = 0x0000, + .revision = 0x21, + .fab = 0x00, + .self = 0x0000, + .config = 0x00, + .fuses = 0x00, + .activation_key = 0x00000000, }, .id_mask = { .ver_id = 0xffff, diff --git a/drivers/v3hil.c b/drivers/v3hil.c index 265d9b7..9581f21 100644 --- a/drivers/v3hil.c +++ b/drivers/v3hil.c @@ -210,19 +210,6 @@ int v3hil_comm_init(struct v3hil *h) r32le(h->hal.payload + 4)); } - /* Pick fail-safe configuration */ - /*printc_dbg("Reset parameters...\n"); - if (set_param(h, HAL_PROTO_CONFIG_CLK_CONTROL_TYPE, 0) < 0 || - set_param(h, HAL_PROTO_CONFIG_SFLLDEH, 0) < 0 || - set_param(h, HAL_PROTO_CONFIG_DEFAULT_CLK_CONTROL, 0x040f) || - set_param(h, HAL_PROTO_CONFIG_ENHANCED_PSA, 0) < 0 || - set_param(h, HAL_PROTO_CONFIG_PSA_TCKL_HIGH, 0) < 0 || - set_param(h, HAL_PROTO_CONFIG_POWER_TESTREG_MASK, 0) < 0 || - set_param(h, HAL_PROTO_CONFIG_POWER_TESTREG3V_MASK, 0) < 0 || - //set_param(h, HAL_PROTO_CONFIG_NO_BSL, 0) < 0 || - set_param(h, HAL_PROTO_CONFIG_ALT_ROM_ADDR_FOR_CPU_READ, 0) < 0) - return -1;*/ - printc_dbg("Reset firmware...\n"); if (hal_proto_execute(&h->hal, HAL_PROTO_FID_RESET_STATIC_GLOBAL_VARS, NULL, 0) < 0) @@ -1053,9 +1040,9 @@ int v3hil_identify(struct v3hil *fet) set_param(fet, HAL_PROTO_CONFIG_PSA_TCKL_HIGH, 0) < 0 || set_param(fet, HAL_PROTO_CONFIG_POWER_TESTREG_MASK, 0) < 0 || set_param(fet, HAL_PROTO_CONFIG_POWER_TESTREG3V_MASK, 0) < 0 || - //set_param(fet, HAL_PROTO_CONFIG_NO_BSL, 0) < 0 || set_param(fet, HAL_PROTO_CONFIG_ALT_ROM_ADDR_FOR_CPU_READ, 0) < 0) return -1; + set_param(fet, HAL_PROTO_CONFIG_NO_BSL, 0); // is allowed to fail printc_dbg("Check JTAG fuse...\n"); if (hal_proto_execute(&fet->hal, HAL_PROTO_FID_IS_JTAG_FUSE_BLOWN, @@ -1128,13 +1115,13 @@ int v3hil_configure(struct v3hil *fet) fet->chip->power.enable_lpm5_3v) < 0 || set_param(fet, HAL_PROTO_CONFIG_TESTREG3V_DISABLE_LPMX5, fet->chip->power.disable_lpm5_3v) < 0 || - set_param(fet, HAL_PROTO_CONFIG_NO_BSL, - (fet->chip->features & - CHIPINFO_FEATURE_NO_BSL) ? 1 : 0) < 0 || set_param(fet, HAL_PROTO_CONFIG_ALT_ROM_ADDR_FOR_CPU_READ, (fet->chip->features & CHIPINFO_FEATURE_1337) ? 1 : 0) < 0) return -1; + set_param(fet, HAL_PROTO_CONFIG_NO_BSL, + (fet->chip->features & + CHIPINFO_FEATURE_NO_BSL) ? 1 : 0); // is allowed to fail return 0; }