I've been playing around with the STM32F103 GD32F103 CS32F103 and APM32F103. I've written some code that can tell them apart. I use the content of the ROM TABLE to tell them apart. There is no fancy user interface, it puts its result in the USB string of the Interface.
The USB ID is DEAD:BEEF, so to capture the output, you can do something like this
[andre@8570w ~]$ lsusb -d dead:beef -v | grep iInterface
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
iInterface 4 STM32 Cortex-M3 r1p1 V:1 CONT: 0 ID: 32 PART: 410 REV: 0
The iInterface string will contain
- STM32/GD32/CS32/APM32
- Cortex M3 rnpn : The ARM Core used: STM32 uses r1p1, clones usually r2p1
- Content of the PID in the ROM TABLE (JP106 Identifier)
I'm curious about those fake STM32F103 chips, what they will output with this little test. I wonder whether they're relabelled CS32/APM32 or something completely different.
Source code: https://github.com/a-v-s/ucdev/tree/32F103Detect/demos/usbd/stm32f1
Details about the ROM TABLE content: https://www.blaatschaap.be/?p=166
I'm curious also and is where I am so far on V2 of my STM32F103 diagnostics. It now prints a short summary, with some observations, and a optional XML table with just the data as collected.
The "DUID" is the Derived Unique Identifier to be used a as filename for any XML files for records, stats and further analysis.
Sample output from my genuine STM32F103C8:
Device Short Summary
--------------------
duid: $D43BA754
Flash bytes, declared: 65536
Debug_idcode: Not readable, candidates:STM32F1x
scb_cpuid: STM32F1 series
udid[95:64] $87042957 |..)W|
udid[63:32] $55507150 |UPqP|
udid[31:00] $066FFF53 |.o.S|
<?xml version='1.0' encoding='UTF-8'?>
<DEVICE xs:noNamespaceSchemaLocation='STM32F103_DIAGNOSTICS_V2.0.XSD'>
<DEBUG>
<IDCODE>0 </IDCODE>
</DEBUG>
<DERIVED>
<DUID>$D43BA754 </DUID>
<FLASH-SIZE>65536 </FLASH-SIZE>
</DERIVED>
<EXTERNAL-MARKINGS>
<STM32F103C6>0 </STM32F103C6>
<STM32F103C8>0 </STM32F103C8>
<STM32F103CB>0 </STM32F103CB>
<CKS32F103C8T6>0 </CKS32F103C8T6>
<GD32F103C8T6>0 </GD32F103C8T6>
<OTHER>0 </OTHER>
</EXTERNAL-MARKINGS>
<FLASH>
<SIZE-REGISTER>$FFFF0040 </SIZE-REGISTER>
<SECOND-64KB-BLOCK>0 </SECOND-64KB-BLOCK>
</FLASH>
<SCB_CPUID>
<BITS-31:24>$41</BITS-31:24>
<BITS-23:20>$1 </BITS-23:20>
<BITS-19:16>$F </BITS-19:16>
<BITS-15:4>$C23 </BITS-15:4>
<BITS-3:0>$1 </BITS-3:0>
</SCB_CPUID>
<UNIQUE-DEVICE-ID-REGISTER>
<BITS-95:64>
<HEX>$87042957 </HEX>
<ASCII>..)W</ASCII>
</BITS-95:64>
<BITS-63:32>
<HEX>$55507150 </HEX>
<ASCII>UPqP</ASCII>
</BITS-63:32>
<BITS-31:0>
<HEX>$066FFF53 </HEX>
<ASCII>.o.S</ASCII>
</BITS-31:0>
</UNIQUE-DEVICE-ID-REGISTER>
</DEVICE>