Downloading your Software

From The Relativty Wiki
Revision as of 18:02, 24 March 2019 by Justin (talk | contribs) (Created page with "=Downloading your software= Before you start, the ST-Link requires various drivers, which you should install before you plug it in - '''please read the notes below before you...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Downloading your software

Before you start, the ST-Link requires various drivers, which you should install before you plug it in - please read the notes below before you install anything though. We download all of the ST software from the STmicroelectronics website. They are the company responsible for manufacturing the chips that power the STM32 and the ST-Link v2 USB adapters. In order to download anything from ST, you are asked either to provide your name and email, so they can email you the download links, or to create an account. Creating an account means that you can easily return later and download additional software without any hassle, and gives you full access to their help forums, so I found it easier in the long run just to create the account and be done with it.


Scroll right down to the bottom of each page and click on the blue Get Software button.


The Windows ST-Link drivers can be downloaded from here:
https://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-utilities/stsw-link009.html
Read the ReadMe.txt that comes with the driver for installation instructions (Basically, you need to run the installer with Administration rights for it to install...)


The Windows ST-Link Utility can be downloaded from here:
https://www.st.com/en/development-tools/stsw-link004.html
(you need to run the installer with Administration rights again for it to install...)
Occasionally, the utility itself fails to get a shortcut on the Start Menu, so you may have to navigate to its folder and double click on it to run it - if this is the case, it is worth pinning it to your start menu. It also occasionally loses focus on its installation or driver install windows (which leaves the window that you need stuck behind one of your other open windows). This means that sometimes you will have to hunt for the installer window during the install.


The Linux drivers should be directly available using your normal package manger, so just search for stlink. This will install both the ST-Link utility and the USB drivers so that your Arduino IDE can recognise your ST-Link and program your STM32. Warning - supposedly there is a bug in the latest version of the Linux drivers, so you will probably need to install a slightly less current version (I'll update this as I clarify what works and what doesn't).


For Windows users, you will need to download and install both the ST-Link drivers and the ST-Link Utility. The ST-Link Utility actually installs an additional set of drivers, and you need different drivers to let windows recognise the USB connection of your STM32 board than the ones that you need to program the board via the ST-Link adapter.


Next, you will need Roger Clark's STM32 Software and Tools package. Roger Clark is one of the key people in the world of STM32 boards. Hidden away inside this download is the command line bootloader flasher. If your board comes without a bootloader, this little program is exactly what you need to get you up and running.


Next, you will need the Arduino IDE software package. You probably have this already, but if not, you can download it here:
https://www.arduino.cc/en/Main/Software


Finally, the last and one of the most important bits of software: the STM32 boards package for the Arduino IDE.
Open your Arduino IDE and open the preferences, then add this URL to the "Additional Board Manager URLs" at the bottom of the Arduino IDE preferences window:

https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

Now go to the Tools menu -> Board -> Boards Manager and wait whilst it updates the listing. Next, type STM into the search field. Click on "STM32 Cores by STMicroelectronics" & click the Install button. This will probably take a few minutes to complete as it's over 100Mb in size.

Connecting the STM32 to your ST-Link

Whilst the pinouts on an ST-Link differ between type 1 and type 2 adapters, the pins on the end of an STM32 have an identical pinout, regardless of whether you are using a Blue Pill or a Black Pill board. They are all the same: 3v3 - DIO - SCK - GND

Your ST-Link v2 USB adapter comes with 4 dupont patch cables, and should have a pin layout diagram printed on the side. Usually, the diagram has a thick printed bar on one side which corresponds to the cutout in the plastic pin surround. You need to find the SWCLK, SWDIO, GND and 3.3v pins.

Now connect 3.3v to 3v3, DIO to SWDIO, SCK to SWCLK and GND to GND. Once you have connected all 4 pins, go back and double check that you have done it all correctly.


Apologies... I'm typing this up as fast as I can...