The easy way to program a "Blue Pill" is with the Arduino IDE.  Arduino is
VERY well documented but
for more complex work mBed is just as well documented is not so limiting as

The little $3 board can completely replace an Arduino.  Most pins are 5
volt So it plays
well with ether 5V or 3.3v parts.   Except for the names of the pins the
"blue pill"
can run Arduino code.  But it is about 20x faster with about 20x more
memory at 1/4 the price.

The way you program this is to just connect them to the USB port like an
Arduino.   But the key is
you need to first load a boot loader into the chip.

A step up from using the Arduino IDE is to use ARM's "mbed".  This is a
system for programming the full range
of STM32 chips and is pretty easy.  It includes an RTOS that makes like
easy. and gives you multitasking,
queues and drivers and Arduino-like ease of use.

There are two ways to program in the mbed environment.  (1) use the online
compiler.  This is simple because there is nothing to install on the local
PC. and the environment is very Arduino-like with one-click access to
example code and documentation. and the second way is to compile on the
local PC.  You can use a command line to do that or set up Eclipse.

mBed devices are easy to program.  When you plug them into a USB port they
appear to be a thumb drive.  You simply drag the binary executable file to
the device and it gets copied into the chip's flash ROM.   This works the
same way in Windows, Mac or Linux.

mbed is open source and is backed by Arm Holdings, the owner of the ARM
architecture.  It is their OS for STM32.

There are other MUCH more powerfull STM32 boards that are all source code
compatible.  I have one that is 200 MHz with hardware floating point.
 The chips (even the low-end "blue pill" can generate pulses in hardware
with no CPU overhead and they can read quadrature also in hardware.  The $3
chip can track an A/B encoder at about 5 MHz.with no CPU usage.

I have one running now on my desk that is bussy running some sonars and an
array of switches and turning the data into a serial stream.

I have another that is a PID loop to control a pair of motors. It presents
a serial command interface to the next level up controller.

These are so cheap and easy to use that I use them just to save wire.  Run
all the switch leads into a "blue pill" then just have I2C or SPI

For simple stuff look at using Aruduino IDE with these for more
sophiticated work look at using mBed.

I would NOT bother trying to program these  from "bare metal".  You will
spend all yurtime readinf the STM32F103 documents.    Thenif ever
tou chagechips yu need to re-read the book.   the mbed os (and arduino)
 interpose alaer that standardizes the hardware across the entire STM32

HINT:   While the "blue pill" is cheap and more than you need for many
uses, for only about $13 tyu can buy a "STM32F446 Nucleo" which is an order
of magnitude more capable and importently the Nucleor comes with a
programmer/hardware debugger that can beuse with Blue Pill type boards.
This programmer presents the "drang and drop" programming interface.

Yes this is applicable to machine tools.  put o on a moter and now you have
amoter that accepts serial commands

On Fri, Mar 8, 2019 at 9:48 PM Kirk Wallace <>

> I have used AVR chips to add features to LinuxCNC that where not easy to
> do with a parallel port alone. Now I would like to take a try at using
> one of these Blue Pills:
> >
> So far I have used this link:
> >
> to get OpenOCD installed, configured and running. I am able to telnet to
> port 4444 and play with some of the commands. Next, it seems that I need
> to come up with a way to develop and compile C files to flash to the
> STM32, but a lot of the STM32 information on the Web is old or conflicts
> with different methods from various sources. If someone here has a
> simple development system, I would appreciate any links or hints.
> Thank you.
> --
> Kirk Wallace
> _______________________________________________
> Emc-users mailing list


Chris Albertson
Redondo Beach, California

Emc-users mailing list

Reply via email to