adafruit / Adafruit_CircuitPython_RFM9x

CircuitPython module for the RFM95/6/7/8 LoRa wireless 433/915mhz packet radios.
MIT License
68 stars 45 forks source link

example code crashes on packet receive #86

Closed cTurtle98 closed 1 year ago

cTurtle98 commented 1 year ago

I have a m0 adalogger with the 900mhz lora wing i have an m0 lora feather

i download example code from https://learn.adafruit.com/radio-featherwing/circuitpython-for-rfm9x-lora

on the m0 lora feather i did the pin assignment change in in the comments.

both of them display the same blow error. whichever one I start first shows the error when it receive the packet from the second one

boot_out.txt

Adafruit CircuitPython 8.0.3 on 2023-02-23; Adafruit Feather M0 Adalogger with samd21g18
Board ID:feather_m0_adalogger

serial console

Traceback (most recent call last):
  File "code.py", line 56, in <module>
  File "adafruit_rfm9x.py", line 840, in receive
  File "adafruit_rfm9x.py", line 678, in rx_done
  File "adafruit_rfm9x.py", line 397, in _read_u8
  File "adafruit_rfm9x.py", line 387, in _read_into
KeyboardInterrupt: 

Code done running.

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

Adafruit CircuitPython 8.0.3 on 2023-02-23; Adafruit Feather M0 Adalogger with samd21g18
>>> 
jerryneedell commented 1 year ago

How are you seeing that Error. The only way a KeyboardInterrupt should occur is if you enter Control-C. The example code only sends one packet then listens, If you have not already connected to the REPL on the receiver, you may just miss it. Is the receiver printing out the message that is it Listening for packets? If so, reset the transmitter and see if you see a packet.

It is just not clear to me how you running your test. Do you see the "startup" messages if you reboot the board with a Control-D?

jerryneedell commented 1 year ago

FYI - I just duplicated the setup you described -- A Feather M0 RFM9x and a feather adalogger with rfm9x feather wing. On the Adalogger I have CS on D10, RST on D11. The demo code you referenced works as expected for me.

cTurtle98 commented 1 year ago

on my feather wing I wired it like shown in the picture on learn.adafruit.com image

I loaded the example code on my feather m0 adalogger with the wing lora 900 then Ioaded the example code on my feather m0 lora 900. i edited the file to comment out the d5 d6 and uncoment the lora feather pin numbers.

now i ejected both and unplugged them.

I plug in the m0 adalogger with the wing and open mu serial terminal. then i plug in the feather m0 lora 900

if i switch to the feather m0 lora 900 terminal it says transmitted then receiving over and over. if I switch to the m0 adalogger terminal (the one that was plugged in first and was plugged in while the m0 lora was plugged in then it shows the error i pasted above

the m0 lora is still saying waiting for receiving so i switch to the terminal on the m0 adalogger with the wing. i do the ctrl-d in that terminal then switch to the m0 lora feather terminal and its no longer saying receiving. it now says the error i have above

so... essentially 2x feather running the example code with their pins assigned correctly. the first one that gets plugged in says transmit than recieveing... over and ovrer again. then I plug in a second one and right when the second one says its transmitting the first one shows the above error in the terminal.

ill try powering on the second one with a battery instead of plugging it into my computer at the same time as the first one and see if that changes anything

jerryneedell commented 1 year ago

I am not sure how to help with this since it all works here...I suspect there is some problem with the way your are connecting to the boards but it is not clear to me what is wrong.

I don't think there is any issue with the library.

jerryneedell commented 1 year ago

Just to be sure, I reconfigured my Adalogger/featherwing to use the same pins as you. CS on D6, RST on D5. It still works normally for me.....

jerryneedell commented 1 year ago

One possible difference is that I am not using Mu to connect to the boards. I have never been able to use Mu on my Mac reliably and it is not working for me now but that is a separate issue... I just use "tio" or "screen" from my Mac to connect to the boards.

jerryneedell commented 1 year ago

Ah ha -- with MU, Connecting a second boards while Mu is connected to a board does cause the keyboard interrupt!! I think you will have to deal with this with the Mu folks! I don't know if Mu can work with two boards at the same time...

jerryneedell commented 1 year ago

If you try running one board from battery or some other power source than the computer that is running Mu, it should work OK.

jerryneedell commented 1 year ago

Swapping between boards with MU appears to generate a KeyBoard Interrupt.

cTurtle98 commented 1 year ago

Ah ha -- with MU, Connecting a second boards while Mu is connected to a board does cause the keyboard interrupt!! I think you will have to deal with this with the Mu folks! I don't know if Mu can work with two boards at the same time...

Thank you so much!

I'm on Ubuntu 22.04 so I'll probably use screen to connect in the future

cTurtle98 commented 1 year ago

If you try running one board from battery or some other power source than the computer that is running Mu, it should work OK.

Yep this worked. I had one powered by battery and one on my laptop and it works

dhalbert commented 1 year ago

I'm on Ubuntu 22.04 so I'll probably use screen to connect in the future

tio is nicer -- it reconnects after disconnection