FAQ's and links

Post Reply
User avatar
Posts: 7693
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia

FAQ's and links

Post by RogerClark » Mon Jan 25, 2016 11:41 pm

Please post your additions and I will merge and remove your postings.


Please read all the way down, as OS specific FAQs are below the general FAQs

Q. Whats this all about?
A. Its about using the Arduino IDE and API to program STM32 based controller boards.

Q: How do I get Started?
  1. Install the stm32duino support package for Arduino

    The stable release are now listed here. Download the most recent zip

    https://github.com/rogerclarkmelbourne/ ... 2/releases

    Instructions on how to install the zip are in this video (Note the video says download the main version of the repo - this has been superseded by the Releases system )

    https://www.youtube.com/watch?v=TePglhSkghg +
  2. figure out how to upload code to your board
    1. Serial - requires a TTL (3.3V) serial adapter - viewtopic.php?f=36&p=295
    2. ST-Link - requires a ST-Link adapter - hook up the SWD lines: GND, Clock (labeled DCLK or SWCLK), and Data (labeled DIO or SWDIO) between your ST-Link and board
    3. STM32duino bootloader - requires you flash your target board with the bootloader first
    4. BMP (Black Magic Probe) - requires a device dedicated to being a Black Magic Probe. Hook up the SWD lines like the ST-Link and optionally the UART for debugging
  3. set the Board and Variant for your target under the Tools menu
  4. set the upload method in the Arduino IDE under Tools > Upload method
  5. set the com port for the Serial or STM32duino methods (it's optional for the BMP method)
Q. What boards are supported
A. STM32F103 based boards have the best level of support. This includes STM32F103C serial, STM32F103R series, STM32F103T series, STM32F103V series and STM32F103Z series.
STM32F4 series are supported to a lesser extend, and use a modified version of the F103 codebase.
GD32F103 is also supported within the STM32F103 boards, as they are very similar

Q. What Arduino IDE version is supported
A. Version 1.8.0 is know to work fine, (various older versions e.g. 1.6.5 also work - Note. Not all old versions work)

Q. What Operating Systems are supported
A. Windows, Vista, 7, 8, 8.1 and 10 are all known to work.
OSX works for most people (Special setup for DFU may be needed)
Linux, both 32 and 64 bit flavours work for most people (Special setup / configuration for both Serial and DFU may be needed based on your distro)

Q.Where can I download the bootloader binaries or source
A. Here... https://github.com/rogerclarkmelbourne/ ... bootloader
There are precompiled binaries for a number of different boards.

Q. How to I get the bootloader onto my board.
A. You will need either a USB to Serial Adaptor or a ST-Link Adaptor, or you can use any other SWD programmer that supports the STM32 e.g. JLink.
See this video which shows how to upload firmware, (a bootloader of a sketch) to a STM32 board using a USB to Serial adaptor

Q. I managed to upload once, (using the bootloader), but when I tried to upload again it didn't work?
A. You probably forgot to select the Serial device for the board. The IDE uses the Serial port to reset the board back into upload mode.

Q: Which upload methods have USB serial?

For the STM32F1 boards, SERIAL_USB is defined for the STM32duino and ST-Link methods. This means the "Serial" object is the virtual UART on the USB port, and UART1 is "Serial1" and so on. For the other upload methods, "Serial" is UART1 and "Serial1" is UART2 and so on.

For the STM32F4 boards, "SerialUSB" is the virtual UART on the USB port and "Serial" is UART1 and so on.

Q.I have another / different board. Can you add support for this board?
A. Sorry. No. If you have a new sort of board based on the STM32F103 or STM32F4 we may be able to help you create the necessary files to add support for that board, but we can't do it for you.

Q. My board has an LED and / or a button on it which doesnt match with any of the available bootloaders. What should I do?
A. If you are despirate to get going with your new board and its not one which the bootloader specifically supports, you can use any of the bootloaders, e.g. generic-pc13.bin, however you won't get a flashing LED to indicate what is going on.
If you want a custom version of the bootloader, you will need to modify the existing code and rebuild it. The process is extensively documented at https://github.com/rogerclarkmelbourne/ ... bootloader

Q. I uploaded a sketch using the bootloader and now want to upload using ST-Link. Why doesn't ST-Link connect?
A. The SWD pins are set to GPIO mode when you use the bootloader and Serial upload methods, so that people can use them as GPIO.
Use the "Connect Under Reset" option in the Windows ST-Link tool, and press and hold reset on the board, then connect via ST-Link and release the button. This eventually works, but sometimes you need to try a few times before it will connect.
If you select the ST-Link upload method, the SWD pins are not assigned as GPIO, so you should be able to upload again without needing Connect Under Reset

Windows specific questions

Q. When I plug in my board to the USB on my PC, it says device not recognized
A.If you have a brand new board, other than a Maple, or Maple mini, the chances are that your board does not have a bootloader, or any other firmware installed on it at all. In this case you need to "flash" the Stm32duino bootloader onto your board.

Q. I installed the bootloader, but Windows says it can't find a driver for the board?
A. You need to install the special Windows driver using the batch file in /drivers/win in the files you downloaded from GitHub

Q: I ran the install_drivers.bat file, but Maple board doesn't create virtual serial port and has yellow exclamation mark in device manager.
A: Connect your board, run the Zadig http://zadig.akeo.ie/downloads/zadig_2.2.exe tool - select Maple in hardware dropdown menu, choose USB CDC driver, install.

Q. I've noticed that Windows device manager shows either the "Maple DFU" device or "Maple Serial". What are these?
A. Maple DFU is the USB device that the bootloader enumerates as, which allows the OS to upload to the board using the DFU protocol.
Maple Serial is the virtual UART / Serial device which the sketch enumerates as, when its running, which you can use Serial.print etc or Serial.read etc to communicate with.

Mac OSX specific questions

Q. dfu-util doesn't seem to work.
A. Install dfu-util using HomeBrew (google osx homebrew if you don't know what this is)

Linux specific questions

Q. dfu-util doesn't seem to work.
A. dfu-util was built for 32 bit linux, and only seems to work on some 64 bit linuxes. The easiest solution is to build dfu-util from the sources included in tools/src/dfu-util and copy the resultant binaries to the tools/linux folder to replace the 32 bit version

Q. Linux won't open the Maple serial port
A. You need to update the rules files. Try running the linux installer script, or search the forum for the ways other people resolved this problem.


Main Github repository. https://github.com/rogerclarkmelbourne/Arduino_STM32
Releases page - https://github.com/rogerclarkmelbourne/ ... 2/releases
Bootloader Github repository. https://github.com/rogerclarkmelbourne/ ... bootloader

ST-Link utility. http://www.st.com/web/en/catalog/tools/PF258168
ST Serial Flash utility. http://www.st.com/web/en/catalog/tools/PF257525

Main programming reference manual for the STM32F103 series. http://www2.st.com/content/ccc/resource ... 171190.pdf

Old. Leaflabs wiki on the Maple Mini. hhttp://docs.leaflabs.com/docs.leaflabs.com/index.html
Last edited by RogerClark on Thu May 25, 2017 7:23 am, edited 16 times in total.

Post Reply