DBGMCU_IDCODE needed for some STM32F103 clones, can anyone help ? - Page 1
Forum section: electronics / general

author: techman-001
author_rank: Frequent Contributor
timestamp: February 12, 2021, 10:51:42 pm
content: I'm working on V1.6 of my Blue Pill Diags program which uses the DBGMCU_IDCODE located at Address: 0xE0042000 on the STM32Fxx series MCUs.I'm specifically looking for this 32 bit value for the following mcu's, but the CKS32F103C8T6 is the most important:* CKS32F103C8T6* APM32F103CBT6 (may not be possible)If you have my diags program running on a CKS32F103C8T6 or a APM32F103CBT6 then please quit to the Forth terminal via the menu (q) and run this command " $E0042000 @ hex. " and it will print the DBGMCU_IDCODE value on the screen.Cheers,Terry

author: GromBeestje
author_rank: Frequent Contributor
timestamp: February 14, 2021, 12:11:13 pm
content: Using the binary as found in your signatureTesting on APM32 (RobotDyn board): the device does not enumerateTesting on CKS32 (BluePill): (assuming there are no fake CKS32s out there...) :The device does enumerate, when opening the serial interface, it doesn't operate as expected, outputting a lot of text like0001BEBC $FF?: $250001BEBE $FF?: $F60001BEC0 $FF?: $B60001BEC2 $FF?: $F60001BEC4 $FF?: $B40001BEC8 $FF?: $D90001BECA $FF?: $00Wrong address or data for writing flash !ok.when first opened (using PuTTY)Entering the menu, shows it thinks it is runnig on a GD32F-------Summary-------stm32fxx-diagnostics-V1.5Part: GD32FSerial Number: 4C737659External markings: not yet enteredFlash Bytes declared: 65536Potential hidden second 64kB Flash block: untested or failed.Running the command you asked gives,Code:$E0042000 @ hex. 20036410 ok.Which is what I would expect for any clone except GD32.

author: GromBeestje
author_rank: Frequent Contributor
timestamp: February 14, 2021, 02:00:25 pm
content: An addition to last post, the boards I used where not tested before. It turned out the APM board didn't accept power from USB (broken LDO? needs more investigation)Nevertheless, when powering it externally, it runsCode:$E0042000 @ hex. 20036410 ok.So as expected, the results are the same.

author: techman-001
author_rank: Frequent Contributor
timestamp: February 14, 2021, 08:18:24 pm
content: Quote from: GromBeestje on February 14, 2021, 02:00:25 pmThank you for doing that. Would you be able to use the same method to confirm the GD32F DBGMCU_IDCODE that you have ?Below is a table I've built using the STM32F1x DBGMCU_IDCODE register. It now appears to me that the only reliable way to determine IF a MCU is a STM32F1xxis if the DBGMCU_IDCODE register cannot be read internally with my Diags program without either a SWD or JTAG interface connected. The only reason that is possible is that the clones fixed that bug..Otherwise it appears that with the possible exception of the GD32F103 (hopefully you can sort that out with the DBGMCU code) it will be impossible to tell if the clone is a CKS32F103C8T6 or a APM32F103CBT6 by use of the various ID codes alone ?Code:@ 0xE0042000* Bits 11:0 DEV_ID: Device identifier* Bits 15:12 Reserved* Bits 31:16 REV_ID: Revision identifier::|3|3|2|2|2|2|2|2|2|2|2|2|1|1|1|1|1|1|1|1|1|1||1|0|9|8|7|6|5|4|3|2|1|0|9|8|7|6|5|4|3|2|1|0|9|8|7|6|5|4|3|2|1|0||-----------RES_ID--------------|reser|---------DEV_ID----------|Code:Table: DBGMCU_IDCODES---------------------================= ============== ============== ============== ================= ============== ==================== =====Device CPU-ID RevID Flash (KB) 2nd 64KB Hidden ? Ram (KB) Manufacturer *================= ============== ============== ============== ================= ============== ==================== =====STM32F103C8T6 0x410 0x2003 2x 64 YES 20 STMicroelectronics YSTM32F103RBT6 0x410 ? ? 128 N/A 20 STMicroelectronics YCKS32F103C8T6 0x410 0x2003 64 N/A 20 China Key System NAPM32F103CBT6 0x410 0x2003 ? ? ? Apex Micro NGD32F130C8 0x410 0x1303 64 ? 8 Gigadevice ?GD32F150C8 0x410 0x1303 64 ? 8 Gigadevice ?STM32F103VET6 0x414 0x1001 512 N/A 64 STMicroelectronics YGD32F103VE 0x414 0x1309 512 N/A 64 Gigadevice ?GD32F103VK 0x430 0x1309 3072 N/A 96 Gigadevice ?GD32F103C8T6 0x436 ? 0x1038 ? ? ? ? Gigadevice ?================= ============== ============== ============== ================= ============== ==================== =====.. note:: * Does this MCU require an active SWD connection before the DBGMCU_IDCODE can be read INTERNALLY (Using my Diagnostics Binary) ?

author: GromBeestje
author_rank: Frequent Contributor
timestamp: February 21, 2021, 07:08:39 pm
content: I don't seem to have a working GD32F103 board at the moment. I guess I'll have to solder a new board for further testing.I have two GD32F101 boards, but those have less RAM and no USB support.

author: techman-001
author_rank: Frequent Contributor
timestamp: February 21, 2021, 10:21:57 pm
content: Quote from: GromBeestje on February 21, 2021, 07:08:39 pmVersion 1.6 of my diags program has a option jumper selectable bootup into either USB or SWDCOM for the Forth terminal.With SWDCOM all you need is a SWD/USB dongle and the Linux, Mac or FreeBSD (no Windows support that I'm aware of) SWDCOM client. This provides high speed comms with handshaking from the PC to the STM32F1xx (or clones) over SWD, no serial or USB on the MCU is required.It may even run on your GD32F101 boards as the binary needs less than 64KB flash and less than 8KB ram.I hope to have V1.6 out within the next week.https://mecrisp-stellaris-folkdoc.sourceforge.io/swdcom.html#swdcom... perhaps this may be a easy way to test your collection of clones ?

author: techman-001
author_rank: Frequent Contributor
timestamp: April 14, 2021, 05:08:19 am
content: Quote from: techman-001 on February 12, 2021, 10:51:42 pm*RESOLVED*I finally acquired it as a result of a user with my latest Blue Pill Diags:https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-diagnostics-v1.6.htmland it's identical to a genuine STM32F103C8, namely 0x20036410 which meant it's not much use determining whether the chip is a clone.Fortunately the 4 tests in V1.631 which include JDEC value comparisons seem to be quite conclusive.Of his three Blue Pill boards purchased from the same supplier, two were genuine STM32F103C8's with the 'hidden extra 64KB flash, and one is a CKS32F103CBT6 with 128kb declared flash. All three MCU's were marked STM32F103C8.