Closed andrew-skybound closed 4 years ago
Thanks! Referenced in https://github.com/joric/bluetosis/wiki/Uploading#blackmagic
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.
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.
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
@andrew-skybound nope haven't tried flashing the latter one yet. @Flumeded blackmagic.bin I used (from the Releases section), commit 302ff20a.
@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
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.
hello to @All , I confirm that replacing with a 20K resistor in R3 works as well.
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!
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:
Here's my (ghetto) fix:
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.