luc-github / ESP3D

FW for ESP8266/ESP8285/ESP32 used with 3D printer
GNU General Public License v3.0
1.74k stars 465 forks source link

[BUG] Wifi not working on ESP32C3 Super mini (and possibly other C3 boards) #1009

Closed IntEA31 closed 6 months ago

IntEA31 commented 6 months ago

Compiled version 3.0 from sources using platformio. After uploading into board, no ESP3D AP is visible and only posibility to communicate with living ESP3D is via serial line. No obvious reason based on available logs.

After searching through various internet sources, it seems that some ESP32 C3 boards seems to have hw defficiency within power supply design preventing the chip communicating on higher (and possible default) Tx power levels.

Based on this, wificonfig.cpp needs to be updated (patch attached) to explicitly call WiFi.setTxPower() in StartSTA() StartAP() methods and (possibly not needed) begin() method. Default power level set to 15dBm (defined by TX_POWER macro, available also from config.h). Confirmed working at least with my unnamed board.

The same problem and principal solution also apply to v2.1 code base.

ESP32C3-txpower.patch

github-actions[bot] commented 6 months ago

Thank your for submiting, please be sure you followed template or your issue may be dismissed. if you deleted the template it is here

luc-github commented 6 months ago

I have several C3 boards from different suppliers and no issue so far but I do not have ESP32-C3 supermini board can you link the board supplier and also the site that suggest the fix ?

IntEA31 commented 6 months ago

Hello Luc. Thanks for the feedback. Yes, this is probably related to hw bug on specific boards - see comments on https://github.com/espressif/arduino-esp32/issues/6430 where's Wemos Lolin C3 board mentioned. Mine board is the TenStar version of ESP32C3 from Aliexpress, eg. https://www.aliexpress.com/item/1005006211660074.html Identifiable by the buttons directly behind usbc connector. Pinout and schematic could be found on https://www.nologo.tech/product/esp32/esp32C3SuperMini.html

I think at least comment/note in config.h about TxPower lowering could save other some time in searching when using such problematic boards.

luc-github commented 6 months ago

config.h is for esp3d 2.1.x which is not supposed to work with C3 because not tested

ESP3D V3 support ESP32-C3 so the WiFi.setTxPower(XXX); should be there

But this patch should only apply when needed , not on all ESP32 boards,

Also value to apply seems to be WIFI_POWER_15dBm, WIFI_POWER_8_5dBm, WIFI_POWER_5dBm depending of the board

I need to think about it , how to add it to configurator and notes

Thank you for raising it - I keep issue open until workaround is implemented

luc-github commented 6 months ago

looking at https://github.com/arendst/Tasmota/discussions/15443#discussioncomment-2755063 the patch seems allowing to boot but usage is bad , the issue is a faulty component @IntEA31 how is you board responsiveness after patch ?

Update: I have ordered boards which seems having issue per comment in online store so.I will be able to experiment

IntEA31 commented 6 months ago

You're right, mixing v2.1 and v3.0 config, I meant configuration.h file in one of posts above.

I was affraid about stability too, so I let sit my board over weekend connected and ran monitoring via ping and also made several prints during that time. I didn't saw any problem with connection dropouts to esp3d webui or dropped communication with the printer. That all with 20cm dupont "sparrow's nest" suboptimal connection.

In my case 15dBm level was the highest safe level when the board was visible on network, so I went one step down just to be sure. I suspect that the small onboard 3V3 stabilizer could not withstand the peak current request on higher power levels, but this is just speculacy. As far as I can tell the board is 100% stable when used with lower Tx power setup.

For clean implementation the TX_POWER value could be taken from configuration.h (or my_config.h if present) and then the call for WiFi.setTxPower could be made if defined. Another patch proposal is here - ESP32C3-txpower2.patch

luc-github commented 6 months ago

I did this but cannot reproduce issue even without patch on my C3 super mini https://github.com/luc-github/ESP3D/tree/C3-Branch-patch

image

image

Let me know if ok - I have added the delay based on others people test

IntEA31 commented 6 months ago

Hello Luc. You were probably luckier or I exhausted my fortune obtaining wrong board batch - all my 3 devices has the same symptoms. I tried to compile your extra branch and can confirm it is working in both - STA and AP modes. This way everything is cleanly prepared for anyone with such problematic boards like me. This time I didn't run any deep tests as the logic of your patch is the same, just wanted to confirm you that this code could be included in mainstream branch. Thanks for your effort in software fix of hw issue.

luc-github commented 6 months ago

PR pushed - I will add the board in https://esp3d.io/esp3d/v3.x/hardware/esp_boards/esp32-c3/index.html and a comment to explain the define to use I do not plan to add it in configurator to avoid confusion, people having issue will have to refer to https://esp3d.io/esp3d/v3.x/hardware/esp_boards/esp32-c3/index.html

luc-github commented 6 months ago

page added: https://esp3d.io/esp3d/v3.x/hardware/esp_boards/esp32-c3/esp-c3-super-mini/index.html

github-actions[bot] commented 6 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.