The Dime-A-Dozen collection Mar 2016

One attraction of the STM32F103 series microcontrollers, is that there are lots of them available on eBay at ridiculously low prices. There are many variants of this µC, with flash memory sizes from 64K to 512K (and beyond, even), and with anything from 36 pins to 144 pins.

If you search on eBay for “stm32f103 board”, the first one that might pop up is perhaps this one:

Here are a few more, all running Mecrisp Forth 2.2.2:

There is no USB driver support in Mecrisp at the moment, so these have each been wired up with USB-serial interfaces. This will be needed as first step anyway, to flash Mecrisp onto the boards.

The procedure to upload Forth to such “Dime-A-Dozen” STM32F103 boards is always similar (although there are several alternatives):

And, lastly, run a command such as this to perform the upload:

python stm32loader.py -ewv -b 115200 -a 0x08000000 \
    -p /dev/<your-tty-port> mecrisp-stellaris-stm32f103.bin

(or use one of the alternative tools listed in the above article, such as BMP or ST-Link)

Once loaded, restore the BOOT0 jumper to “0” (i.e. GND) and then press reset. You should now see a prompt such as this show up on the serial port (USART1 is on PA9 and PA10):

Mecrisp-Stellaris 2.2.2 for STM32F303 by Matthias Koch

Press return and you’ll get Mecrisp’s standard “ok.” prompt. You’re in business!

Something to keep in mind is that there is a single STM32F103 firmware image on SourceForge, which has been built for 64 KB flash and 20 KB RAM. Chips with more memory will work just fine, but Mecrisp won’t be aware of it - flash memory beyond 64K won’t be used for compiled code storage, and RAM beyond 20 KB won’t be allocated or used by Mecrisp (which could actually be an advantage if you want to manually allocate some large buffers).

This is just the tip of Mecrisp’s iceberg, though: there are over a dozen different builds for STM32 chips, including STM’s F3, F4, and F7 series. Each build makes assumptions about the serial port it starts up on, and may depend on having a crystal of a specific frequency installed - but these settings are fairly easily changed in the source code (even though it’s in assembler !).

Some other boards which have been verified to work are:

The above boards are particularly convenient since they include a serial port to USB interface (all Nucleo boards also have ST-Link support for uploading).

Weblog © Jean-Claude Wippler. Generated by Hugo.