Black Lives Matter - Action and Equality.
0

Problem with RFM69.mpy file
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Problem with RFM69.mpy file

by dsheeran on Sat May 09, 2020 12:50 pm

I just bought 2 RFM69 Feather Wings to use with 2 Feather M0 Express boards. I have everything wire up as per the tutorial and created code using the examples.

I have the RFM69.mpy file in the lib folder of the boards and am using version 5 of circuit python for the boards' UF2 files and for my CircuitPython library.

When I save my script and go to the Serial Console in Mu, I get the following...

_________________________________________________________________
Press any key to enter the REPL. Use CTRL-D to reload.soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 7, in <module>
File "adafruit_rfm69.py", line 72, in <module>
MpyError: Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.
_________________________________________________________________

What should I do? Is there a newer file? Do I need to move back to an older version and library of CircuitPython? If so, what version?

Please help. Thanks.

dsheeran
 
Posts: 125
Joined: Wed Aug 02, 2017 1:20 pm

Re: Problem with RFM69.mpy file

by siddacious on Mon May 11, 2020 2:50 pm

That error occours when you have a mismatch between the version of CircuitPython on the board you are using and the version of CircuitPython that the mpy file was built for.

You can find more information at the URL that is in the error message:
https://circuitpython.readthedocs.io/en ... oting.html (this is the expanded URL which is shortened in the error message)

siddacious
 
Posts: 246
Joined: Fri Apr 21, 2017 3:09 pm

Re: Problem with RFM69.mpy file

by dsheeran on Wed May 13, 2020 1:46 pm

Thanks. Yes, I read that. Unfortunately the board and the file are both version 5. How can I get more information on when the file was created?

dsheeran
 
Posts: 125
Joined: Wed Aug 02, 2017 1:20 pm

Re: Problem with RFM69.mpy file

by tannewt on Wed May 13, 2020 4:46 pm

Make sure *all* .mpy files on the drive are for version 5. RFM69.py must be importing something itself that is older.

tannewt
 
Posts: 1644
Joined: Thu Oct 06, 2016 8:48 pm

Re: Problem with RFM69.mpy file

by dsheeran on Fri May 15, 2020 10:07 am

Everything on the board came from the adafruit-circuitpython-bundle-5.x-mpy-20200508 bundle. So I don't know how to tell what file may be causing the problem. Is it possible for you to create a new RFM69.mpy file for this version?

dsheeran
 
Posts: 125
Joined: Wed Aug 02, 2017 1:20 pm

Re: Problem with RFM69.mpy file

by jerryn on Fri May 15, 2020 12:15 pm

Have you tried just reloading the .mpy files to the board. It is possible it got corrupted. Make sure you leave time to the file system to completely withe the files after copying them before trying to execute them.

jerryn
 
Posts: 1238
Joined: Sat Sep 14, 2013 9:05 am

Re: Problem with RFM69.mpy file

by dsheeran on Sun May 17, 2020 4:08 pm

I did as you suggested and the file seems Ok now. But I'm having a different problem with it. I stripped my program down to simply test the RFM69 Wing. And now I'm getting the following error from the included code. Please let me know what you think...

Error:
___________________________________________________________________________________________

code.py output:
Traceback (most recent call last):
File "code.py", line 15, in <module>
File "adafruit_rfm69.py", line 278, in __init__
File "adafruit_bus_device/spi_device.py", line 87, in __init__
AttributeError: 'int' object has no attribute 'switch_to_output'

Code:
_____________________________________________________________________________________________
import board
import busio
import digitalio
import adafruit_rfm69

debug = True

RFM69_CS = 10 # "B"
RFM69_RST = 11 # "A"
RFM69_IRQ = 6 # "D"

spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = digitalio.DigitalInOut(board.D5)
reset = digitalio.DigitalInOut(board.D6)
rfm69 = adafruit_rfm69.RFM69(spi, RFM69_CS, RFM69_RST, 915.0)
rfm69.encryption_key = (
b"\x01\x02\x03\x04\x05\x06\x07\x08\x01\x02\x03\x04\x05\x06\x07\x08"
)

if debug:
print("Radio Setup Ok")

while True:
packet = rfm69.receive()
if packet is not None:
command = str(packet, 'ascii')
if debug:
print('Received: ', command)

dsheeran
 
Posts: 125
Joined: Wed Aug 02, 2017 1:20 pm

Re: Problem with RFM69.mpy file

by dsheeran on Sun May 17, 2020 4:09 pm

By the way. the error seems to be coming from this line...


rfm69 = adafruit_rfm69.RFM69(spi, RFM69_CS, RFM69_RST, 915.0)

dsheeran
 
Posts: 125
Joined: Wed Aug 02, 2017 1:20 pm

Re: Problem with RFM69.mpy file

by jerryn on Sun May 17, 2020 4:24 pm

Glad you got beyond the .mpy issue

For CircuitPython set the pins like this.

Code: Select all | TOGGLE FULL SIZE
cs = digitalio.DigitalInOut(board.D5)
reset = digitalio.DigitalInOut(board.D6)
rfm69 = adafruit_rfm69.RFM69(spi, cs reset, 915.0)

but make sure the Pins are correct for your setup


remove the lines

Code: Select all | TOGGLE FULL SIZE
RFM69_CS = 10 # "B"
RFM69_RST = 11 # "A"
RFM69_IRQ = 6 # "D"

they are not used.

jerryn
 
Posts: 1238
Joined: Sat Sep 14, 2013 9:05 am

Re: Problem with RFM69.mpy file

by dsheeran on Sun May 17, 2020 4:36 pm

Please disregard. I figured it out. If anyone else is interested you have to look a little closer at the tutorial. This code will work...

import board
import busio
import digitalio
import adafruit_rfm69

debug = True

spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = digitalio.DigitalInOut(board.10)
reset = digitalio.DigitalInOut(board.D11)
rfm69 = adafruit_rfm69.RFM69(spi, cs, reset, 915.0)
rfm69.encryption_key = (
b"\x01\x02\x03\x04\x05\x06\x07\x08\x01\x02\x03\x04\x05\x06\x07\x08"
)

if debug:
print("Radio Setup Ok")

while True:
packet = rfm69.receive()
if packet is not None:
command = str(packet, 'ascii')
if debug:
print('Received: ', command)

dsheeran
 
Posts: 125
Joined: Wed Aug 02, 2017 1:20 pm

Please be positive and constructive with your questions and comments.