WiFi station breaks internal temperature sensor readout on ESP32-S2

arex-ebee
Posts: 10
Joined: Thu Dec 16, 2021 1:44 pm

WiFi station breaks internal temperature sensor readout on ESP32-S2

Postby arex-ebee » Thu Jan 13, 2022 7:30 am

Hi,
I'm using the internal temperature sensor on ESP32-S2 as part of the overall system health monitoring. After initialization (temp_sensor_set_config() and temp_sensor_start()) there is a cyclic call to temp_sensor_read_celsius(). This is not a big deal and works as expected.
Additionally I needed to put the WiFi part into operation with station mode. Having this done and calling esp_wifi_start() I observed a weird behavior of the whole system suddenly printing task watchdog timeouts within different tasks, not reacting fluently any more, etc. pp.

Analyzing the root cause brought me to insight that the call to temp_sensor_read_celsius() never returns anymore after starting WiFi. Instead it enters an endless busy-wait loop within temp_sensor_read_raw() polling for HW register bit SENS_SAR_TSENS_CTRL_REG.SENS_TSENS_READY to become 1, which never happens anymore. Comparing the whole register value against the one when it was working showed that, as soon as WiFi gets enable, the temperature sensor HW is obvoisly powered off as the bits SENS_TSENS_POWER_UP and SENS_TSENS_POWER_UP_FORCE drop to 0 (although they were 1 prior to starting WiFi).

I could reproduce this behaviour using the simple wifi station example from IDF (using release/v4.4 branch as well as master), only adding the cyclic temperature sensor readout. The according source file is attached (refer to [1]).

From ESP32-S2 technical reference manual I could not see any dependency between temperature sensor and WiFi HW. The only thing I found was the hint to the mutual usage exclusion between WiFi and ADC2.
So is this temperature sensor issue a known one or even a technical limitation? Or does it require a different approach to read out the local temperature while still having a working WiFi station?

I'd appreciate any hints.


Regards

André

--

[1]
How to reproduce:
- optionally create a copy of the "simple_station" WiFi example of IDF
- replace the file station_example_main.c by the one attached
- configure WiFi SSID and WiFi Password within Example Configuration in menuconfig
- run the application
- the example will intially print a few temperature values prior to connecting to the AP
- before connecting, the readout is paused
- when connection has finished the readout is resumed after some seconds: Device is now reachable via network (ping)
- if resumed one can see Task watchdog prints and the device will probably not reachable anymore via WiFi (ping to IP address times out)
Attachments
station_example_main.c
(7.12 KiB) Downloaded 386 times

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: WiFi station breaks internal temperature sensor readout on ESP32-S2

Postby ESP_Sprite » Thu Jan 13, 2022 10:00 am

Just FYI, you may have more luck filing an issue on the ESP-IDF github repo, as this is clearly a function that does not work as expected.

arex-ebee
Posts: 10
Joined: Thu Dec 16, 2021 1:44 pm

Re: WiFi station breaks internal temperature sensor readout on ESP32-S2

Postby arex-ebee » Wed Jan 26, 2022 8:35 am

Thanks for pointing this out. I actually found an already present issue targeting this "bug" (https://github.com/espressif/esp-idf/issues/8088). So I'm crossing fingers for having more success there.

Regards
André

AlSantana
Posts: 2
Joined: Fri Oct 14, 2022 4:18 pm

Re: WiFi station breaks internal temperature sensor readout on ESP32-S2

Postby AlSantana » Fri Oct 14, 2022 4:20 pm

Hi arex-ebee!
Have you found a workaround for this? I've followed the github issue you posted but it seems it has not been fixed.
Thanks

arex-ebee
Posts: 10
Joined: Thu Dec 16, 2021 1:44 pm

Re: WiFi station breaks internal temperature sensor readout on ESP32-S2

Postby arex-ebee » Mon Oct 17, 2022 5:41 am

AlSantana wrote:
Fri Oct 14, 2022 4:20 pm
Hi arex-ebee!
Have you found a workaround for this? I've followed the github issue you posted but it seems it has not been fixed.
Thanks
Hi AlSantana,

you're damn right, the issue actually seems orphaned :( . In my project the SoC temperature is just a small peace of the overall health monitoring and not that mandatory - for now I went without it. So I'm sorry to say that I don't have any workaround yet.

Regards
André

Who is online

Users browsing this forum: No registered users and 71 guests