Which of the many STM32F103 clones are actually usable - Page 1
Forum section: electronics / general

author: profdc9
author_rank: Frequent Contributor
timestamp: September 08, 2021, 03:30:09 am
content: Given the extreme shortage of microcontrollers that seems no sign of letting up soon, I am looking for any information about the many similar microcontrollers to the STM32F103CBT6, for example GD32F103CBT6, CKS32F103CBT6, MM32F103CBT6, and APM32F103CBT6. Is there anywhere the differences between these parts from the original STM32 part are documented and compared? I believe, for example, the Gigadevices part uses flash that is downloaded into RAM on a separate die. But do any of these devices have peripherals that are compatible with the STM32?I would like to perhaps uses one of these devices for projects temporarily until the original STM32 device becomes available again.

author: ataradov
author_rank: Super Contributor
timestamp: September 08, 2021, 04:28:41 am
content: All of the peripherals are designed to be compatible. That's the whole point of those "clone" devices. The are some minor differences, but generally devices are designed to look and feel as close to the source as possible.

author: brucehoult
author_rank: Super Contributor
timestamp: September 08, 2021, 08:37:30 am
content: You're right the Gigadevice parts (both the ARM and RISC-V versions) have a separate flash memory die in the package and download it into on-chip SRAM on reset -- and also on wake from the lowest power sleep mode.This enables them to operate at a considerably higher clock frequency than the STM parts with no wait states for fetching instructions, but it makes reset and wake from deep sleep take several tens of ms vs us for the STM parts. This matters in some applications, and doesn't matter at all in others.

author: DavidAlfa
author_rank: Super Contributor
timestamp: September 08, 2021, 08:09:14 pm
content: They also draw considerably more power when running from a giant sram.I had issues with the ch32f103, the programmign algorithm is different, not 100% compatible.If the stlink programmed the stm32F103 in 5seconds, for the CH32 it was 1 minute or more.After some programmings, the chip died, needing Wchisp tool to erase it.Writing to the flash from the firmware took at least 50x longer.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 09, 2021, 09:54:56 am
content: There are differences between those parts and they can be significant.Because of it's RAM based architecture the GD variant for example needs a lot of time to start up.It can also run on higher clock frequencies, and maybe with lower waitstate settings.If you get the waitstates wrong, a part runs unreliably,(Possibly temperature dependent) or not at all.One of the variants, I think the MM can run on 5V.They may be functionally and pin compatible, but there may be differences in I/O drive strength, power consumption (in different modes) ADC noise / linearity and many other details. And those details may either be irrelevant to you, or completely break your project. There are devils lurking there.For a hand full of breadboard projects with "Blue pill" clones you can experiment a bit, but if you want to use batches of 1000+ there simply is no room for messing about and such decisions can not be taken lightly.I have no interest with fiddling with the different variants, and therefore bought a batch of WeAct STM32F411 boards. They cost around EUR7 each, but higher clock frequency, genuine ARM parts, more RAM & FLASH, built in floating point, less hardware bugs (apparently the old STM32F103 has quite some), you can solder on a WS25Qxxx Flash chip for a few dimes and you give off a signal that you're willing to pay a bit more if you get decent quality parts.If you buy GD, CKS, MM or whatever variants, that's up to you.However, if you buy STM blue pills, and they turn out to be some other chip, then always give negative feedback and complain. There is simply no excuse whatever for it. Some of the "blue pills" do state which variant they use. I'm OK with that. You get what you buy.Rebranding chips is nothing else but cheating, fraud and a blatant lie. Fiddlling with compiler settings and/or programmer ID's just to get a chip working is a waste of your own time, and their profit if you fall for it.In my book, it's perfectly all right to punch them back in the face. Start a complaint procedure. Demand your money back because the parts are rebranded and not as ordered. Do this even if you know in advance that the chips are likely rebranded / fake. Make a sport out of it to try to get as many as you can for free because of their fraud of relabeling. Hit them in their wallet where it hurts and do it repeatedly until they stop these fraudulent practices.Also, have a look at LCSC.com. They have the datasheets for all (or at least most of) the variants.Even if you only use STM parts, the overall compatibility may make some details easier to understand if you read them in one of the other datasheets. Some variants have separate datasheets in English and Chinese, some are Chinese only, that's a simple immediate stop for me. Using any IC over the complexity of .. let's say a HX711 (which is sorta fun to play with) without an English datasheet is simply not acceptable for me.I once spent half a day replacing individual chinese sentences and paragraphs in a .pdf with translated strings from some internet website. It's doable, and it works, but it is a huge effort, mostly because of the horrible way's .pdf files are formatted. The inventor of the .pdf format should have been shot 20 years ago.(Ah well, maybe not that bad. It's not his fault that the .pdf format became a defacto standard and is being abused in horrible ways for which it was never intended.It was designed as a format that could be sent to a printer, and to get back what you sent to the printer company exactly as you sent it. The format was never designed for distributing information such as datasheets, or reflowing on smallish E-readers and tablets).

author: thm_w
author_rank: Super Contributor
timestamp: September 09, 2021, 10:45:40 pm
content: There are some threads here but seems like good info above.I believe the i2c arduino libs did not work for some, and I had issues with USB enumeration on GD32. I'm sure both i2c + USB hardware do work fine, but stm32 code may need tweaking to get it to work on gd32.https://www.eevblog.com/forum/microcontrollers/cheap-bluepill-very-likely-it-has-fake-stm32-right/https://www.blaatschaap.be/32f103-comparison-part-1/https://stm32duinoforum.com/forum/viewtopic_f_47_t_1643.html

author: ledtester
author_rank: Super Contributor
timestamp: August 20, 2022, 04:29:53 am
content: Quote from: DavidAlfa on September 08, 2021, 08:09:14 pmThis video demos the use of a WCH application (WCHISPTool) to load firmware onto a CH32F103:STM32 Bluepill Substitute CH32f103C8T6 Bluepill write Arduino Bootloader, tested with blink and DMPhttps://youtu.be/mmXtcv5BIy8Link to the app:https://www.wch.cn/downloads/WCHISPTool_Setup_exe.htmlThe only issue is that it's in Chinese.

author: SiliconWizard
author_rank: Super Contributor
timestamp: August 20, 2022, 06:53:36 pm
content: And another note: while it would be a good idea in general, it is in particular during this whole shortage period: definitely invest some time learning how to use other MCUs at least as capable, there are literally thousands of them out there. I think that would be time much better invested than spending days or weeks trying to find dodgy stock or possible clones of a F103. Just something to consider.

author: abyrvalg
author_rank: Frequent Contributor
timestamp: August 23, 2022, 09:01:01 am
content: I’m observing an evolution of a mass market (e-scooters) FOC motor controller (PWM, voltage/current sensing ADCs, UARTs, some GPIOs) from STM32F103C to multiple compatible Chinese MCUs: GD32F103C, GD32E103C and, recently, AT32F415C. The only change on hw side so far is paralleling two GPIOs (instead of one on STM) driving an EN pin of a DC-DC regulator (tests with replacing an STM with GD on an old PCB with single GPIO shows unstable turn on/off, some difference in pin drive specs). The other visible change is on sw side - flash programming adaptation to GD32E (it has a 32-bit flash internally, single 16-bit writes, as implememted ST’s SPL, results in data corruption). The rest of the functionality "just works".

author: thm_w
author_rank: Super Contributor
timestamp: August 23, 2022, 10:43:05 pm
content: Quote from: abyrvalg on August 23, 2022, 09:01:01 amWas going to make a thread related to this. The device I have was a mix of GD32 and genuine STM32 parts..I'm surprised you (or someone) bothered to swap the STM with the GD and find this stuff out. But shows the ability the chinese engineers have to get these alternate parts working quickly.

author: ataradov
author_rank: Super Contributor
timestamp: August 23, 2022, 10:55:44 pm
content: There is one place in a world where swapping from ST to GD happens on a scale never seen before - Russia. And from what I've seen people do experience minor issues here and there (especially with timings in analog peripherals), but overall it works fine. And for sure betas using Russian MCUs.

author: abyrvalg
author_rank: Frequent Contributor
timestamp: August 24, 2022, 07:59:11 am
content: The device I’m referring to is “made in China” from the beginning (Xiaomi/Ninebot). Initially they used ST and TI parts, then TI’s DC-DCs were replaced with Silergy’s (superior in Vin range, that looked more like a migration to a better part, not shortage), now they are replacing the MCU with everything they can buy without major firmware redesigns.

author: grantb5
author_rank: Regular Contributor
timestamp: August 24, 2022, 01:16:40 pm
content: Quote from: abyrvalg on August 24, 2022, 07:59:11 amYikes. I hope this device is fixed function and doesn't need firmware updates in the field. I guess they could do it if they knew from the start that the product could have different MCUs.

author: ataradov
author_rank: Super Contributor
timestamp: August 24, 2022, 04:43:34 pm
content: Quote from: grantb5 on August 24, 2022, 01:16:40 pmNothing is stopping you from releasing two different versions of the firmware. and differentiate the devices by the exiting firmware version, or a version mentioned on the sticker or something like this. Even "reputable" companies do this occasionally, so I would not expect this to be an issue.

author: abyrvalg
author_rank: Frequent Contributor
timestamp: August 24, 2022, 04:54:31 pm
content: Indeed, their newer binaries are universal: flash write function detects GD32E by checking GD-specific FMC->PID reg and handles it correctly, the additional GPIO is just used unconditionally (swinging in the air on older hw).

author: grantb5
author_rank: Regular Contributor
timestamp: August 24, 2022, 05:52:00 pm
content: Quote from: abyrvalg on August 24, 2022, 04:54:31 pmThat's very nice. If firmware is sent from a PC application there may need to be some awareness in the downloader software regarding the target system, in case ram buffers vary in size by a lot. Some of the ST parts have different flash block sizes and you only have so much RAM in some cases, so you need to plan ahead for this.

author: rooppoorali
author_rank: Regular Contributor
timestamp: September 12, 2022, 11:30:02 am
content: You may find this review helpful:

author: grantb5
author_rank: Regular Contributor
timestamp: September 12, 2022, 12:48:29 pm
content: Quote from: rooppoorali on September 12, 2022, 11:30:02 amIs there a readable summary that explains what does and does not work?