Author Topic: STM32F103C8 diagnostic bootable binary freely available  (Read 13308 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
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #25 on: February 05, 2020, 09:38:57 am »
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/download

Usage
--------
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 menu

Code: [Select]
m - Menu; STM32F103R8 Test Kit
i - Device ID
b - Device Reported Flash Size in Bytes
t - TEST second 64kB Flash Memory block: 0x10000 - 0x1FFFF
d - Dump second 64kB Flash Memory block: 0x10000 - 0x1FFFF
e - Dump first  64kB Flash Memory block: 0x00000 - 0x10000
a - Author
l - License
q - Quit

Developed 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: [Select]
Testing 64kB Flash block: 0x10000 - 0x1FFFF
Erasing
Flash with 1010101010101010 (0xAA)
Testing for 0xAA - OK
Erasing
Flash with 0101010101010101 (0x55)
Testing for 0x55 - OK
Erasing
~~~~~ ALL TESTS PASSED ~~~~~

More information here: https://mecrisp-stellaris-folkdoc.sourceforge.io/stm32f103c8-diags.html#stm32f103c8-diagnostics

Hi 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-blinky

No C pointers were harmed in the making of this program.

 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #26 on: February 05, 2020, 10:35:58 am »
 :-+

1) To flash with the arduino/stm32duino toolchain using the serial port bootloader use:

Code: [Select]
stm32flash -w STM32F103C8-DIAGNOSTICS /dev/serialportxxxx
stm32flash 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)
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #27 on: February 05, 2020, 10:52:50 am »
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 ?

Ok, 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: [Select]
stm32flash -b 115200 /dev/cu.SLAB_USBtoUART
stm32flash Arduino_STM32_0.9

http://github.com/rogerclarkmelbourne/arduino_stm32

Interface serial_posix: 115200 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (Medium-density)
- RAM        : 20KiB  (512b reserved by bootloader)
- Flash      : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
« Last Edit: February 05, 2020, 11:05:23 am by GeorgeOfTheJungle »
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 280
  • Country: nl
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #28 on: February 05, 2020, 11:01:19 am »

Could you also include PC13, as you did on my custom build?

It *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 ?

The board I will use is https://github.com/a-v-s/pcb_stm32XxxxCx_board
I 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.
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #29 on: February 05, 2020, 12:03:54 pm »
:-+

1) To flash with the arduino/stm32duino toolchain using the serial port bootloader use:

Code: [Select]
stm32flash -w STM32F103C8-DIAGNOSTICS /dev/serialportxxxx
stm32flash 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)

2. It's USB OR PA9/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.
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #30 on: February 05, 2020, 12:09:56 pm »
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 ?

Ok, 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: [Select]
stm32flash -b 115200 /dev/cu.SLAB_USBtoUART
stm32flash Arduino_STM32_0.9

http://github.com/rogerclarkmelbourne/arduino_stm32

Interface serial_posix: 115200 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (Medium-density)
- RAM        : 20KiB  (512b reserved by bootloader)
- Flash      : 128KiB (sector size: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB

Never too late George :)

V2 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.
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #31 on: February 20, 2020, 10:04:49 am »
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-diagnostics

This 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 fails

Plus 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.




 
The following users thanked this post: thm_w, GeorgeOfTheJungle

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #32 on: February 20, 2020, 10:36:32 am »
 :-+

Quote
upload your XML file to the URL or email it to me

The 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
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #33 on: February 20, 2020, 12:13:40 pm »
:-+

Quote
upload your XML file to the URL or email it to me

The 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

Thanks, 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>
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #34 on: February 20, 2020, 12:52:39 pm »
:-+

Quote
upload your XML file to the URL or email it to me

The 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

Thanks, 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>

External 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 upload
  your 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
 

Offline eliocor

  • Supporter
  • ****
  • Posts: 521
  • Country: it
    • rhodiatoce
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #35 on: February 26, 2020, 02:12:33 am »
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.
« Last Edit: February 26, 2020, 02:14:45 am by eliocor »
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #36 on: February 26, 2020, 05:48:08 am »
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.

It'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 ?
 

Offline eliocor

  • Supporter
  • ****
  • Posts: 521
  • Country: it
    • rhodiatoce
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #37 on: March 14, 2020, 12:43:00 am »
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 socket
yellow trace is PBL: strobed for 1ms after about 68ms from Vcc going to 3.3V
zoom.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....  :(
« Last Edit: March 14, 2020, 12:45:24 am by eliocor »
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #38 on: March 23, 2020, 03:06:39 am »
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 socket
yellow trace is PBL: strobed for 1ms after about 68ms from Vcc going to 3.3V
zoom.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....  :(

I've just released V1.4 at https://sourceforge.net/projects/mecrisp-stellaris-folkdoc/files/stm32fxx-diagnostics-v1.4.bin
V1.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.
 

Offline eliocor

  • Supporter
  • ****
  • Posts: 521
  • Country: it
    • rhodiatoce
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #39 on: March 23, 2020, 07:22:04 am »
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.
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #40 on: March 23, 2020, 09:27:49 am »
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.

Excellent news, thanks for the update  :-+
 

Offline roboticboyer

  • Newbie
  • Posts: 2
  • Country: it
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #41 on: July 15, 2020, 08:28:19 pm »
I'm trying a Blue Pill with a "compatible" STM32, probably a GD32F103 with your Diagnostic Tool
When I try all commands such as "t" the response is "t t not found" then "ok ok"
Only "?" responses with the menu

Do you know how to fix this issue?
Is something related to the GD32 chip itself?

Thank you
Gio
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #42 on: July 16, 2020, 02:06:17 am »
I'm trying a Blue Pill with a "compatible" STM32, probably a GD32F103 with your Diagnostic Tool
When I try all commands such as "t" the response is "t t not found" then "ok ok"
Only "?" responses with the menu

Do you know how to fix this issue?
Is something related to the GD32 chip itself?

Thank you
Gio

You 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.
 

Offline roboticboyer

  • Newbie
  • Posts: 2
  • Country: it
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #43 on: July 18, 2020, 07:19:36 am »
Thank You! :-+

Now I'm able to use your good tool with Arduino Serial Monitor => It's required only to select CR not NL+CR

My Blue Pill is inside a GD32F with 128k
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #44 on: July 18, 2020, 09:25:02 am »
Thank You! :-+

Now I'm able to use your good tool with Arduino Serial Monitor => It's required only to select CR not NL+CR

My Blue Pill is inside a GD32F with 128k

Excellent, thank you for the update.
 

Offline techman-001Topic starter

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: STM32F103C8 diagnostic bootable binary freely available
« Reply #45 on: October 22, 2020, 08:38:56 am »
Announcing my last update, stm32fxx-diagnostics-v1.5.bin

It'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.html

Cheers,
Terry
 
The following users thanked this post: ralphrmartin, Jacon


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf