User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:pymlab [2016/05/14 17:31] – [Interactive Python shell iPython] kakliken:pymlab [Unknown date] (current) – external edit (Unknown date)
Line 46: Line 46:
 {{ :cs:sw:flowchart.png?direct&500 |}} {{ :cs:sw:flowchart.png?direct&500 |}}
-===== ARM STM32 Python interpreter ====+===== ARM STM32 Python interpreter ====
-  +
-Pyhthon interpreter should be useful if pymlab would be used at [[cs:stm32f10xrxt|ARM]] microcontrolers.  +
-One example of possible interpreter is [[|Python on a chip]].+
 +The latest version of Pymlab is compatible with the [[|MicroPython]] interpretation of Python. Testing has been performed on the [[|Pyboard v1.0]] ([[|STM32F405RG]] processor) and [[|version 1.9.3 of MicroPython]].
 +=== Example ===
 +<file python>
 +import pymlab.config
 +cfg = pymlab.config.Config(i2c={"device": "machine", "port": 1, "freq": 100000},
 +                           bus=[{"name": "altimet", "type": "altimet01"},
 +                                {"name": "light", "type": "isl03"},
 +                                {"name": "sht", "type": "sht31"}])
 +altimet = cfg.get_device("altimet")
 +light = cfg.get_device("light")
 +sht = cfg.get_device("sht")
 +t1, p = altimet.get_tp()
 +l = light.get_lux()
 +t2, h = sht.get_TempHum()
 +=== Tips & Tricks ===
 +Resources (Flash and RAM) embedded systems are typically quite limited, the whole pymlab module does not fit to the flash memory available on the [[|Pyboard]] for example.
 +Fortunately MicroPython provides cross compiler that allows us to compile the source code to bytecode and therefore reduce the RAM and flash usage.
 +Version of the cross compiler must match the version of MicroPython running on your board. If in doubt just compile and flash your board with firmware compiled from the same branch of the [[|MicroPython repository]] as the cross compiler, instruction can be found at [[|]].
 +<code sh>
 +$ git clone
 +$ cd micropython
 +$ git checkout UPY_VERSION # This is very important!
 +$ # Optional compiling and flashing of the firmware
 +$ cd mpy-cross
 +$ make
 +In  Makefile at [[|pymlab/src/pymlab/Makefile]] edit the path to the cross compiler, mountpoint of the flash memory and devices you wish to use as all drivers are still to much for the limited space on the Pyboard. The just type
 +  make deploy
 +and you are good to go.
en/pymlab.1463247101.txt.gz · Last modified: 2016/05/14 17:31 (external edit)