Black Magic Probe on an stm32f103c8

Locked
edogaldo
Posts: 263
Joined: Fri Jun 03, 2016 8:19 am

Re: Black Magic Probe on an stm32f103c8

Post by edogaldo » Wed Oct 26, 2016 2:14 pm

Hi there, I was planning to create my BMP for upload & debug purpose.
I've seen suggestions about using the cheapest blue pill anyway I have a concern on this: blue pills (and newer black pills - viewtopic.php?f=28&t=117&start=170#p18316) have a quite low power LDO so:
  • Would the blue pill LDO be enough to power up the target board, upload and debug at least non power demanding sketches?
  • In case the power provided by the blue pill based BMP is not enough, how else should I power the target board?
  • Could it be better to use a board which features a AMS1117?!
Thanks in advance and bye, E.

Side questions for who have both the blue pill and the new black pill: which one would you suggest and why?

User avatar
Rick Kimball
Posts: 1011
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Black Magic Probe on an stm32f103c8

Post by Rick Kimball » Wed Oct 26, 2016 2:24 pm

The one blue pill I have setup as a BMP programmer I had to replace the LDO with a microchip mcp1702. If I hadn't shorted the power pins I'd still be using the original LDO. The mcp1702 is a 250mA max device and seems to work fine. Others have indicated the typical LDO on the blue pills are 300mA max. Seems like it would be fine with the one that ships onboard.

-rick
-rick

edogaldo
Posts: 263
Joined: Fri Jun 03, 2016 8:19 am

Re: Black Magic Probe on an stm32f103c8

Post by edogaldo » Wed Oct 26, 2016 2:33 pm

Rick Kimball wrote:The one blue pill I have setup as a BMP programmer I had to replace the LDO with a microchip mcp1702. If I hadn't shorted the power pins I'd still be using the original LDO. The mcp1702 is a 250mA max device and seems to work fine. Others have indicated the typical LDO on the blue pills are 300mA max. Seems like it would be fine with the one that ships onboard.

-rick
Thanks Rick, you mean it's fine to power both boards, correct?

User avatar
Rick Kimball
Posts: 1011
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Black Magic Probe on an stm32f103c8

Post by Rick Kimball » Wed Oct 26, 2016 2:38 pm

Yes that is what I was doing. Of course if the target board is power hungry, that isn't going to work.
-rick

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Black Magic Probe on an stm32f103c8

Post by michael_l » Mon Dec 05, 2016 10:44 am

I've read almost the whole discussion but I can't decide... I have two ST-Link V2 dongles and blue stm32F103c8t6 boards. Which option is suggested ?

1) Flash BMP FW into st-link using the second st-link dongle
2) Flash BMP FW into blue stm32F103c8t6 board

User avatar
Rick Kimball
Posts: 1011
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Black Magic Probe on an stm32f103c8

Post by Rick Kimball » Mon Dec 05, 2016 3:03 pm

michael_l wrote:I've read almost the whole discussion but I can't decide... I have two ST-Link V2 dongles and blue stm32F103c8t6 boards. Which option is suggested ?

1) Flash BMP FW into st-link using the second st-link dongle
2) Flash BMP FW into blue stm32F103c8t6 board
I personally wouldn't overwrite a ST-Link V2 device. Those work great when used with openocd and probably do what you want now without hassle. I have an ST-Link V1 that someday I might replace with BMP. However if I did, I wouldn't use this version, I'd use the blackmagic probe included stlink platform and grab the latest code. Use $ make PROBE_HOST=stlink instead of this.

If you decide to use an stm32f103c8t6, you might just skip this port and also use the stlink target. I just tried that yesterday and it is workable (although using different pins) without having to use this port. The only difference is that it doesn't re-enumerate the usb when you press the reset button on the bluepill board. You have to unplug and plug the usb to reset the usb.

I've learned a lot about the stm32f1 chips and the quirks of the bluepill and maple mini boards since I originally posted this code. You really don't need this version, for the bluepill. A lot of my early problems stemmed from the bluepill board having with the wrong pull up resistor value and me not knowing that for a while. For the maple mini you have use usb reset pin properly for it to work and roger has a blackmagic port for that board.

-rick
-rick

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Black Magic Probe on an stm32f103c8

Post by michael_l » Mon Dec 05, 2016 5:46 pm

Rick Kimball wrote:
michael_l wrote:I've read almost the whole discussion but I can't decide... I have two ST-Link V2 dongles and blue stm32F103c8t6 boards. Which option is suggested ?

1) Flash BMP FW into st-link using the second st-link dongle
2) Flash BMP FW into blue stm32F103c8t6 board
I personally wouldn't overwrite a ST-Link V2 device. Those work great when used with openocd and probably do what you want now without hassle. I have an ST-Link V1 that someday I might replace with BMP. However if I did, I wouldn't use this version, I'd use the blackmagic probe included stlink platform and grab the latest code. Use $ make PROBE_HOST=stlink instead of this.

If you decide to use an stm32f103c8t6, you might just skip this port and also use the stlink target. I just tried that yesterday and it is workable (although using different pins) without having to use this port. The only difference is that it doesn't re-enumerate the usb when you press the reset button on the bluepill board. You have to unplug and plug the usb to reset the usb.

I've learned a lot about the stm32f1 chips and the quirks of the bluepill and maple mini boards since I originally posted this code. You really don't need this version, for the bluepill. A lot of my early problems stemmed from the bluepill board having with the wrong pull up resistor value and me not knowing that for a while. For the maple mini you have use usb reset pin properly for it to work and roger has a blackmagic port for that board.

-rick
Thanks Rick, I think I'll flash it into bluepill. I'll just have to find the IO and CLK pins that it uses from the BMP source which seem to be PA13 and PA14. And are there pins for leds for serial led activity also? And does SWO pin work too ?

EDIT: found these from platform.h

Code: Select all

/* Important pin mappings for STM32 implementation:
 *
 * LED0 = 	PB2	(Yellow LED : Running)
 * LED1 = 	PB10	(Yellow LED : Idle)
 * LED2 = 	PB11	(Red LED    : Error)
 *
 * TPWR = 	RB0 (input) -- analogue on mini design ADC1, ch8
 * nTRST = 	PB1
 * SRST_OUT = 	PA2
 * TDI = 	PA3
 * TMS = 	PA4 (input for SWDP)
 * TCK = 	PA5
 * TDO = 	PA6 (input)
 * nSRST = 	PA7 (input)
 *
 * USB cable pull-up: PA8
 * USB VBUS detect:  PB13 -- New on mini design.
 *                           Enable pull up for compatibility.
 * Force DFU mode button: PB12
 */
Yes, ST-Link V2 works just great with latest openocd. Had no issues with that so far and setting it up i.e. in Eclipse or CodeBlocks is a not that difficult anymore if you understand how openocd and ST-Link work together. I guess now I want to try BMP and make some comparisons to ST-Link V2.


I wonder how these projects (BMP, openocd) started with SWD protocol and came up with working implementations..

User avatar
RogerClark
Posts: 6890
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Black Magic Probe on an stm32f103c8

Post by RogerClark » Mon Dec 05, 2016 7:16 pm

BTW.

I tried to compile and flash the latest version of the BMP onto a STLink made by Baite ( the same company that sell the Maple mini clones)

But it doesn't work at all. ( USB is not working)

I do have an old version of the BMP that works in those STLinks, which is based on Ricks BluePill port of the BMP.
But the BMP core code has changed a lot since Rick did has BluePill version, so its not possible to simply copy the platform files for the Baite STLink into the new code.

And at the moment I don't have the time to bring the old code up to date, so I'm continuing to use the old version.

In the longer term however I was intending to do a Baite STLink "platform" and submit it as a PR.
However as Gareth is now doing a commercial push for to sell the BMP via kickstarter, I have a concern that doing this would allow Baite to bring out a $3 BMP, as they already use the same hardware has another programmer as well as a STLink, and it would be incredibly easy for them to drastically undercut Gareths price.

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Black Magic Probe on an stm32f103c8

Post by michael_l » Mon Dec 05, 2016 7:30 pm

Thanks Roger, that's good to know. Yes, ST Link dongle might be a bit more compact as a BMP compared to bluepill and it has that nice metallic cover too.Since I have another St Link V2 dongle it's easy to flash any board.

I'll try latest stlink binary and see how it works on bluepill.

User avatar
RogerClark
Posts: 6890
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Black Magic Probe on an stm32f103c8

Post by RogerClark » Mon Dec 05, 2016 7:41 pm

do you mean the BMP binary for STLink?

i would be surprised if it runs on the Blue Pill if it doesnt work on the Baite STLink as the Baite STLink is basically the same as the BluePill, just with much less GPIO.

Actually, after saying that... I guess i should look at the schematic for a STLink dongle vs a STLink on a Nucleo, as AFIK the BMP code is designed to run on a Nucleo or Discovery STLink and the USB enumeration reset circuit may be different between those 2 types of board.

Locked