Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the instructions for flashing blackmagic on the Bluepill dev board #13

Closed
andrew-skybound opened this issue Nov 27, 2019 · 9 comments

Comments

@andrew-skybound
Copy link

The resistor on the Bluepill (the $1.39 Aliexpress one linked on the Uploading page) that connects BOOT0 to the MCU is wrong, and prevents the BOOT0 jumper from being set high. Without a working BOOT0 jumper, the board cannot be flashed using the UART adapter.

The Bluepill ships with a 100K resistor between BOOT0 and the MCU, but it must be changed to a 10K resistor in order for it to work. The voltage drop from the 100K resistor is too strong forcing the BOOT0 pin on the MCU to always be low. BOOT0 needs to be high in order to ever enter the factory-burned ROM bootloader.

Updating the Uploading instructions would help others who have this same problem. It will affect anyone who is trying to use the UART adapter to program their Bluepill.

For the curious, here's how I figured it out. The reference circuit on page 24 of STM application note AN2586 places a 10K resistor between BOOT0 and the MCU:

https://www.element14.com/community/servlet/JiveServlet/previewBody/33286-102-4-214601/STM-STM32-STM32F101CB-Learning%20Centre%20MCU-Application%20Notes-STMicroelectronics.Application_Notes_1.pdf

You can see in the schematic on this page that the Bluepill has a 100K resistor on BOOT0 (labelled R3):

https://os.mbed.com/users/hudakz/code/STM32F103C8T6_Hello/

Here is the problem resistor:
100k

Here's my (ghetto) fix:
10k

It's supposed to be a 0603 package resistor. I didn't have one, but I managed to fit a 0805 package resistor in the same spot. I replaced it with a hot air gun and a wad of flux.

After that, blackmagic.bin flashed as per the instructions on the Uploading page.

@joric
Copy link
Owner

joric commented Nov 27, 2019

@joric joric closed this as completed Nov 27, 2019
@joric
Copy link
Owner

joric commented Nov 27, 2019

Looks like that's not the case. I have the same 100K resistor on my revision bought here https://www.aliexpress.com/item/32583160323.html in august 2016 and it flashed via uart just fine (uart bought here https://www.aliexpress.com/item/32650897782.html in jun 2016.

I also have a new STM32 bought here https://www.aliexpress.com/item/32478120209.html in september 2019 and it has the same resistor but the chip revisions sure look a bit different (laser etching instead of engraving), maybe it's the chip? I don't have time to check it though.

@andrew-skybound
Copy link
Author

The markings on mine match the one you bought in September 2019. Have you tried programming that one using the UART?

Perhaps that revision of the STM32 just requires a higher voltage to detect a high signal on BOOT0.

I found this post on the st.com forums where one person (at the bottom) had the same problem and fixed it the same way.

@Flumeded
Copy link

I had the same problem with UART. I ended up using dfu programmer, it worked only on one unit since I couldn't override memory limitation

@joric
Copy link
Owner

joric commented Nov 28, 2019

@andrew-skybound nope haven't tried flashing the latter one yet.
@Flumeded blackmagic.bin I used (from the Releases section), commit 302ff20a.

@joric
Copy link
Owner

joric commented Dec 7, 2019

@andrew-skybound
OK tried flashing the new revision and yeah UART doesn't work without resoldering the R3 resistor. I've had a bunch of 10K 0603 resistors from nRFMicro. After replacing R3 from 100K to 10K it worked just fine.

@Flumeded
Added blackmagic_dfu.bin which seems necessary and updated blackmagic.bin with the stripped down to 57K version, as written here (had to cut everything except stm32f1 and nrf51): https://primalcortex.wordpress.com/2017/06/13/building-a-black-magic-debug-probe/

Also updated the article: https://github.com/joric/bluetosis/wiki/Uploading

@andrew-skybound
Copy link
Author

The Blue Pill ships with another incorrect resistor on R10: it's 10K, but it should be 1.5K. This resistor is a pull-up for USB support and the incorrect resistor value is the reason the USB on the board doesn't work correctly out of the box (there are dozens of articles about this and how to fix it).

Anyhow this is a happy coincidence—since we don't need USB support on the Blue Pill (for programming an nRF5x at least) we can fix the UART by simply moving the 10K resistor from R10 to R3. So you don't need to buy anything else to fix it.

(FYI if you do want USB support later, you can fix it without a 10K on R10).

As for the firmware size limit: I built version 1.6.1 of blackmagic from source, it's a few hundred bytes under 57K and although it's a little old, it works just fine, no code modifications required.

@Nemos
Copy link

Nemos commented Jan 17, 2022

hello to @ALL , I confirm that replacing with a 20K resistor in R3 works as well.

@ntrp
Copy link

ntrp commented Oct 25, 2023

oh god, I wasted so much time and nerves on this.. and it was linked in the wiki in front of my face.. Thanks again for finding this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants