making blackmagic probe from stm32 chip board

kalregus
Posts: 5
Joined: Wed Jan 18, 2017 8:30 pm

making blackmagic probe from stm32 chip board

Post by kalregus » Wed Jan 18, 2017 9:49 pm

Hi guys.

I am trying to program NRF51822, and here, on this forum i've found recipe to make black magic probe out of stlink board (http://www.stm32duino.com/viewtopic.php?t=122). Because that thread is closed, i decided to make a new one. Unfortunatelly i can not find some answers in that closed thread.

First thing - i bought boards like this:
https://drive.google.com/file/d/0B02vrP ... sTlJz/view

You can see there (from bottom) - uart converter (1), sth like maple mini stlink board (2), board with wires - also stlink, but different vendor (probably stmicroelectronics board or its clone - 3), also nrf51822 chip (4) and nrf51 DK motherboard by waveshare (5).

I found some tutorials on YT how to compile bin, but since i am windows user i cant (or dont know how to prepare those bin).

First of all i connected board 2 to windows - it hasnt been found (device manager says "Unknown device"). Even installing STlink v2 drivers didnt helped it
Next i connected board 3 - windows found it easily. After starting Stlink Utility i could connect to that board, and update firmware. Also, after connecting board 2 to board 3 via swd i could connect it.

I started to search bin of black magic probe which wasnt attached to
http://www.stm32duino.com/viewtopic.php?t=122

Fortunately i found them here:
http://builds.blacksphere.co.nz/blackmagic/

downloaded stlink file and programmed it to board 3 with board 2, after erasing whole chip.
I see that everything is flashed correctly (from address 0x08000000 memory looks like downladed bin), but still flashed chip (2) isnt recognized by system - it is still Unknown device even if i downladed BMP drivers from https://web.archive.org/web/20160331030 ... blackmagic

I hope all those links will help someone which would encounter same problems as i did.
And now comes time for question:

What am i doing wrong? Is the bin file wrong? Or maybe my stlink board i am trying to flash is damaged? I also consider that i have some vendor-driver recognition problems. Or maybe there is something else? Please advice.

Kalreg.

Also useful links are:
https://github.com/blacksphere/blackmagic
https://www.deltanova.co.uk/electronics/arm/blackmagic/
https://github.com/RickKimball/blackmag ... _coreboard

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

Re: making blackmagic probe from stm32 chip board

Post by Rick Kimball » Wed Jan 18, 2017 10:22 pm

on your bluepill board, have you checked the R10 pullup resistor to see if it is 1k5 ?
-rick

kalregus
Posts: 5
Joined: Wed Jan 18, 2017 8:30 pm

Re: making blackmagic probe from stm32 chip board

Post by kalregus » Wed Jan 18, 2017 10:46 pm

For sure i didnt had any resistor. Where should it be connected? While flashing board or while normal work? To which pins should it be connected?
Forgive my lack of english but is pull up resistor normal resistor?

kalregus
Posts: 5
Joined: Wed Jan 18, 2017 8:30 pm

Re: making blackmagic probe from stm32 chip board

Post by kalregus » Wed Jan 18, 2017 10:48 pm

And to be completely sure - blue pill is the board that is flashing the other one, not the one that is flashed?

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

Re: making blackmagic probe from stm32 chip board

Post by Rick Kimball » Wed Jan 18, 2017 11:31 pm

R10 is the resistor marking on "most" bluepills. Unfortunately, there is no such thing as a "typical" bluepill. Each one is different. The R10 resistor is the pull up on the USB +DM pin on the bluepill I personally have and one one that is often talked about. However you didn't link a schematic for which specific bluepil you have so I can only guess which one you have. Often, and possibly not relevant here as I've heard recent bluepill purchases are providing a 1k5 resistor, the pull up resistor on the USB D+ pin is wrong.

On my bluepill I have they were 10K instead of 1k5 and didn't allow my computer to enumerate them. This is not something you should normally have to mess with. The problem is that many bluepill manufacturers don't give a shit and just put whatever resistors they have lying around. Problematic is that some computers will put up with this abuse of a 10k resistor and work properly anyways. So get out your multimeter and check the resistance of the USB D+ pin. If you look at the wiki and posts here you will see this is a common problem people with a blue pill have to deal with.

The bottom line, if you have a computer that expects a USB standard 1k5 pull up resistor then it will never enumerate properly which will prevent you from using it as a CDC device.

As you already have purchased a stlink device, instead of trying to flog yourself using a BMP, you might do a google search and see how to use openocd and and stlink-v2 device to debug and flash an nrf51822 device.

-rick
-rick

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

Re: making blackmagic probe from stm32 chip board

Post by RogerClark » Thu Jan 19, 2017 12:22 am

kalregus wrote: downloaded stlink file and programmed it to board 3 with board 2, after erasing whole chip.
I see that everything is flashed correctly (from address 0x08000000 memory looks like downladed bin), but still flashed chip (2) isnt recognized by system - it is still Unknown device even if i downladed BMP drivers from https://web.archive.org/web/20160331030 ... blackmagic

I hope all those links will help someone which would encounter same problems as i did.
And now comes time for question:

What am i doing wrong? Is the bin file wrong? Or maybe my stlink board i am trying to flash is damaged? I also consider that i have some vendor-driver recognition problems. Or maybe there is something else? Please advice.
If you are just trying to use the bin files from blacksphere's site, they won't work.

This is because those binaries are provided for people to update their BMP boards which they have bought from BlackSphere.
They are not the complete binary, as the don't contain the DFU / core binary.

If you now want to deploy the BMP onto your own hardware, you have to build from source yourself

As a bit of back-story, Blacksphere did a major overhaul of their code structure some time in 2016, and split the code into separate parts, so that it could be updated in situ, as only the Application code now changes.
Prior to this change, the code was monolithic and the (upgrade) bin files contained all the complete bmp code.
Hence the old bin could be loaded onto any blank board, but the new ones can't.

kalregus
Posts: 5
Joined: Wed Jan 18, 2017 8:30 pm

Re: making blackmagic probe from stm32 chip board

Post by kalregus » Thu Jan 19, 2017 12:53 am

Rick:
Here are photos of my pills:

First one (the one i am programming the other one)
https://world.taobao.com/item/221027354 ... 2.4.pgcaNO

The second one (the one is being programmed)
https://world.taobao.com/item/220978030 ... 4.8.pgcaNO

I also found R10 marking on the second board - it has 103 digits on resistor, but it is so tiny that i find it impossible to change for other.
Picture of my second board - here:
http://dl.sniper.pl/pill.jpg

So i guess the idea of stlink programming stlink to become bmp and to flash nrf is impossible for me.

A propos the idea of flashing NRF51288 with STLink directly - i'd love to but whatever i try i can not do it. I tried:
- flash it via NRF51 DK through jlink - jlink find no emulators
- flash it directly via STLink and visual studio - i can upload simple program to nrf like blinking led, but any more complex program like advertising ble doesnt work. I've been told that it is because lack of softdevice on nrf. I checked option to make softdevice separately - then i can upload simple programs, otherwise visual studio doesnt send program to nrf chip.
- flash stlink pill to become bmp - as you know - without any success.

Roger:
Is there a way to download core / DFU binary? I mean full code to make stlink pill full bmp?
Can i make my own bin from source on windows?



All the tutorials i've watched, movies on YT and so on need devices i do not have (segger jlink, bmp), are made on linux (i have windows) or just dont work because some port of them is for author so obvious he doesnt mention about it.
All the links in google i search to find any other solution is now marked as "visited", and i am running out of options. It doesnt matter how, via jlink, stlink, visual studio or notepad - i just want to flash softdevice, and my program to nrf. How to achieve this having windows, stlink pill, nrf51822 and nrf51 DK from waveshare?

K.

kalregus
Posts: 5
Joined: Wed Jan 18, 2017 8:30 pm

Re: making blackmagic probe from stm32 chip board

Post by kalregus » Thu Jan 19, 2017 1:52 am

All right guys! I guess i have some progress with open OCD. I guess one thing is wrong and i hope you will point it out.

In command line i entered such a command:

Code: Select all

openocd -f ..//share/openocd/scripts/interface/stlink-v2.cfg -c "transport select hla_swd; set WORKAREASIZE 0x4000;" -f ../share/openocd/scripts/target/nrf51.cfg -c "init ; reset halt ; nrf51 mass_erase ; sleep 500 ; flash write_image ../../s130_nrf51_2.0.1_softdevice.hex 0x0 ; verify_image ../../s130_nrf51_2.0.1_softdevice.hex 0x0 0x0 ; mww 0x4001e504 1 ; mww 0x10001000 0x001000 ; mww 0x4001e504 0 ; shutdown"
Result:

Code: Select all

Open On-Chip Debugger 0.9.0 (2016-09-01) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
0x4000
Info : The selected transport took over low-level target control. The results mi
ght differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v27 API v2 SWIM v6 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.249867
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
nrf51.cpu: target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
Info : nRF51822-QFAC(build code: A1) 256kB Flash
Info : Padding image section 0 with 2112 bytes
Warn : using fast async flash loader. This is currently supported
Warn : only with ST-Link and CMSIS-DAP. If you have issues, add
Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg to disable it
nrf51.cpu: target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000001e msp: 0x000007c0
wrote 110560 bytes from file ../../s130_nrf51_2.0.1_softdevice.hex in 2.691406s
(40.116 KiB/s)
Seems like SoftDevice was uploaded. I am not sure if all addresses were entered correctly, especially starting one 0x001000. I took it from here:
https://developer.nordicsemi.com/nRF5_S ... 00102.html
As a starting point of softdevice.

Next, i had built blinking led made in visual studio. There were dozens of files named the same way, differing just with extension - npa00, npd, rdb, rsp bit also - bin. I took that bin and:

Code: Select all

openocd -f ..//share/openocd/scripts/interface/stlink-v2.cfg -f ../share/openocd/scripts/target/nrf51.cfg -c "program 3.bin 0x00018000"
Response:

Code: Select all

Open On-Chip Debugger 0.9.0 (2016-09-01) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override u
se 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results mi
ght differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v27 API v2 SWIM v6 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.249867
Info : nrf51.cpu: hardware has 4 breakpoints, 2 watchpoints
nrf51.cpu: target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
** Programming Started **
auto erase enabled
Info : nRF51822-QFAC(build code: A1) 256kB Flash
Warn : using fast async flash loader. This is currently supported
Warn : only with ST-Link and CMSIS-DAP. If you have issues, add
Warn : "set WORKAREASIZE 0" before sourcing nrf51.cfg to disable it
nrf51.cpu: target state: halted
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000001e msp: 0x000007c0
wrote 5120 bytes from file 3.bin in 0.527343s (9.481 KiB/s)
** Programming Finished **
Also starting address 0x00018000 was taken from here - as a starting address of memory for application. Although command line in windows has halted description is quite optimistic. However it doesnt work :) I guess that:
- memory starting addresses are wrong - what should they be?
- my program 3.bin is not a good file so it cant work, but not sure how to get correct version.

Any advices?
K.

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

Re: making blackmagic probe from stm32 chip board

Post by Rick Kimball » Thu Jan 19, 2017 2:29 am

these are nordic nrf51822 questions better answered on some site devoted to nordic chips
-rick

umejopa
Posts: 9
Joined: Sat Dec 05, 2015 4:53 am

Re: making blackmagic probe from stm32 chip board

Post by umejopa » Thu Jan 19, 2017 7:19 am

Any one that have a workong xxx.bin for a STM32C103C8T6 on a blue-pill ?

//Jonas

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests