-
Notifications
You must be signed in to change notification settings - Fork 48
Receiver Disabled Every Other Save (toggling state) #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not sure what you mean by "save" "...disabling itself every other save. " |
Have you tried removing the time.sleep(2) at the end of your Receiver.py ? |
Also. If I am reading this correctly, your Transmitter will look for a received packet for up to 2 seconds, then send a packet then resume listening for 2 seconds after a .5 second sleep. If the Receiver receives the packets and sends its message, it will likely arrive while the Transmitter in in the time.sleep(.5) and will be missed. Perhaps I am not understating your intended flow. |
@jerryneedell save, as in save the code which uploads it to the board. This happens regardless of what I set the receiver timeout or sleep values to. It’s like the receive() function itself is toggling between an on/off state. By having different sleep time it should eventually roll over to a time when there is an incoming message to process but that never happens. My assumption is the receiver is actually being disabled somehow every other reload. |
hmmm --- Thanks -- I'll see if I can reproduce and then try to understand what is going on. |
I don't use MU for my development, but I think I have set things up in a similar way and so far, I cannot reproduce this issue. I have the Transmitter.py running on a Raspberry Pi with rfm9x bonnet, but that should not matter. I start the Transmitter on the Pi then start up the Receiver on the esp32s2 I also tried repeatedly copying code.py to the board and it also works ok for me. Does this sound like a fair test of the issue you are seeing? FYI - I am using the latest 8.0 beta build
example output showing am auto-reload
|
I also tried using Mu -- I have it running Receiver.py and I kept making small changes to the file and "saving" it with Mu. |
FYI -- I have tried this again - using Mu -- I have tried it with both Receiver.py as the open file and code.py as th open file. I have the Transmitter running on another system and on I am able to repeatedly hit "Save" in Mu and the esp32s2 does an auto-reload and restarts every time. |
I"m starting to think there's something wrong with my computer. I continually exhibit issues that others do not. Had an issue with the rp2040 reloading everything twice which jepler and neradoc didn't have. Maybe it's some kind of usb duplicator, keylogger, etc... ahhh i did install one of those PC DIN mounted USB hubs with like 10 ports. The more issues I report the more it's looking like a me problem. |
Are you OK with closing this issue for now. You can always reopen it if you think it is a library bug. |
Think I fixed my issue (USB enumeration controller corruption) but I still need to go through the paces of re-testing to see if the issue is gone. will be working on that this weekend. |
Nope issue persists and have found some evidence it's likely WiFi and multiple esp32's in proximity issue. Interference! espressif/arduino-esp32#2501 There might be a work around by specifically disabling and reinitializing the WiFi module. By allowing it to soft reset if there are duplicate boards around the router won't handshake until it's been cleared. Could be a router cache issue refusing to death when it should or the esp32 failing to send deauth. In any event I believe this issue extends beyond circuit Python. This is an esp32 module & router communication issue. Not even rfm related except via rabbit hole set of circumstances. |
Ah - I have not tried it with multiple esp32s. I'll see if I can set that up sometime soon. |
I am now running your code on 2 esp32s2s with rfm9x feathering's and I still cannot reproduce the issue. also -- both esp32s2s are set up with .env files to connect to my WiFi. |
It's got to be my PC then. Every issue I'm running into lately no one else can replicate, on multiple different boards and it's always some kind of reload/reset/usb issue. Almost like serial itself is buggy on my pc. Is that even a thing? |
@jerryneedell Can you please try it with web workflow off? There's some new evidence to suggest this bug might only exist for users who are not using web workflow. I do not use web workflow. |
On Espressif chips, most pins are reset to high with a weak pullup when CircuitPython stops (or soft-restarts). I have not read the whole thread carefully, but could this cause your problem? |
Sat down and pulled up both the S2 and LORA PCB design files. I'm using identical wiring as shown in the guide https://learn.adafruit.com/radio-featherwing/wiring IRQ goes to Pin B, Pin B goes to the 6th GPIO from the top right on the featherwing. On my ESP32-S2 that equates to GPIO 10. Guess which pin I'm using for CS and shouldn't be sharing a pin with IRQ. CS = digitalio.DigitalInOut(board.D10)
RESET = digitalio.DigitalInOut(board.D6) CS is causing the LORA IRQ to toggle every save. Honestly I'm surprised it even worked at all in that configuration. Not a bug. User Error |
Glad you found it. I use Pin D for IRQ -- following the feather M0 guidelines from long ago... Nice to have the world in sync again ;-) |
Been working with rfm95 featherwing for hours & hours over the past week and have finally narrowed down the erratic behavior to the receiver disabling itself every other save. It toggles between working and not receiving anything, on save, every time. Almost as if a rfm9x.receiver() mode state is being toggled. This might also explain some other bug reports that could account for receiver being disabled.
During issue all other code works including sending a packet. Only rfm9x.receive() gets broken.
In my example I have both transmitting and receiving on both boards. Using transmitter.py and receiver.py just helps me to differentiate them when opening USB instead of both having identical files however both are slightly different because I'm still working on the project but they do work perfectly as long as you ctrl+s at just the right time on both boards.
Project is transmitting a fake chat stream over and over by design for testing purposes. The time.monotonic timestamps change each message so I can track each original message.
Issue happens on both 7.3.3 and 8.0.beta, Currently running mixed CP versions but again issue happens regardless of CP version and I've flashed both to 7.33 and 8.0 trying to track down this bug. Also happens on an RP2040 feather. The lora boards or library is the common denominator.
Code.py
Receiver.py
Transmitter.py
The text was updated successfully, but these errors were encountered: