-
Notifications
You must be signed in to change notification settings - Fork 7
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
scan sets channel 14 - invalid except in Japan #2
Comments
A further observation. On ESP32 |
Thanks for the reports Peter (and apologies for the slow response - I wasn't getting alerts on issues on this repo). Re. the channel issue, that's odd - it works fine for me here to include channel 14 and as far as I can tell, micropython does not implement the country restrictions on esp32. I'll keep an eye on that. Re. the out-by 1, I can understand that might happen. I use a really simple strategy to identify the central channel. Generally, the |
Is it possible that the underlying RTOS has country variants? In any event the error could be trapped. |
I'm posting the following as a general observation which might be of interest in the context of scan algorithms. Seon suggested running with a high channel number and reduced TX power, which does seem to have greatly improved reliability. He's also sent me a couple of samples of the latest PCB revision (P8) which (on his advice) I'm testing at full power on a low channel. These also seem fine. I gather the S3 chip has problems with mutual interference between its radio and the on-chip USB. I've also been investigating how to cope with channel changes. In situations where the channel number may change dynamically, on power up a node issues station interface I find this degree of cross-channel response surprising. Especially given that transmitter and receiver are in different rooms and on different floors. If the Any thoughts prompted by these ramblings would be welcome :) |
@peterhinch : I have pushed an update to espnow_scan.py with a new scan methodology.
In all my tests of the new methodology there has always been only candidate with a response rate close to 100%. Please try the new method and see if this works mroe reliably for you.Thanks. |
I recommend you set import espnow_scan as scan
scan.scan(b'abcdef1234`, num_pings=10, verbose=True) |
Thanks for taking the time to post these - these are very useful.
In my tests, I have found that cross-channel response over many channels does occur occassionaly, and will often be in a burst of several packets. I haven't isolated a cause as it is sporadic and I'm not sure this is the same phenomenon as you are seeing. It is quite possible for a transmission to be successfully received by the target device, but the ACK packet is lost by the sending device. This can be due to any of the usual causes of wifi packet loss affecting the ack packet, but not the sent packet. However, this will happen at a high rate if the two device are operating on different (perhaps adjacent) channels, sent packets may be received at say 30% efficiency and the acks will also be received at 30% efficicent of that. Again, I don't know if that is related to your scenario. I generally find that if I am sure the devices are operating on the same channel and there is not some obvious source of interfence (eg. microwave oven nearby) than the rate of successfully delivered messages for which the send does not receive an ack is "very low". ie. in a clean environment, thousands of message successfully received and acked over many hours with no dropped acks. But, environments are not always so clean and the application should either be robust to lost messages (ie, the sender ignores infrequent missed acks from the sender, or the receiver application is resilient to occasional re-transmissions from the sender). I've also found that the amount of cross-talk remains high at greater distances between sender and receiver. |
This scenario is difficult to explain (short of bugs in my or the underlying espressif ESP-NOW code) - if You might find
Yes - this is to be expected. If the packet transmit success rate for cross-channel comms is say 30%, then we also have only a 30% chance of success of the ack packet from the receiver. You really want to be operating on the same channel! My After all a wifi AP continually broadcasts it's operating channel. A device that wants to pair with it, may receive the message on a different channel, but knows what channel it should select from communication with the AP.
For my apps:
This requires an agreed communication protocol between the devices. I actually have another layer of fallback beyond that, where the sensor device will initiate a discovery request using broadcasts across all channels to identify which devices provide the named "service" (so deployed devices can continue to operate if I need to change devices). In this case, the sender will authenticate the new "service" node before accepting it as the new target. Running your mqtt gateway on an ethernet connected esp32 device makes all this a LOT simpler 😉. |
Thanks for that - I hadn't thought of the ping-pongX approach - send My gateway remains a WIP partly because I've spent time chasing hardware issues with the FeatherS3. The P8 release boards seem good but the earlier releases are picky about channels and txpower.
|
Another option for saving data across deepsleep is rtc memory - I've found that quite useful for really fast and save data. Especially with wake stubs. I really hope to get some time soon...it's been a bit exasperating not having the time I expected to finish up some of this work. |
In the light of your comments I reviewed the code used in this test. The 1% figure included (and probably consisted entirely of) simple transmission failures. Apologies for the bum steer. Thanks for the pointer re rtc memory :) |
Just a heads-up. I thought I had managed to come up with a reliable method for determing the channel (without requiring channel information to transmitted back from the peer) in the last commit to I think an approach that adapts based on level of certainty from the initial scan would be the best approach. |
Speculating - maybe espressif burns this information into the fuses of some devices sold in various jurisdictions.
Oh, BTW, I put in a trap for |
[EDIT] I've now found the board which exhibits the fault. Here is the traceback
Trapping the exception enables it to run to completion: if sta.active() and sys.platform != "esp8266":
try:
sta.config(channel=channel) # On ESP32 use STA interface
except RuntimeError:
pass
return sta.config("channel") I think your idea about fuses is probably correct. I have adopted your suggestion of determining the channel by querying the gateway which works fine. I've ordered a Nordic power profiler which should be an improvement over my attempts with a 1Ω resistor, DSO and visual integration. Any observations or tips? |
Thanks Peter. That's very helpful. |
Thanks, I trap the error in my most recent update (however, I just realised I hadn't pushed it up to the repo - sorry about that - including the new methodology for scanning). Vscode has changed something and it wasn't as obvious that I hadn't pushed to the repo.
Off the top of my head:
I use it in two modes:
Oh - and it's such a good value device for these measurements. Have fun with it. |
Oh - and the logic inputs are useful for timing as well (poor man's logic analyser). |
There was a bit of a learning curve with the software, but it's a nice piece of kit with very neat minimalist physical design. The digital inputs could prove useful for identifying specific points in the power up sequence. I have a Saleae LA for more general use. I started out with a £6 Chinese Saleae clone which worked well until I needed pre-trigger capture. The Saleae is quite superb but not cheap. I have one purely academic query. When I first tried to use it, the s/w directed me to download and run |
Yes, it looks like a nice bit of kit. I used to have access to LAs at work, but not any more. I've managed to get by so far.
|
In Accesspoint Controllers, channels are usually grouped. Only 3-4 central frequencies out of the 14 channels are configured for neighboring APs to hop around. Sounds like the side channel issue and scanning speed could benefit from this strategy. |
On the ESP32 reference board, scan fails with
This is fixed by changing the channel range to (1, 14). Note that channels 12 and 13 are deprecated in the US ref - this is probably not an issue.
The text was updated successfully, but these errors were encountered: