Page 1 of 1

ESP32S2 WiFI connection problems

Posted: Wed Jun 09, 2021 1:33 pm
by vrbataj
Hi,
I have problems with WiFi connection on boards with ESP32S2. I have two types of ESP boards, Espressif ESP32-S2-Saola-1R and my own boards (custom design). I use fresh version of Micropython GENERIC-S2 (clone from Github) compiled with IDF 4.3. All technologies that need SPI, I2C, GPIO inputs/outpust work well, but I have problems with Wifi comunication. Connection to wifi works fine, but subsequent communication does not work.

Simple log with upip install for example :

connecting to network...
network config: ('192.168.1.109', '255.255.255.0', '192.168.1.1', '192.168.1.1')
7c:df:a1:17:a9:b8
Installing to: /lib/
Error: Unable to resolve micropython.org (no Internet?)


on all my ESP8266, ESP32 boards the same code works fine :shock:

Do you have any idea, please ???

Re: ESP32S2 WiFI connection problems

Posted: Wed Jun 09, 2021 1:57 pm
by Roberthh
It could be a RAM exhaustion problem. That was reported earlier. Try to reduce the size of RAM allocated for the heap. That happens in main.c at about line 123. Change that to:

size_t mp_task_heap_size = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT) - (12 * 1024);

There is a similar code at line 118, which is excuted by a SPIRAM build on a non-SPIRAM device.

Re: ESP32S2 WiFI connection problems

Posted: Wed Jun 09, 2021 2:38 pm
by vrbataj
Thank you very much !
With this memory heap setting the program collapsing after interface was activate ....

import network
sta_if = network.WLAN(network.STA_IF)
sta_if.active(True)


crash.....

Re: ESP32S2 WiFI connection problems

Posted: Wed Jun 09, 2021 3:57 pm
by Roberthh
That's strange. I had to do exactly that to get it running. What is reported by gc.mem_free()? Maybe now the heap os too small. You could try other reduction sizes, like 8 * 1024. This change just leaves some more RAM for the non-heap malloc, which is required by the IP stack. If malloc fails, it just silently refuses to work.

Re: ESP32S2 WiFI connection problems

Posted: Thu Jun 10, 2021 11:01 am
by vrbataj
Value 10*1024 seems to be ok. I have to do more tests, but the current situation looks much better. ESP is connected to WiFi, ESP is connected a subscribbed to MQTT broker, sends and receives MQTT messages ;)

Re: ESP32S2 WiFI connection problems

Posted: Thu Jun 10, 2021 7:58 pm
by davef
Roberthh,
That was reported earlier
I had a look for specific ESP32S2 issues and couldn't find one about RAM exhaustion.

Does this only affect the ESP32S2?

Thanks

Re: ESP32S2 WiFI connection problems

Posted: Thu Jun 10, 2021 8:16 pm
by Roberthh
It affects only the ESP32S2, because it has less RAM than the standard ESP32.
The discussion took place at the MicroPython Git repository, e.g. https://github.com/micropython/micropython/issues/7214 or https://github.com/micropython/micropython/pull/7163

Re: ESP32S2 WiFI connection problems

Posted: Thu Jun 10, 2021 9:16 pm
by davef
Thank you.