Go Down

Topic: Blue Pill and Arduino IDE (Read 348 times) previous topic - next topic

JohnRob

I used a blue pill for a project about a year ago.  At that time compiling was "native" to the IDE.   However just as I was finishing up the "new" library from ST required the installation of an ST programmer module and I never pursued it after that.

I would like to use the Blue Pill on another project.  I guess my question is how do folks program the ST Blue Pill with the current IDE.

Thanks

JohnRob
Please do not PM me with thread based messages.  If your thoughts are worth responding,  the group should benefit from your insight.

skyvan

#1
Sep 20, 2020, 11:41 am Last Edit: Sep 20, 2020, 11:42 am by skyvan
I'm not sure what you mean by " the "new" library from ST required the installation of an ST programmer module". I have not had to do this.

I'm primarily using the Blue Pill and when programming with Arduino I upload using Arduino IDE 1.8.14 on Linux Mint Mate with STLink .  When uploading using STLink I get this warning
Code: [Select]

USB Status [unknown]
2020-09-20T10:24:52 INFO src/common.c: Loading device parameters....
2020-09-20T10:24:52 WARN src/common.c: unknown chip id! 0
USB Status [unknown]
Waiting for tty device 

 should now be available.

A problem you will find with using ST-Link to upload is that using the USB serial from your sketch does not work without significant heartache. I have tried several times to install Roger Clark's bootloader generic_boot20_pc13.bin from (https://github.com/rogerclarkmelbourne/STM32duino-bootloader) and though it seems to upload to the Blue Pill I have found it temperamental when uploading a sketch. I shall try again soon.

At the moment I am using STM32 Cube IDE with C but am getting frustrated since the long promised C++ version seems to be delayed indefinitely.

If you don't have an ST-Link clone then I strongly advise you buy one. Just a couple of quid from ebay.

pert

Perhaps by 'the "new" library from ST', @JohnRob means this:
https://github.com/stm32duino/Arduino_Core_STM32

Although install of that boards platform is very easy due to having Boards Manager installation support, once you want to upload a sketch to your STM32 board you discover there is an "extra step" to install STM32CubeProgrammer:
https://github.com/stm32duino/wiki/wiki/Getting-Started#extra-step

I seem to remember someone saying this is not required if you use the popular unofficial STM32 Arduino boards platform:
https://github.com/rogerclarkmelbourne/Arduino_STM32

JohnRob

Thanks :)

@pert  Yes the "new" module is the first one that required the "STM32CubeProgrammer".  I'm sorry I don't recall the version number.

So it sounds like its still a pia to upload (sic) once you move the the library that requires the STM32Cube programmer.

At first I considered staying with the old library but I was unsure if I would be able to go back and modify a program after a period of time.

Maybe I'll just toss my blue pills and not be tempted go look down this road again.


Please do not PM me with thread based messages.  If your thoughts are worth responding,  the group should benefit from your insight.

skyvan

I must be missing something. My experience with the Blue Pill is that although they are not as easy to work with as say the UNO or Mega they are still very usable. I have not had to
Quote
move the the library that requires the STM32Cube programmer
; I don't really know what this means! I still use the Arduino IDE but mainly upload using a £2.50 STLink clone from ebay. I did yesterday manage to install Roger Clark's bootloader and upload my sketches with it.

Don't just toss the Blue Pills unless you toss them in my direction.

JohnRob

It's been a while but as I recall when Roger Clark's forum moved to ST there was an update to the Blue Pill board under the Arduino Boards Manager.
Once I updated to this library I needed to install the STM32CubeProgrammer.

So I thought my options were:

1) Stay with the old library.  Might be OK or might become obsolete and would not be fixed by ST
2) install the STM32CubeProgrammer.  I looked at installing the 32Cube (admittedly half heartedly) and it seemed to require too much ST stuff installed on my computer.

Before the change I had the Blue Pill running a number of Bosch sensors.  The old library and board did not give me any trouble.


John
Please do not PM me with thread based messages.  If your thoughts are worth responding,  the group should benefit from your insight.

pert

For some reason, I was under the impression that https://github.com/rogerclarkmelbourne/Arduino_STM32 was no longer maintained (maybe I was getting it mixed up with the forum situation). However, I recently looked at it and they are still working on it. The only problem is that they never bother to do releases. However, there is an unofficial (but somewhat recommended by Roger) Boards Manager URL for it that provides up to date non-release versions of the boards plaform.

JohnRob

@pert
When I was working on the Blue Pill (some time ago) Roger Clark was officially closing down the forum and had convinced ST to take it over.  His plan was to create a read only archive forum.

Didn't follow it after that.

@skyvan  Are you using the Arduino 1.8.13?   If so do you have a reference on how to use the ST Link to program the Blue Pill?  I plan on trying again.

Thanks

John
Please do not PM me with thread based messages.  If your thoughts are worth responding,  the group should benefit from your insight.

pert

The last commit in Roger's repo was August 8th, so not under super active, but certainly not abandoned:
https://github.com/rogerclarkmelbourne/Arduino_STM32/commits/master
there are regular commits before that, so it's not a quirk.

skyvan

@skyvan  Are you using the Arduino 1.8.13?   If so do you have a reference on how to use the ST Link to program the Blue Pill?  I plan on trying again.

I use 1.8.14 built from the GIT repository.

Outside of the Arduino IDE I currently use st-flash to upload to the stm32f103 .
I built this from 'github' https://github.com/stlink-org/stlink. Once built
this can be used to flash the Arduino bootloader with one of Roger Clarks's
set of bootloaders available from https://github.com/rogerclarkmelbourne/STM32duino-bootloader.

The STM32 is connected to the Blue Pill's 4 pins on the end of the board. On the side of the st-link is a diagram indicating the pin use of the 10 pins. You only need to connect the 4 that match the 4 pins on the Blue Pill.

From within the bootloader_only_binaries directory, the basic command is
st-flash write generic_boot20_pc13.bin 0x08000000  (use whichever boot image applies to your Blue Pill).
Of course the you will need to move the Boot0 jumper to position 1 and press reset before this command. Once the bootloader is uploaded then you can swap the Boot0 jumper back to position 0.

If you have errors when trying to upload then you may need to upgrade the st-link firmware. See
https://www.st.com/resource/en/release_note/dm00107009-firmware-upgrade-for-stlink-stlinkv2-stlinkv21-and-stlinkv3-boards-stmicroelectronics.pdf

Once you have installed the boot loader you will need to use the boards manager to install the ST boards into the Arduino IDE. You can get these from
http://dan.drown.org/stm32duino/package_STM32duino_index.json .  The internet is littered with instructions on how to do this as a general process.

Basically then done. Restart the IDE, under tool select the STM32f103C series and selectas upload method STM32duino bootloader. Be aware - you could use the st-link to but this would wipe out your boot loader and you would not have direct access to Serial!

I have found the most critical part of the sketch upload is the timing between pressing the reset button and pressing upload. This will require a bit of trial and error.

pert

Quote
you will need to use the boards manager to install the ST boards into the Arduino IDE. You can get these from
http://dan.drown.org/stm32duino/package_STM32duino_index.json
This is the "unofficial but recommended" Boards Manager URL with regular non-release updates that I mentioned in reply #6.

JohnRob

thanks .... I'll give them a try :)
Please do not PM me with thread based messages.  If your thoughts are worth responding,  the group should benefit from your insight.

Go Up