ValueError: incompatible .mpy file

Hello,

We are trying to run /flash/main.mpy file using STM32 microcontroller by using CTRL+R command and we are getting below error that is shown in our buffer.

ValueError: incompatible .mpy file

kindly provide the resolution for the error.

We are using the latest firmware for XBEE3 module and version-4 for micropython.

Regards,
Satyaveer

I would suggest checking with the release notes for your XBee 3 and it’s firmware to see what version of the Micro Python the XBee is supporting.

The MicroPython REPL banner (which starts with e.g. “MicroPython v1.12-xxxx-gxxxxxxx”) can tell you which MicroPython release version is used on the XBee.

You mention that you are using “version 4” of MicroPython. According to http://docs.micropython.org/en/v1.12/reference/mpyfiles.html , MicroPython v1.12 uses bytecode version 5. (You can also confirm this on v1.12, by checking the last field in sys.implementation).

Additionally, when using the mpy-cross tool to byte-compile your code, you must make sure to specify the correct command-line flags to the compiler, as documented here: https://www.digi.com/resources/documentation/digidocs/90002219/default.htm#reference/r_compiled_files.htm