How to start? Connection issue with Bluepill

Post here first, or if you can't find a relevant section!
stombo
Posts: 7
Joined: Sun Apr 11, 2021 6:22 am

How to start? Connection issue with Bluepill

Post by stombo »

I've bought some bluepill boards to experiment with. After connected to USB of my PC (Win 10) the POWER-LED is on but the PC claims about an unknown device and an error while requesting device information (Code 43).

Then i read about a wrong pull-up resistor and replaced R10 with an 1,5 kOhm (instead the 10 kOhm), but that also did not change anything.

I think as long as Windows cannot detect my board it makes no sense to try to program it. The Internet is full of stuff but i currently can't sort it out. Some say one needs to program a bootloader first, which is able to emulate a real device for Windows, so it could create a virtual COM port (VCP) and tho make it accessible to the Arduino IDE.

But on the other hand, as i want to use the device in a low-power environment later, i'd also looked for a way to program it in "STM-style" buy using a serial programmer ST-Link v2 (clone). But i get stuck there either.

Some help on this would be appreciated :-)
by ag123 » Sun Apr 11, 2021 9:48 am
for using the st-link v2 you need to use that stm32 cube programmer (SWD) uploader

you can get stm32 cube programmer here
https://www.st.com/en/development-tools ... eprog.html

oh you need to mention which core you are using, from what it seem it is the official STM core
Go to full post
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: How to start? Connection issue with Bluepill

Post by stevestrong »

You have to install the serial driver from ST: https://www.st.com/en/development-tools ... 32102.html
This will allow you to use the USB as serial port.
To program the board you need either an STLink probe or you have to install a bootloader (for this you need anyway an STLink first...).

Please also read this first:
viewtopic.php?f=2&t=301
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: How to start? Connection issue with Bluepill

Post by ag123 »

just having the bluepill isn't enough.
you need a st-link v2
https://www.adafruit.com/product/2548
https://www.st.com/en/development-tools/st-link-v2.html
or a usb-uart dongle
in addition to that 'read this first' prior this is another one
viewtopic.php?f=2&t=3
stombo
Posts: 7
Joined: Sun Apr 11, 2021 6:22 am

Re: How to start? Connection issue with Bluepill

Post by stombo »

If i've read it right i have tree options to program the STM:
  1. Using ST-Link programm throught the SWD interface of the chip
  2. Using an UART-Dongle (USB to Serial adapter) with the UART way of programming
  3. Using the USB-Port of the STM (STM32 chip needs to be prepared for this with a special bootloader)
I think it's best to handle those variants separately, because it can get confusing to mix them up. So i focused on the 1. option first.
1.) I downloaded and installed the ST-Link driver from the ST-Website: https://www.st.com/en/development-tools ... nk009.html and it looks good:
win10_devicemgr_st-link.png
win10_devicemgr_st-link.png (12.99 KiB) Viewed 4826 times
2.) I connected it with the SWD-Interface of the Blue Pill board:
ST-Link -> Blue Pill
GND -> GND
3.3V -> PWR
SWDIO -> DIO
SWCLK -> DCLK

3.) I've added the boardmanager URL: https://github.com/stm32duino/BoardMana ... index.json to my Arduino prefs. But i do not find a "ST-Link" programming method in my menu:
arduino-ide_tools_boards.png
arduino-ide_tools_boards.png (63.13 KiB) Viewed 4826 times
arduino-ide_missing_st-link.png
arduino-ide_missing_st-link.png (34.77 KiB) Viewed 4826 times
stombo
Posts: 7
Joined: Sun Apr 11, 2021 6:22 am

Re: How to start? Connection issue with Bluepill

Post by stombo »

In other tutorials on the web, they have those dedicated option:
st-link_available.png
st-link_available.png (73.08 KiB) Viewed 4826 times
Am i using the wrong boardmanager?
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: How to start? Connection issue with Bluepill

Post by ag123 »

for using the st-link v2 you need to use that stm32 cube programmer (SWD) uploader

you can get stm32 cube programmer here
https://www.st.com/en/development-tools ... eprog.html

oh you need to mention which core you are using, from what it seem it is the official STM core
Last edited by ag123 on Sun Apr 11, 2021 9:49 am, edited 1 time in total.
stombo
Posts: 7
Joined: Sun Apr 11, 2021 6:22 am

Re: How to start? Connection issue with Bluepill

Post by stombo »

Ok, i've installed it (the drivers will automatically be installed from there also).
But now i get:

Code: Select all

Error: Old ST-LINK firmware version. Upgrade ST-LINK firmware
Error: Old ST-LINK firmware!Please upgrade it.
:x
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: How to start? Connection issue with Bluepill

Post by ag123 »

note that 'clone' st-link may 'not work', i'm not sure if it'd update that firmware, it may brick your st-link if you are unlucky
so this is at your own risk

the open sourced alternatives is something like this
https://github.com/stlink-org/stlink
similarly u'd need to have that installed
but the 'read this first' links has plenty of information and you may get some clues from some of those docs. e.g. how to install the 'libmaple' core.
stombo
Posts: 7
Joined: Sun Apr 11, 2021 6:22 am

Re: How to start? Connection issue with Bluepill

Post by stombo »

FINALLY I SUCCEEDED! :D

Downloaded the latest update from ST: https://my.st.com/content/my_st_com/en/ ... nk007.html
and could upgrade my clone without an issue:
st-link_upgrade_successful.png
st-link_upgrade_successful.png (43.54 KiB) Viewed 4815 times
After that i could use the "STM32CubeProgrammer (SWD)" upload option:
upload_option_stm32cube_swd.png
upload_option_stm32cube_swd.png (34.69 KiB) Viewed 4815 times
And program my blink_led sketch:

Code: Select all

      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.7.0                  
      -------------------------------------------------------------------

ST-LINK SN  : 50FF69064885494909221687
ST-LINK FW  : V2J37S7
Board       : --
Voltage     : 3.25V
SWD freq    : 4000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x410
Revision ID : Rev X
Device name : STM32F101/F102/F103 Medium-density
Flash size  : 128 KBytes
Device type : MCU
Device CPU  : Cortex-M3

Memory Programming ...
Opening and parsing file: blink_led.ino.bin
  File          : blink_led.ino.bin
  Size          : 18252 Bytes
  Address       : 0x08000000 

Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 17]
Download in Progress:

File download complete
Time elapsed during download operation: 00:00:01.194

RUNNING Program ... 
  Address:      : 0x8000000
Application is running, Please Hold on...
Start operation achieved successfully
stombo
Posts: 7
Joined: Sun Apr 11, 2021 6:22 am

Re: How to start? Connection issue with Bluepill

Post by stombo »

Can programs be debugged in this setup? I used to do serial writes in Arduino, but here we have no USB-Port.
Post Reply

Return to “General discussion”