MicroPython Memory Management Tips with the XBee 3

The available memory allocated for MicroPython can be found on the product's specification page: https://www.digi.com/products/embedded-systems/digi-xbee/rf-modules/2-4-ghz-rf-modules/xbee3-zigbee-3#specifications

There are some things you can do to use the memory space more efficiently : 

* Compile the application using the os.compile() function to create a .mpy file.  Your .py file will be compiled to a smaller .mpy file format.  If you are having issues, you can install the mpy-cross function to your PC so you can use and see syntax errors. 

* When possible, you should write your code into smaller modules and cross-compile them on a PC, uploading to the XBee device and then using os.bundle() to freeze/embed them into the flash where they can run in-place, with minimal heap usage.

To see more about these functions, please go to these links in the MicroPython Guide:

http://cms.digi.com/resources/documentation/digidocs/90002219/#concepts/c_mods_stored_as_mpy.htm%3FTocPath%3DDevelop%2520applications%2520on%2520an%2520XBee%2520device%7CApplication%2520evolution%7C_____5

http://cms.digi.com/resources/documentation/digidocs/90002219/#concepts/c_mods_embedded_flash.htm%3FTocPath%3DDevelop%2520applications%2520on%2520an%2520XBee%2520device%7CApplication%2520evolution%7C_____7
Last updated: Sep 08, 2020

Filed Under

RFRF Dev kits

Recently Viewed

No recently viewed articles

Did you find this article helpful?