32-bit PIC programming in Python!

PIC32MX4 Micromedia Python Demo

It has been a long journey for me to learn about modern interpreted object oriented programming languages, first on the desktop (see post here), later on industrial control and data acquisition applications (see post here) and now I feel like I have finally closed the circle: Python programming on an embedded control (32-bit) microcontroller thanks to the “Python-on-a-chip” project!

Dean Hall has been working at this project for several years now. He has demonstrated the possibility to run a small Python interpreter even on 8-bit architectures and others before me have ported the (well written) code to 16-bit microcontrollers like the PIC24. But since all Python interpreters have a huge thirst for RAM, it is only in the flat an (virtually) unlimited addressing space of a 32-bit microcontroller that Python starts really to make sense in my opinion.

So I have created a clone of the project (Mercurial) repository for the purpose (link)  and developed a new PIC32 port for the v10 revision of the project. While describing the whole project would take a while, it is interesting to note that the time I spent to “port” the PIC32 code in itself (from pull to first successful build) was less than an hour!

Actually most of the time for me went into figuring out how to use Python effectively to wrap existing libraries and get a useable,  or I should say a useful, package to develop applications on the PIC32 MX4 Micromedia Board.

At the moment I have demonstrated good real time support for the following features:

  • QVGA Graphics Primitives
  • Touch screen input
  • Joystick input
  • LED output
  • Serial input/output
  • Accelerometer input
  • Temperature sensor input
  • Audio (work in progress)

Eventually the project begs to be recompiled for a PIC32MX7 Micromedia board (128K of RAM!) where I could even dream to attempt a port of the PyGame libs to make development of little interactive applications real fast…

Please feel free to review the code and send your comments… but beware this is not a project for the faint of heart!

You will be required to master the following tools/application libraries:

  • MPLAB X
  • C32 Compiler
  • PIC32 peripheral libs
  • Microchip Application Libraries (GFX, MDD File System…)
  • Scons project manager
  • Mercurial versioning tools
  • Doxygen automated documentation generator/manager

Enjoy!

This entry was posted in PIC32 and tagged , , . Bookmark the permalink.