This topic was published by and viewed 952 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author
  • DevynCJohnson
    • Topics - 444
    • @devyncjohnson

    Developers benefit from having multiple methods of programming embedded systems. For instance, besides assembly, programmers can use eLua (embedded Lua), FlashForth (Forth), Ada, and others. It may be surprising that Python can now be used to program microcontrollers. MicroPython is an implementation/interpreter that can run Python code on bare-metal.

    MicroPython (https://github.com/micropython/micropython) has been ported to various microcontrollers and architectures. MicroPython is also known as uPython or ╬╝Python. Circuit-level control is possible with MicroPython. MicroPython is 100% (or nearly 100%) compatible with CPython. However, MicroPython has many features that CPython lacks. For instance, MicroPython has special commands that interface directly with assembly. Specifically, the assembly accessible to MicroPython is the ARM Thumb-2 instruction set. As an example, the command "mov(R1, 0xff)" would move the hexadecimal number "ff" to register-1. Documentation can be found at http://docs.micropython.org/en/latest/.

    MicroPython natively supports the Pyboard (https://github.com/micropython/pyboard). The Pyboard uses the STM32F405RGT6 MCU (MicroController Unit) which uses the ARM Cortex M4 core. The hardware is 32-bits and runs at 168MHz. The Pyboard supports I2C, UART, SPC, and GPIO.

    MicroPython-lib (https://github.com/micropython/micropython-lib) is a collection of libraries ported from CPython for MicroPython.

    "upip" (https://pypi.python.org/pypi/micropython-upip/) is a package manager for MicroPython just as "pip" is used for CPython (the standard Python interpreter/implementation). However, for developers that need the libraries on a Unixoid system that uses CPython, "pip-micropython" can be installed. "pip-micropython" is a wrapper for Pip. Developers can run "micropython" in a terminal and test MicroPython code. Obviously, "pip-micropython" is needed to obtain MicroPython libraries for a non-embedded system.

    MicroPython is used in the WiPy (http://wipy.io/). The WiPy is an Internet-of-Things (IoT) development platform which is a circuit board with a Wifi chip. Developers can easily program the WiPy and upload new code via Over-The-Air (OTA) updates. The WiPy uses the TI CC3200 MCU (Cortex-M4 @ 80MHz), has 256 kilobytes or RAM, and supports WiFi-Direct. The WiPy can be used to make various wireless devices. The WiPy can also be interfaced with the Pyboard or many other motherboards and circuits via its GPIO pins, I2C bus, or SPI. WiPy's manufacturer is Bestronics (http://bestronics.eu/).


    • MicroPython is the bare-metal interpreter/implementation
    • uPython, ╬╝Python, and MicroPython are different names for the same thing
    • Pyoard is the MicroPython microcontroller board
    • WiPy is the IoT board
    • MicroPython-lib is a library collection
    • upip is the package manager

    Further Reading

Viewing 1 post (of 1 total)