Home/Support/Support Forum/ValueError: incompatible .mpy file

ValueError: incompatible .mpy file

0 votes

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.

asked Mar 3, 2021 in MicroPython by satyaveerSingh New to the Community (0 points)

Please log in or register to answer this question.

2 Answers

0 votes
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.
answered Mar 3, 2021 by mvut Veteran of the Digi Community (15,112 points)
0 votes
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
answered Mar 3, 2021 by tckr Veteran of the Digi Community (514 points)