GRPL-uPython:MicroPython for STM32

MicroPython (GRPL-uPython) is a rewrite of the Python 3.4 programming language tailored for STM32 devices. It offers on-chip compiler, virtual machine and runtime to enable the rapid prototyping of applications. Extension modules provide direct access to the peripherals of the STM32 device. Custom components written in C or C++ can easily be integrated.

The pyboard reference development board is a small form-factor electronic circuit board based on a STM32F405 running MicroPython on the bare metal. The STM32 peripherals are exposed via a set of Python functions and classes.

Several STM32 Nucleo boards and STM32 Discovery kits are supported by MicroPython.

The high-level scripting language allows quick prototyping on MicroPython-based STM32 boards. RAM usage (especially the heap) is minimized. Migration from dynamic scripts is first enabled to pre-compiled bytecode and further to frozen bytecode where execution happens from flash. Computationally expensive application components can be migrated to C or C++ called from the Python code for performance optimization.

MicroPython is as compatible as possible with standard Python so that code and knowledge transfer from a desktop-based to an MCU-based embedded system is made easy.

MicroPython is supplied by a third party not affiliated to ST. For complete and latest information, refer to the third party website http://micropython.org/stm32/.

Key Features

  • Python compiler and virtual machine run on the STM32 device
  • Interactive access to all language features over serial interface
  • Fully open-source code under the MIT License available on GitHub
  • Subset of Python 3.4 data types, functions, classes and modules:
    • Numbers: Arbitrary precision integers, floating point and complex numbers
    • Classes and instances: bytes, bytearray, tuple, list, dict, set, frozenset, array.array, collection, named tuple
    • str datatype with basic unicode support (utf-8 encoding)
    • closures, generators and full exception handling
    • Built-in modules such as sys, time, struct, os
    • Extra modules such as random, re, json, zlib, binascii, hashlib
  • Support for cooperative multitasking via coroutines and Python 3.5 async keyword
  • Multithreading for selected ports via the _thread module
  • File system support (FAT) with custom block devices and transparent access from scripts
  • Hardware-specific modules for access from scripts to STM32 peripherals such as GPIO, I2 C, SPI, UART, ADC, DAC and timers
  • Easy-to-build add-on modules in C or C++ with Python calling C/C++ and vice versa
  • MicroPython for STM32 devices:
    • based on STM32 Cube HAL
    • small memory footprint: 256 kbyte Flash and 32 kbyte SRAM
    • SD card support with file system access from within MicroPython
    • USB support: CDC/VCP, MSC, HID
Product Evaluation Tools
Part NumberManufacturerDescription
32F411EDISCOVERYSTDiscovery kit with STM32F411VE MCU
32F429IDISCOVERYSTDiscovery kit with STM32F429ZI MCU * New order code
32F746GDISCOVERYSTDiscovery kit with STM32F746NG MCU
32L476GDISCOVERYSTDiscovery kit with STM32L476VG MCU
NUCLEO-F401RESTSTM32 Nucleo-64 development board with STM32F401RE MCU, supports Arduino and ST morpho connectivity
NUCLEO-F411RESTSTM32 Nucleo-64 development board with STM32F411RE MCU, supports Arduino and ST morpho connectivity
STM32F4DISCOVERYSTDiscovery kit with STM32F407VG MCU * New order code
Get Software
Part NumberSoftware VersionSupplier
GRPL-uPythonGeorge Robotics Pty Ltd