STM32F103 bluepill and Arduino IDE wrong port is recognized

Development environment specific, Arduino, Eclipse, VS2013, Em::Blocks etc
Post Reply
viayner
Posts: 4
Joined: Wed Apr 28, 2021 9:07 am

STM32F103 bluepill and Arduino IDE wrong port is recognized

Post by viayner »

Hi,
I am new, please forgive me mistakes.
I begin to work with Bluepill and Arduino IDE, fresh instalation of v1.8.13 on fresh windows 7.
At the beginning I use bootloader and upload the code trough it (port COM4), recently I switch to STLink/v2.
It works well for couple of days. But here my problems begin:
I decide that I will use serial port from Bluepill to send me back some debugging command, then I plug it trough serial-USB (com3) and try to open serial monitor from arduino ide - that was big mistake:
- it won't start looking for not existing any more port com4, and no way to change the port
- I change my com3 to com4 in win dev manager and serial monitor open but it has to be on same port which is used (in setup) for uploading the code.
- finally I decide to use alternative serial monitor or even skip to use it for now
- now I come back to code uploading - surprise - does no matter I have selected STLink as upload method, arduino IDE want to use STM32F103 on COM4 and there is no way to change it, com4 is not active, in "ports" I have only com1-real RS232, upload method STLink.
I have no idea how to remove com4 and be back to STLink on this arduino ide, could you help with it.
I can solve it by using linux but application what I am doing require windows-only software to communicate.
Regards
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: STM32F103 bluepill and Arduino IDE wrong port is recognized

Post by ag123 »

welcome, hope you have reviewed these first
viewtopic.php?f=2&t=3
viewtopic.php?f=2&t=301
normally you should also state the core that you are using to avoid guesswork by those willing to comment/help.

if you are using (roger's) libmaple bootloader
https://github.com/rogerclarkmelbourne/ ... bootloader
the way it works is it present itself as a dfu device, after a couple of seconds / blinks it start the sketch and the sketch is what provides the comm port (usb-serial).
http://docs.leaflabs.com/static.leaflab ... oader-mode
i'm not sure if this helps, but i'd guess u'd need to provide more info core etc

i'm not sure if st-link presents a comm port, if it does, it may be related to stm32cube programmer
https://www.st.com/en/development-tools ... eprog.html
or perhaps updated st-link firmware itself
won't comment on that as i'm using some other utilities for sketch install and interfacing in linux
viayner
Posts: 4
Joined: Wed Apr 28, 2021 9:07 am

Re: STM32F103 bluepill and Arduino IDE wrong port is recognized

Post by viayner »

Hi,
I am sorry, it was obvious for me that if I mention Bluepill it point to STM32F103C8T6, I did not found any other bluepill's from STM.
Some update:
I flash bootloader again (by Rx/Tx and com4 appear) and easy I was able to upload code by bootloader but when I switch to STLink it does not switch, keep using com4. I would like to attach the image, by the way how to attach image? [img] does not help, where to upload it?
What is wrong with my adruino ide?
Regards
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: STM32F103 bluepill and Arduino IDE wrong port is recognized

Post by ag123 »

image should be in attachments, alternatively you could also say post it elsewhere (e.g. imgur) and link it here say using [img] tag
if i'm not wrong when you plug in a st-link, chances are that you'd see a com port, this is based on that observed for nucleos where the on-board st-link doubles up as a usb-serial (uart) dongle.

if it is a desktop app that you are concerned about, i'd think it would be wiser to allow users to select the com: port rather than 'hardcoding' it say to com3 or com4
viayner
Posts: 4
Joined: Wed Apr 28, 2021 9:07 am

Re: STM32F103 bluepill and Arduino IDE wrong port is recognized

Post by viayner »

Hi,
typically when I select STLink for upload code "port" is gray not active, in my case is active black just nothing is selected there.
Totally removed preferences.txt allow me to select stlink but:
If select upload at the status (right low corner) I see that there is STM32F103C, STLink,... and it compile the code, then I got a message that compilation was successful and nothing else, status change immediately to STM32F103C generic. Before deleting preferences.txt I had status always STM32F103C on COM4 what ever I select.
If I select any other upload method, after compilation I got a message that there is a problem with uploading, hardware do not response etc. but in case I select stlink there is nothing, does no matter if stlink is plugged or not.
Later I can add some images if you wish.
Regards
fredbox
Posts: 125
Joined: Thu Dec 19, 2019 3:05 am
Answers: 2

Re: STM32F103 bluepill and Arduino IDE wrong port is recognized

Post by fredbox »

Does your IDE look anything like this?
ide-fs8.png
ide-fs8.png (14.72 KiB) Viewed 5374 times
If not, you may have installed the older core based on Leaflabs. I would recommend that you reinstall your Arduino environment and use the STM32 "official" core from Github: https://github.com/stm32duino/Arduino_Core_STM32. This newer environment is the way to go if this is your first exposure to programming a blue pill board from the Arduino environment. The latest version is 2.0 which was released in the past week or so.

As long as you have a working ST-Link, there is no need to install a bootloader. It will get in your way as the best of them are temperamental. Some of them like the Maple bootloaders disable the SWD pins, meaning you can no longer use the ST-Link and have to rely on the bootloader to upload your program.

Also, blue pill boards are known to have poor USB connectors and are easy to damage.

Once you have your environment working, connect the ST-Link and press the reset button until compilation is complete and the program is ready to upload. This should allow your program to upload successfully.
viayner
Posts: 4
Joined: Wed Apr 28, 2021 9:07 am

Re: STM32F103 bluepill and Arduino IDE wrong port is recognized

Post by viayner »

Hi,
looks easy but do not work in my case.
After I install latest STM32_core it looks like on your image but there is no STLink to select, I am not interested to install STM32Programmer software, even after I install it it do not upload the code.
Before with older "core" I had STLInk in option to select and it works, but do not work any more.
I was trying few different PC's, 3 of it has identical problems but one with arduino 1.8.7 not used for long time and freshly installed same drivers immediately recognize and works with my STLink.
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: STM32F103 bluepill and Arduino IDE wrong port is recognized

Post by GonzoG »

SWD is the same as ST-Link.
With STM core you need STM32CubeProgrammer to use ST-link.
Post Reply

Return to “IDE's”