You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure if this is an actual issue that could be guarded against or just a neat way for the user(me) to be an idiot, but the following code causes a hard fault in CircuitPython.
Occurs when using .send() instead of .asyncio_send(). .asyncio_send() in the same code works just fine.
Hardware: Adafruit RP2040 RFM95 915Mhz
Code:
import board
import digitalio
from adafruit_rfm import rfm9x
import asyncio
class TestCode:
def __init__(self):
# Define radio frequency in MHz. Must match your
# module. Can be a value like 915.0, 433.0, etc.
RADIO_FREQ_MHZ = 915.0
# Define Chip Select and Reset pins for the radio module.
CS = digitalio.DigitalInOut(board.RFM_CS)
RESET = digitalio.DigitalInOut(board.RFM_RST)
# Initialise RFM95 radio
self.radio = rfm9x.RFM9x(board.SPI(), CS, RESET, RADIO_FREQ_MHZ)
self.radio.enable_crc = True
self.radio.spreading_factor = 8
async def xmit_job(self):
while True:
print("sending")
self.radio.send(bytes("dsaklfjlkdsjflkasjdflkasjkljfklasjdflkjasdlkfjaskldjlkjfiasdjfalksdjfkalsdjf", "utf-8"))
await asyncio.sleep(10)
async def recv_job(self):
pass
async def main(self):
await asyncio.gather(
self.xmit_job(),
self.recv_job()
)
test = TestCode()
asyncio.run(test.main())
"""
result:
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
Please file an issue with your program at github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.
"""
The text was updated successfully, but these errors were encountered:
Hmmm. Nice catch!
Hopefully, an acceptable temporary work around is "don't do that" 😉
It would be nice to track down the root cause. Is it something in asyncio or is there a way to trap it without the hard fault.
Is there any reason why it should actually work?
Not sure if this is an actual issue that could be guarded against or just a neat way for the user(me) to be an idiot, but the following code causes a hard fault in CircuitPython.
Occurs when using .send() instead of .asyncio_send(). .asyncio_send() in the same code works just fine.
Hardware: Adafruit RP2040 RFM95 915Mhz
Code:
The text was updated successfully, but these errors were encountered: