STM32F103C8 diagnostic bootable binary freely available - Page 1
Forum section: electronics / general

author: techman-001
author_rank: Frequent Contributor
timestamp: December 15, 2019, 11:34:55 am
content: Hi All,Announcing a bootable 52.6kB diagnostic test kit binary for the STM32F103C8 such as used in the "Blue Pill Board". The size is under 64kB so that it can be flashed by OpenOCD to a MCU claiming only 64kB of Flash in the "Flash size register".The purpose of this kit is to physically test the "hidden" 64kB second Flash block present on many of these chips and determine if it exists and if it is reliable. It does this by flashing all the bits from one to zero and back again.Download here:https://sourceforge.net/projects/mecrisp-stellaris-folkdoc/files/STM32F103C8-DIAGNOSTICS.bin/downloadUsage--------1. Flash the STM32F103C8-DIAGNOSTICS.bin image to your board with OpenOCD or whatever you normally use.2. Plug in a USB cable to the “Blue Pill” board and run a serial terminal program on your PC. This will also power the board.3. Enter “?” at the prompt to obtain the menu.Menu-------Enter ? for the menuCode:m - Menu; STM32F103R8 Test Kiti - Device IDb - Device Reported Flash Size in Bytest - TEST second 64kB Flash Memory block: 0x10000 - 0x1FFFFd - Dump second 64kB Flash Memory block: 0x10000 - 0x1FFFFe - Dump first 64kB Flash Memory block: 0x00000 - 0x10000a - Authorl - Licenseq - QuitDeveloped on a STM32F103C8 board (with the "hidden" second 64kB Flash block present) which is identical to a "Blue Pill", so it should work on all such boards.Note: there are only three Block erasures and two Block flashes when this test is run, so the Flash wear is negligible.A successful test looks like this:Code:Testing 64kB Flash block: 0x10000 - 0x1FFFFErasingFlash with 1010101010101010 (0xAA)Testing for 0xAA - OKErasingFlash with 0101010101010101 (0x55)Testing for 0x55 - OKErasing~~~~~ ALL TESTS PASSED ~~~~~More information here:https://mecrisp-stellaris-folkdoc.sourceforge.io/stm32f103c8-diags.html#stm32f103c8-diagnostics

author: fmkit
author_rank: Contributor
timestamp: December 15, 2019, 11:48:17 am
content: have you found a real 64kb C8 ? out of 20 chips I tried all were 128kb

author: techman-001
author_rank: Frequent Contributor
timestamp: December 15, 2019, 12:14:20 pm
content: Quote from: fmkit on December 15, 2019, 11:48:17 amNot yet. I only have 10 boards all with 128kB and 20 new 64 pin flatpack chips but with no ZIFF socket I won't be trying them for a while.The reason I made the test image is because no one is sure whether the extra 64kB is ok or not, i.e. whether there may be a bad bit in there or not.This test will find a bad bit.

author: ebclr
author_rank: Super Contributor
timestamp: December 15, 2019, 01:02:45 pm
content: Did you make this bin in FORTH ?

author: fmkit
author_rank: Contributor
timestamp: December 15, 2019, 04:11:26 pm
content: Flash size can be read at 0x1FFF F7E0

author: rhodges
author_rank: Frequent Contributor
timestamp: December 15, 2019, 04:41:01 pm
content: I am using minicom on a Raspberry PI. First thing is to change the serial port from /dev/ttyUSB0 to /dev/ttyACM0.Testing a CPU marked STM32F103C8T6:Code:stm32idDie xy coords: 107806545Wafer Number: 73Lot_num ascii encoded [23:0]: 0x00485478 | H T xLot_num ascii encoded [55:24]: 0x67244344 | g $ C DFlash Size Register = 65536 BytesTesting 64kB Flash block: 0x10000 - 0x1FFFFErasingFlash with 1010101010101010 (0xAA)Testing for 0xAA - OKErasingFlash with 0101010101010101 (0x55)Testing for 0x55 - OKErasing~~~~~ ALL TESTS PASSED ~~~~~My first test, though was accidentally a CKS CS32F103C8T6 that an ebay seller sold as the ST part.EDIT: The part number is actually CKS32F103C8T6.Code:stm32idDie xy coords: 16917299Wafer Number: 50Lot_num ascii encoded [23:0]: 0x004D3712 | M 7 .Lot_num ascii encoded [55:24]: 0x004E4B43 | . N K CFlash Size Register = 65536 BytesTesting 64kB Flash block: 0x10000 - 0x1FFFFErasingFAILTEST: $10000 Data = $8CFAILTEST: $10001 Data = $03... all the way toFAILTEST: $1CDE5 Data = $BDFAILTEST: $1CDE6 Data = $00FAILTEST: $1CDE7 Data = $00blank check FAILTESTIt looks like the binary I just flashed. Apparently this chip reads the second 64K from the first.

author: techman-001
author_rank: Frequent Contributor
timestamp: December 15, 2019, 05:41:04 pm
content: Quote from: ebclr on December 15, 2019, 01:02:45 pmYes I did.The binary is a complete Mecrisp-Stellaris Cortex-M3 Forth.

author: techman-001
author_rank: Frequent Contributor
timestamp: December 15, 2019, 06:07:12 pm
content: Quote from: rhodges on December 15, 2019, 04:41:01 pmThanks for the feedback, I wasn't able to verify proper bad chip detection with a bad chip because 'unfortunately' mine are all good ;-)You're right, the bootable binary finishes at 0xCDE7 and is the same data as you have listed above.Did you enable the Minicom log then press "d" to generate a dump of the binary data at 0x10000 - 0x1FFFF ?

author: rhodges
author_rank: Frequent Contributor
timestamp: December 15, 2019, 06:53:46 pm
content: QuoteYes. At the end, I saw the GPL text and some strings from your test code.

author: bingo600
author_rank: Super Contributor
timestamp: December 15, 2019, 09:12:48 pm
content: @techman-001Nice testAnd apparently "One bites the dust".I was under the impression, that even those CKS had 2 x 64K.Now to avoid those bluepill's on Ali/*bayThnx/Bingo

author: techman-001
author_rank: Frequent Contributor
timestamp: December 15, 2019, 10:36:50 pm
content: Quote from: rhodges on December 15, 2019, 06:53:46 pmDetective RHodges is on the job!

author: techman-001
author_rank: Frequent Contributor
timestamp: December 15, 2019, 10:42:25 pm
content: Quote from: bingo600 on December 15, 2019, 09:12:48 pmThanksYou're responsible anyway, for giving me the nudge to look into this.Bluepills are like a box of chocolates .... but then one doesn't get many chocolates for under $2 these days.

author: techman-001
author_rank: Frequent Contributor
timestamp: December 25, 2019, 10:00:25 am
content: Now with a Xmas Day video"Did Santa bring your Blue Pill Board a free 64kB for Xmas ?"https://youtu.be/xpTvd1Zhe0U

author: Doctorandus_P
author_rank: Super Contributor
timestamp: January 08, 2020, 12:13:02 am
content: I did not spend much time on this, as I'm not interested in binary blobs, but still had a look...Then I saw it was soe FORTH thing, and that done it, closed the website.I don't have anything against FORTH, but I am simply not interested in learning yet another language.

author: BravoV
author_rank: Super Contributor
timestamp: January 14, 2020, 11:59:31 am
content: Mr.Porter,Reporting my BluePill, the one with the printed "RESRT" label for the RESET button.From this thread ->Cheap Bluepill, very likely it has fake STM32 right ?Using your latest STM32F103R8 Test Kit v1.2 24Dec2019 version.Result from "i" command :Code:stm32idDie xy coords: 16985357Wafer Number: 45Lot_num ascii encoded [23:0]: 0x004D3812 | M 8 .Lot_num ascii encoded [55:24]: 0x004E4B43 | . N K CResult from "b" command :Code:Flash Size Register = 131072 BytesResult from "t" command :Code:Testing 64kB Flash block: 0x10000 - 0x1FFFFErasingFlash with 1010101010101010 (0xAA)Testing for 0xAA - OKErasingFlash with 0101010101010101 (0x55)Testing for 0x55 - OKErasing~~~~~ ALL TESTS PASSED ~~~~~

author: techman-001
author_rank: Frequent Contributor
timestamp: January 14, 2020, 01:17:13 pm
content: Quote from: BravoV on January 14, 2020, 11:59:31 amG'day BravoV,Thanks for the feedback.I suspect that your chip may be a Chinese clone, the "CKS32F103C8T6" because it uses hexadecimal for the LOT numbers, the same as yours and has 131072 bytes of ram. Finally your chip "Die xy coords" are very similar to Chinese clone #1 below.STM32F103CX don't use hexadecimal for the LOT numbers.Can you see any part numbers on your chips ? Either way they report 131072 bytes of flash and also test ok, that means they do have 131072 bytes of working flash as reported.Here are two user submissions for CKS32F103C8T6's-------------------------------------Chinese clone #1CKS32F103C8T6Die xy coords: 16985099Wafer Number: 42Lot_num ascii encoded [23:0]: 0x004D3512 | M 5 .Lot_num ascii encoded [55:24]: 0x004E4B31 | . N K 1FreeFLASH.. TOTAL REPORTED: 131072 USED: 51200 FREE: 79872----------------------------------Chinese clone #2CKS32F103C8T6Die xy coords: 276745Wafer Number: 42Lot_num ascii encoded [23:0]: 0x004D3512 | M 5 .Lot_num ascii encoded [55:24]: 0x004E4B31 | . N K 1FLASH.. TOTAL REPORTED: 131072 USED: 51200 FREE: 79872Cheers,Terry

author: BravoV
author_rank: Super Contributor
timestamp: January 15, 2020, 02:59:14 am
content: The interesting comparison when reading the "Lot" number in ASCII form :Your others CKS stringM5..NK1While mine hasM8..NKCNewer CKS revision maybe ?Also remember "F" character at the label position, as its printed at the 1st line, instead of 2nd line.PS : Btw, regarding my report & photos, feel free to use it as you want, like for your blog.

author: techman-001
author_rank: Frequent Contributor
timestamp: January 15, 2020, 04:34:10 am
content: Quote from: BravoV on January 15, 2020, 02:59:14 amYou can disregard the ASCII output because those dots are HEX numbers and discarded by my program. As they're just lot numbers there is no version information.Ah yes, the position of the F could well be a clue the chip is fake.Thanks, I will definitely use your data in my blog as it may help others with Blue Pills.

author: BravoV
author_rank: Super Contributor
timestamp: January 15, 2020, 08:35:20 am
content: Quote from: techman-001 on January 15, 2020, 04:34:10 amAnd coincidentally... on CKS, they have the same style too which put the "F" at the 1st line.I've read somewhere, that counterfeiters nowadays also want their product can be identified, as they need it for traceabilities in the supply chain and distribution, as cosmetic/appearance can be made almost perfect now.I guess the reset button label (RESRT) is also deliberately misspelled.

author: techman-001
author_rank: Frequent Contributor
timestamp: January 29, 2020, 01:18:25 pm
content: Quote from: techman-001 on December 15, 2019, 11:34:55 amG'day,So far there have been 78 downloads of this diagnostics program. My thanks to those who provided feedback and dataI'm about to release V2 which incorporates improvements and bug fixes.Before I finish this release are there any changes or additions you would like to see to the menu to improve this free diagnostic program ?Cheers ...

author: Mecanix
author_rank: Frequent Contributor
timestamp: February 04, 2020, 10:01:36 pm
content: Great script, looking forward V2.0

author: eliocor
author_rank: Unknown
timestamp: February 05, 2020, 12:05:10 am
content: will it be possible to compile a version with PB9 active?It is needed to enable the USB port on Maple Mini clones:https://stm32-base.org/boards/STM32F103C8T6-Maple-Mini-Clone.html

author: techman-001
author_rank: Frequent Contributor
timestamp: February 05, 2020, 01:57:33 am
content: Quote from: eliocor on February 05, 2020, 12:05:10 amAbsolutely, great idea!I'll enable USB for the Blue Pill, Olimex-P103 and the Maple-Mini, all at the same time on the new STM32F103C8 Diagnostic V2.Different Firmware won't be needed.Thanks

author: GromBeestje
author_rank: Frequent Contributor
timestamp: February 05, 2020, 08:11:39 am
content: Quote from: techman-001 on February 05, 2020, 01:57:33 amCould you also include PC13, as you did on my custom build?

author: techman-001
author_rank: Frequent Contributor
timestamp: February 05, 2020, 08:56:39 am
content: Quote from: GromBeestje on February 05, 2020, 08:11:39 amIt *would* be my pleasure but ...Blue pills have their user LED at PC13, any suggestions how we might accommodate this in the one build ?An option jumper perhaps ?

author: techman-001
author_rank: Frequent Contributor
timestamp: February 05, 2020, 09:38:57 am
content: Quote from: techman-001 on December 15, 2019, 11:34:55 amHi All,For those inquisitive souls among us ...A gentle introduction to Forth via a PC13 LED Blinky for use with the STM32F103C8-DIAGNOSTICS.bin running on a generic Blue Pill Board.The STM32F103C8-DIAGNOSTICS.bin is the perfect vehicle for this as it's a complete Forth system itself.https://mecrisp-stellaris-folkdoc.sourceforge.io/bluepill-blinky.html#bluepill-blinkyNo C pointers were harmed in the making of this program.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: February 05, 2020, 10:35:58 am
content: 1) To flash with the arduino/stm32duino toolchain using the serial port bootloader use:Code:stm32flash -w STM32F103C8-DIAGNOSTICS /dev/serialportxxxxstm32flash is inside the Arduino/hardware/Arduino_STM32/tools/ folder, or here:https://github.com/stm32duino/stm32flash---------2) Upon reboot the serial port @ PA9/10 stops working and I can only connect through USB.3) LED ON doesn't work. My LED is at pin PC13 (robotdyn black pill, standard blue pill)

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: February 05, 2020, 10:52:50 am
content: Quote from: techman-001 on January 29, 2020, 01:18:25 pmOk, I'm a bit late buuut, here's my suggestion. Instead of i) and b) that report tiny bits of info each, leave a single i) that prints a longer chip report similar to what smt32flash does:Code:stm32flash -b 115200 /dev/cu.SLAB_USBtoUARTstm32flash Arduino_STM32_0.9http://github.com/rogerclarkmelbourne/arduino_stm32Interface serial_posix: 115200 8E1Version : 0x22Option 1 : 0x00Option 2 : 0x00Device ID : 0x0410 (Medium-density)- RAM : 20KiB (512b reserved by bootloader)- Flash : 128KiB (sector size: 4x1024)- Option RAM : 16b- System RAM : 2KiB

author: GromBeestje
author_rank: Frequent Contributor
timestamp: February 05, 2020, 11:01:19 am
content: Quote from: techman-001 on February 05, 2020, 08:56:39 amThe board I will use ishttps://github.com/a-v-s/pcb_stm32XxxxCx_boardI have this solder bridge I can use to hard wire the pull up resistor to VCC, and put it back to PC13 afterwards.I guess that would be the easiest for the moment.Or can we make it auto-detect the board? Upon boot, if you read PA12 as input, if it is high, the board has hard wired pull up, so it might be running on a Blue Pill, and PC13 can be selected as LED pin. if it is low, you have to pull it up by one of the pins PB9 or PC13. As we've identified the board not being a standard Blue Pill, this would be safe to do.For now APM32, CS32, and GD32 have passed my initial tests to have at least some level of STM32F1 compatibility.BLM32 and MM32 failed. BLM offers no docs/libs. MM does.

author: techman-001
author_rank: Frequent Contributor
timestamp: February 05, 2020, 12:03:54 pm
content: Quote from: GeorgeOfTheJungle on February 05, 2020, 10:35:58 am2. It's USBORPA9/10. USB is the default, but from USB you can enter "-usb" and it swaps to PA9/10.3. Yeah led.on was for my own testing, I have to sort out how to handle different LED wiring yet.

author: techman-001
author_rank: Frequent Contributor
timestamp: February 05, 2020, 12:09:56 pm
content: Quote from: GeorgeOfTheJungle on February 05, 2020, 10:52:50 amNever too late GeorgeV2 does a all in one report and even a optional XML output for, records and later DB entry and analysis.V2 focuses on obtaining correct data for posterity!The 'hidden' 64kB block test can't be run automatically as it will throw a exception on chips without it, so this test still needs to be manually selected.

author: techman-001
author_rank: Frequent Contributor
timestamp: February 20, 2020, 10:04:49 am
content: Hi All,My new version of the diagnostics program, stm32fxx-diagnostics-v1.0.bin is now available, please see:https://mecrisp-stellaris-folkdoc.sourceforge.io/stm32f1xx-diagnostics.html#stm32f103xx-diagnosticsThis is the new version of STM32F103C8-DIAGNOSTICS.bin which was my first exploratory program to explore what actual MCU was in any of the infamous Blue Pill boards. The Blue Pill suffered from many issues but the most serious was the use of 'fake' and 'compatible' non genuine STM32F103 chips.The new stm32f103xx-diagnostics contains lessons learned from the above and adds new features such as :-* Attempts to tell if the MCU is a STM32F,CS32F or APM32F or a GB32F* Simpler, cleaner Main Menu* Extra Menu* Generates a XML dump of all the data with suggested unique filename. This can them be uploaded to a database to examine what chips and memory have been found. This can then be uploaded, see the "FAQ" for details.* Should work with the Maple Mini board* Halts nicely with a error message if the second 64kB Flash block failsPlus the old capabilities:* Under 64kB in size so it can be loaded and run from any STM32F1xx class with 64kB Flash* Bootable* Creates a "Mecrisp STM32F10x Forth Serial Port, class 2/0, rev 2.00/2.00, " virtual serial port device on your PC* Dump the contents of the first 64kB Flash block* Dump the contents of the second 64kB Flash block* FAQ's, Credits, and Liucense are in the "Extra" menu* Serial can be connected to USART2 instead of USB.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: February 20, 2020, 10:36:32 am
content: QuoteThe URL is:* Why is there a XML dump ? << To build a database of genuine vs fake chips. Please upload yours to:https://sourceforge.net/p/mecrisp-stellaris-folkdoc/discussion/general/thread/a0e1c385e8/#7dc0

author: techman-001
author_rank: Frequent Contributor
timestamp: February 20, 2020, 12:13:40 pm
content: Quote from: GeorgeOfTheJungle on February 20, 2020, 10:36:32 amThanks, chip ID: 704FAE48 definitely looks like a genuine STM32F103C8 to me.Somehow we have two 'external markings' selections, so that's my first bug to fix:<stm32f103c8>1 </stm32f103c8><stm32f103cb>1 </stm32f103cb>

author: techman-001
author_rank: Frequent Contributor
timestamp: February 20, 2020, 12:52:39 pm
content: Quote from: techman-001 on February 20, 2020, 12:13:40 pmExternal markings bug fixed in V1.1 on the website:https://sourceforge.net/projects/mecrisp-stellaris-folkdoc/files/stm32fxx-diagnostics-v1.1.bin* Why is there a XML dump ? << To build a database of genuine vs fake chips. Please uploadyour data as a FILE, *not a picture* using the file name suggested in the dump to:https://sourceforge.net/p/mecrisp-stellaris-folkdoc/discussion/general/thread/a0e1c385e8/#7dc0

author: eliocor
author_rank: Unknown
timestamp: February 26, 2020, 02:12:33 am
content: Sorry to bother you, but I tried you binary file (v1.1) on several Maple Mini boards (various HW releases) but with no avail.Windows does not recognize the USB device (not even a "faulty" USB device)If needed I'm available to make some tests for you.

author: techman-001
author_rank: Frequent Contributor
timestamp: February 26, 2020, 05:48:08 am
content: Quote from: eliocor on February 26, 2020, 02:12:33 amIt's no bother, I'm happy to get it working with other boards.My information is that PB9 pulsed high enables USB on the Maple Mini, and this should be happening with my stm32fxx-diagnostics-v1.1.bin, the pulse is about 10 milliseconds wide.If you have a scope or whatever can you check this is happening and do you know if it's the right polarity ?

author: eliocor
author_rank: Unknown
timestamp: March 14, 2020, 12:43:00 am
content: Using some spare time* I made the tests you required: please take a look to the attached picture for more details.cyan trace is Vcc: from 0 to 3.3V when the Maple Mini board is plugged into the USB socketyellow trace is PBL: strobed for 1ms after about 68ms from Vcc going to 3.3Vzoom.png shows the USB enable (PB9) pulse.To my knowledge (tested with a CDC device) you need to set PB9 to 0 (without pulsing it) to activate the communication with the PC.If you put PB9 to 1 the device will disconnect from the PC.I tested the Maple Mini with v1.3 of your utility.*) I live in Italy so I'm stranded at home....

author: techman-001
author_rank: Frequent Contributor
timestamp: March 23, 2020, 03:06:39 am
content: Quote from: eliocor on March 14, 2020, 12:43:00 amI've just released V1.4 athttps://sourceforge.net/projects/mecrisp-stellaris-folkdoc/files/stm32fxx-diagnostics-v1.4.binV1.4: Changed PB9 to permanent LOW for Maple Mini, menu is run from boot, Version number is automatically displayed in the menu.Please let me know how it goes ?Stay safe, sorry to hear about the Covid-19 dramas and high death rate in Italy, home of my Motoguzzi Griso.

author: eliocor
author_rank: Unknown
timestamp: March 23, 2020, 07:22:04 am
content: It works flawlessly!I tested it on 6 Maple Mini: it seems they have original SM32F103CB micros.I tried to upload the .XML files but I'm awaiting for posting moderation..... thanks_ Elio.

author: techman-001
author_rank: Frequent Contributor
timestamp: March 23, 2020, 09:27:49 am
content: Quote from: eliocor on March 23, 2020, 07:22:04 amExcellent news, thanks for the update

author: roboticboyer
author_rank: Newbie
timestamp: July 15, 2020, 08:28:19 pm
content: I'm trying a Blue Pill with a "compatible" STM32, probably a GD32F103 with your Diagnostic ToolWhen I try all commands such as "t" the response is "t t not found" then "ok ok"Only "?" responses with the menuDo you know how to fix this issue?Is something related to the GD32 chip itself?Thank youGio

author: techman-001
author_rank: Frequent Contributor
timestamp: July 16, 2020, 02:06:17 am
content: Quote from: roboticboyer on July 15, 2020, 08:28:19 pmYou enter "?" to run the menu, then entering "t" etc will work. You don't press enter after a menu command, it runs when you just press the key.If you get "t t not found" or similar it means you entered a non menu key and it quit out of the menu, so youre actually in the Forth command line. Entering "?" restarts the menu.I've made a new version which wont quit the menu so easily but have to do a few more tests yet, and then will upload it onto my site. I'll announce the new version here when it's ready.

author: roboticboyer
author_rank: Newbie
timestamp: July 18, 2020, 07:19:36 am
content: Thank You!Now I'm able to use your good tool with Arduino Serial Monitor => It's required only to select CR not NL+CRMy Blue Pill is inside a GD32F with 128k

author: techman-001
author_rank: Frequent Contributor
timestamp: July 18, 2020, 09:25:02 am
content: Quote from: roboticboyer on July 18, 2020, 07:19:36 amExcellent, thank you for the update.

author: techman-001
author_rank: Frequent Contributor
timestamp: October 22, 2020, 08:38:56 am
content: Announcing my last update, stm32fxx-diagnostics-v1.5.binIt's much the same as V1.4 but the menu is now robust and won't kick you out back to the command line when a non menu key is hit, including enter.However if the test for a hidden second 64KB flash fails that may kick back to the cli so just enter 'menu' should that happen.The binary, menu pictures and README are here:https://mecrisp-stellaris-folkdoc.sourceforge.io/stm32f1xx-diagnostics.htmlCheers,Terry