Browse Source

ch32f1: Re-ordered a couple of the operation in ch32f1_probe so it plays nicer with the STM32 parts

pull/1075/head
dragonmux 2 years ago
committed by Piotr Esden-Tempski
parent
commit
b5b2d4dc95
  1. 6
      src/target/ch32f1.c

6
src/target/ch32f1.c

@ -159,8 +159,10 @@ static int ch32f1_flash_lock(target *t)
*/
bool ch32f1_probe(target *t)
{
const uint32_t idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0xfff;
if ((t->cpuid & CPUID_PARTNO_MASK) != CORTEX_M3 || idcode != 0x410) // only ch32f103
if ((t->cpuid & CPUID_PARTNO_MASK) != CORTEX_M3)
return false;
const uint32_t idcode = target_mem_read32(t, DBGMCU_IDCODE) & 0x00000fffU;
if (idcode != 0x410) // only ch32f103
return false;
// try to flock

Loading…
Cancel
Save