-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[RF internals] Modules that work with NonOS 2.2.x don't work with RTOS SDK (GIT8266O-777) #1200
Comments
This also affects other boards like some Sonoff Basic units. One other thing you may want to try is to reduce the TX power. One way to make sure the proximity of the metal parts might be an issue is by adding a number of pin headers stacked to place the board further away. Anyway, kuddos for the amount of work researching the problem, given how many topics you already mentioned. |
Thanks! TX power was set to 20 throughout the tests, did try 19 when looking into power rail stability but it didn't change much. Nice clue that it had a good effect in some boards. It definitely must be something within Espressif's libraries 🤔 |
Keep in mind the max. set TX power is exactly what its name state... the max. When connecting via 802.11b it can go up to that TX power. Setting the TX power "10" points lower, will reduce the power by a factor of 10. From 20 dBm to 19 dBm will not make much of a difference, and nothing at all when using WiFi standards from the last 15 years :) |
Lowering the TX power may only have an effect when:
If the antenna is badly tuned (metal close to the antenna, as well as some plastics like ABS and your hand may also de-tune an antenna) a lot of the sent out RF energy is reflected back into the radio. So by reducing the TX power, you may end up getting less energy sent back into the ESP. |
Nice! bringing TX power down to 12dB makes it work 🎉 (13dB just barely, and the default 20dB is out of the question). Could it be then, NonOS SDK 2.2.x had some internal routine to automatically throttle down TX power? (either during calibration or at runtime). And that routine got changed and arrived broken at RTOS SDK? 🤔 PS: Also checked with an oscilloscope every signal, voltages are rock solid at 3.3V and data pulses are very clean. |
I have no idea how the ESP internally may compensate for the antenna length/tuning. A few factors affecting the resonance frequency of an antenna:
The effect of a mismatch in antenna length is that some of the signal will reflect back into the transmitter. A very simple way of tuning an antenna to its perfect length is simply by changing the length of the antenna. There are several ways to implement an antenna matching network. I can imagine the ESP internally has a number of parts available to create such an antenna matching network, which can be "connected" or "disconnected" or "shorted". Also the amount of reflected energy back into the transmitter may have an effect on such a tuning algorithm. Since the ESP typically does perform the RF tuning when starting the WiFi, you could start the WiFi with a low TX power and then after the calibration increase the TX power. However, this is not enough to make all ESP WiFi related issues disappear. |
Not Prusa staff though! I'm just helping with this annoying bug, also for the longevity of plenty ESP8266s still around. Thanks again for going into detail, it makes a lot of sense as you explain it. Really like your adaptive approach and will give it a try in future implementations 👌
Sounds like a good next step. Will give it a try this weekend and see. |
Still, it may result in a proper interface for the Prusa printers :) Just make sure to also test the WiFi performance with the enclosure closed as the presence of it may also affect the antenna's resonance frequency. |
Tests done! It turns out However, it's interesting that leaving 20dB in sdkconfig (the max), and then setting |
@espressif Please look into this, the problem is that wifi connection doesn't work until TX power is reduced. |
Hmm I had missed this post somehow. Anyway, can you check by measuring the current consumption (best to use some lab power supply as this regulates the voltage after the current measurement) to see if you actually increase the TX power? |
Note the call |
Got confirmation from a couple users, the problem and the patch replicate behavior exactly. |
Environment
Problem Description
TLDR: Many ESP8266 modules that work with NonOS SDK 2.2.x, don't work with RTOS SDK, until touching the chip. Asking to investigate internal RF parameters changes since that NonOS version.
Recently we found that some ESP-01 modules just wouldn't connect (prusa3d/Prusa-Firmware-Buddy#2303). Extensive testing included: speed changes (clock, flash freq, serial baudrate), flash parameters (qio/dout/etc), network changes (all parameters), power supply changes, erasing flash, etc. Prusa devs arranged a spreadsheet to annotate which modules work (spreadheet).
ping 192.168.1.11 -a -i 0.1
made evident that the connection only works when touching the module. The ping stops when removing the finger, and resumes instantly when touching the chip.Found that many projects are still using an old version of NonOS SDK because of connectivity problems esp8266/Arduino#6724. Moreover, @d-a-v and @Aircoookie pointed out it depends on hardware esp8266/Arduino#5736 (comment) and esp8266/Arduino#5784 (comment), fixed by using NonOS SDK 2.2.x.
Then found a discussion by @TD-er where he also noticed the module would work while touching it esp8266/Arduino#8163. He pointed to the RF calibration & antenna tuning, so I investigated the initialization routine and found some differences (see below). However, I have not been able to solve the problem by changing any RF parameters. Let me know your suggestions or any more testing needed.
Extra info
In case it was related to floating GPIO, also tested PRs #1071, #1024. Or to a rogue timer also tested #1102. Or SPI issues also tested #1128. They work but made no difference here :-/
Tried changing RF parameters. From Arduino to RTOS, there are a few changes in RF initialization:
rf_cal_use_flash
is the same (1) in arduino and RTOS. I've also tried setting it to 3 to force full RF calibration.freq_correct_en
is the same (0) in arduino and RTOS. I've also tried setting it to 1 and 3, to allow frequency correction as suggested by @TD-er.Expected Behavior
Regular ping responses with
ping 192.168.1.11 -a -i 0.3
Actual Behavior
No connection, no ping responses. It only works while keeping a finger on top of the ESP8226 chip.
Exact setup, compiling with NonOS SDK 2.2.x, works flawlessly.
The text was updated successfully, but these errors were encountered: