Author Topic: DBGMCU_IDCODE needed for some STM32F103 clones, can anyone help ?  (Read 2204 times)

0 Members and 1 Guest are viewing this topic.

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
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
« Last Edit: February 12, 2021, 11:30:47 pm by techman-001 »
 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 280
  • Country: nl
Re: DBGMCU_IDCODE needed for some STM32F103 clones, can anyone help ?
« Reply #1 on: February 14, 2021, 12:11:13 pm »
Using the binary as found in your signature

Testing on APM32 (RobotDyn board): the device does not enumerate

Testing 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 like

0001BEBC $FF?: $25
0001BEBE $FF?: $F6
0001BEC0 $FF?: $B6
0001BEC2 $FF?: $F6
0001BEC4 $FF?: $B4
0001BEC8 $FF?: $D9
0001BECA $FF?: $00
Wrong 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.5
Part: GD32F
Serial Number: 4C737659
External markings: not yet entered
Flash Bytes declared: 65536
Potential hidden second 64kB Flash block: untested or failed.


Running the command you asked gives,
Code: [Select]
$E0042000 @ hex.  20036410 ok.
Which is what I would expect for any clone except GD32.



 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 280
  • Country: nl
Re: DBGMCU_IDCODE needed for some STM32F103 clones, can anyone help ?
« Reply #2 on: February 14, 2021, 02:00:25 pm »
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 runs

Code: [Select]
$E0042000 @ hex.  20036410 ok.
So as expected, the results are the same.
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: DBGMCU_IDCODE needed for some STM32F103 clones, can anyone help ?
« Reply #3 on: February 14, 2021, 08:18:24 pm »
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 runs

Code: [Select]
$E0042000 @ hex.  20036410 ok.
So as expected, the results are the same.

Thank 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 STM32F1xx
is 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: [Select]
@ 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: [Select]
Table: DBGMCU_IDCODES
---------------------

================= ============== ============== ============== ================= ============== ==================== =====
Device            CPU-ID         RevID          Flash (KB)     2nd 64KB Hidden ? Ram (KB)       Manufacturer         *
================= ============== ============== ============== ================= ============== ==================== =====
STM32F103C8T6     0x410          0x2003         2x 64          YES               20             STMicroelectronics   Y
STM32F103RBT6     0x410 ?        ?              128            N/A               20             STMicroelectronics   Y
CKS32F103C8T6     0x410          0x2003         64             N/A               20             China Key System     N
APM32F103CBT6     0x410          0x2003         ?              ?                 ?              Apex Micro           N
GD32F130C8        0x410          0x1303         64             ?                 8              Gigadevice           ?
GD32F150C8        0x410          0x1303         64             ?                 8              Gigadevice           ?
STM32F103VET6     0x414          0x1001         512            N/A               64             STMicroelectronics   Y
GD32F103VE        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) ?
 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 280
  • Country: nl
Re: DBGMCU_IDCODE needed for some STM32F103 clones, can anyone help ?
« Reply #4 on: February 21, 2021, 07:08:39 pm »
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.
 
The following users thanked this post: techman-001

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: DBGMCU_IDCODE needed for some STM32F103 clones, can anyone help ?
« Reply #5 on: February 21, 2021, 10:21:57 pm »
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.

Version 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  ?

 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: DBGMCU_IDCODE needed for some STM32F103 clones, can anyone help ?
« Reply #6 on: April 14, 2021, 05:08:19 am »
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

*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.html and 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.


 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf