busvoodoo_hiz: fix family check for dongle

This commit is contained in:
King Kévin 2020-03-09 15:52:38 +01:00
parent 8fab76dc5d
commit 4ca7fa65ec
1 changed files with 23 additions and 7 deletions

View File

@ -93,21 +93,37 @@ static bool busvoodoo_hiz_test_self(bool halt)
busvoodoo_safe_state(); // start from a safe state
// get device information
// ensure flash size is ok
if (0xffff == DESIG_FLASH_SIZE) {
puts("unknown flash size: this is probably a defective micro-controller\n");
}
// get device identifier (DEV_ID)
// 0x412: low-density, 16-32 kB flash
// 0x410: medium-density, 64-128 kB flash
// 0x414: high-density, 256-512 kB flash
// 0x430: XL-density, 768-1024 kB flash
// 0x418: connectivity
if (0 == (DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK)) { // can't read IDCODE for verification
// this is a known issue document in STM32F10xxC/D/E Errata sheet, without workaround
} else if (0x414 != (DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK)) {
printf("this (DEV_ID=%03x) is not a high-density device: a wrong micro-controller might have been used\n", (DBGMCU_IDCODE&DBGMCU_IDCODE_DEV_ID_MASK));
#if BUSVOODOO_HARDWARE_VERSION != 2
if (0 == (DBGMCU_IDCODE & DBGMCU_IDCODE_DEV_ID_MASK)) { // can't read IDCODE for verification (this is a known issue documented in STM32F10xxC/D/E Errata sheet, without workaround)
if (DESIG_FLASH_SIZE != 256 && DESIG_FLASH_SIZE != 512) {
printf("flash size=%ukB\n", DESIG_FLASH_SIZE);
puts("this is not a high-density device: a wrong micro-controller might have been used\n");
}
} else if (0x414 != (DBGMCU_IDCODE & DBGMCU_IDCODE_DEV_ID_MASK)) {
printf("DEV_ID=%03x\n", (DBGMCU_IDCODE & DBGMCU_IDCODE_DEV_ID_MASK));
puts("this is not a high-density device: a wrong micro-controller might have been used\n");
}
// ensure flash size is ok
if (0xffff == DESIG_FLASH_SIZE) {
puts("unknown flash size: this is probably a defective micro-controller\n");
#else
if (0 == (DBGMCU_IDCODE & DBGMCU_IDCODE_DEV_ID_MASK)) { // can't read IDCODE for verification (this is a known issue documented in STM32F10xxC/D/E Errata sheet, without workaround)
if (DESIG_FLASH_SIZE != 64 && DESIG_FLASH_SIZE != 128) {
printf("flash size=%ukB\n", DESIG_FLASH_SIZE);
puts("this is not a medium-density device: a wrong micro-controller might have been used\n");
}
} else if (0x410 != (DBGMCU_IDCODE & DBGMCU_IDCODE_DEV_ID_MASK)) {
printf("DEV_ID=%03x\n", (DBGMCU_IDCODE & DBGMCU_IDCODE_DEV_ID_MASK));
puts("this is not a medium-density device: a wrong micro-controller might have been used\n");
}
#endif
#if BUSVOODOO_HARDWARE_VERSION != 2
// check 5V power rail