Open JVKran opened 11 months ago
Weird, didn't reproduce from you uploaded program. I enabled CONFIG_PM_ENABLE
and CONFIG_FREERTOS_USE_TICKLESS_IDLE
.
By set or unset the .light_sleep_enable
field, the results are:
I (374) EXAMPLE: ADC1 Channel[5] Raw Data: 1738
I (374) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1411 mV
in sleep
out sleep
I (1384) EXAMPLE: ADC1 Channel[5] Raw Data: 1738
I (1384) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1411 mV
in sleep
out sleep
and
I (364) EXAMPLE: ADC1 Channel[5] Raw Data: 1737
I (364) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1411 mV
I (1364) EXAMPLE: ADC1 Channel[5] Raw Data: 1739
I (1364) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1412 mV
I (2364) EXAMPLE: ADC1 Channel[5] Raw Data: 1739
I (2364) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1412 mV
I'm on 482a8fb2d7 (tag: v5.1.2, origin/test/coex_test_v5.1.2_20231113_karl) change(version): Update version to 5.1.2
BTW I recall we fixed such issue on previous IDF versions so there's a test dedicated for this aim.
Let me know the updates to see if there's any regression happens.
Hi @Icarus113,
I can't seem to find the test you're running (this isn't the one) and I can't really figure out from the logs if you're taking more than one single sample after leaving light-sleep.
If not, the test's behaviour corresponds to my logs. The first sample after leaving light sleep is always right, but the samples following after that aren't.
Oh, and did you comment and uncomment lines number 37 and 38 in between flashing? So you have to flash two times and take note of the readings; see steps to reproduce.
I'll update the example to run on an ESP32-S3-DevkitC-1 and automatically toggle between automatic light sleep or not.
Kind regards,
Jochem
Hi @Icarus113,
See the newly modified example here. It automatically toggles automatic light sleep. This demonstrates the following things;
See the logs underneath.
Kind regards,
Jochem
I (330) main_task: Calling app_main()
I (330) pm: Frequency switching config: CPU_MAX: 240, APB_MAX: 80, APB_MIN: 80, Light sleep: DISABLED
I (340) EXAMPLE: calibration scheme version is Curve Fitting
I (340) EXAMPLE: Calibration Success
W (350) EXAMPLE: Automatic light sleep DISABLED!
I (350) EXAMPLE: ADC1 Channel[5] Raw Data: 2411
I (360) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1967 mV // Good!
I (1360) EXAMPLE: ADC1 Channel[5] Raw Data: 2419
I (1360) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1973 mV // Good!
I (2360) EXAMPLE: ADC1 Channel[5] Raw Data: 2420
I (2360) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1973 mV // Good!
I (3360) EXAMPLE: ADC1 Channel[5] Raw Data: 2421
I (3360) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1974 mV // Good!
I (4360) EXAMPLE: ADC1 Channel[5] Raw Data: 2416
I (4360) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1970 mV // Good!
I (5360) pm: Frequency switching config: CPU_MAX: 240, APB_MAX: 80, APB_MIN: 80, Light sleep: ENABLED
I (5360) sleep: Code start at 0x42000020, total 114039, data start at 0x3c020020, total 47412 Bytes
0x42000020: _stext at ??:?
W (5360) EXAMPLE: Automatic light sleep ENABLED!
I (5370) EXAMPLE: ADC1 Channel[5] Raw Data: 2415
I (5370) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1969 mV // Last good sample ever until reboot.
I (6380) EXAMPLE: ADC1 Channel[5] Raw Data: 1747
I (6380) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1430 mV // First wrong sample
I (7380) EXAMPLE: ADC1 Channel[5] Raw Data: 1747
I (7380) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1430 mV // Wrong!
I (8380) EXAMPLE: ADC1 Channel[5] Raw Data: 1749
I (8380) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1432 mV // Wrong!
I (9390) EXAMPLE: ADC1 Channel[5] Raw Data: 1747
I (9390) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1430 mV // Wrong!
I (10390) pm: Frequency switching config: CPU_MAX: 240, APB_MAX: 80, APB_MIN: 80, Light sleep: DISABLED
W (10390) EXAMPLE: Automatic light sleep DISABLED!
I (10390) EXAMPLE: ADC1 Channel[5] Raw Data: 1746
I (10400) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1429 mV // Wrong!
I (11410) EXAMPLE: ADC1 Channel[5] Raw Data: 1747
I (11410) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1430 mV // Wrong!
I (12410) EXAMPLE: ADC1 Channel[5] Raw Data: 1747
I (12410) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1430 mV // Wrong!
I (13410) EXAMPLE: ADC1 Channel[5] Raw Data: 1748
I (13410) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1431 mV // Wrong!
Just one more piece of information; when running this example on the ESP32-S3-DevkitC-1, the drop is even more drastic. It drops from 1970mV to around 1200mV.
I'm still on 482a8fb2d7 (tag: v5.1.2, origin/test/coex_test_v5.1.2_20231113_karl) change(version): Update version to 5.1.2
and using the newer uploaded example, with the sdkconfig in your .zip.
The results are still stable.
I (326) main_task: Started on CPU0
I (336) main_task: Calling app_main()
I (336) pm: Frequency switching config: CPU_MAX: 240, APB_MAX: 80, APB_MIN: 80, Light sleep: DISABLED
I (346) EXAMPLE: calibration scheme version is Curve Fitting
I (346) EXAMPLE: Calibration Success
W (366) EXAMPLE: Automatic light sleep DISABLED!
I (366) EXAMPLE: ADC1 Channel[5] Raw Data: 1735
I (366) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1409 mV
I (1366) EXAMPLE: ADC1 Channel[5] Raw Data: 1736
I (1366) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1409 mV
I (2366) EXAMPLE: ADC1 Channel[5] Raw Data: 1737
I (2366) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1411 mV
I (3366) EXAMPLE: ADC1 Channel[5] Raw Data: 1737
I (3366) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1411 mV
I (4366) EXAMPLE: ADC1 Channel[5] Raw Data: 1738
I (4366) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1411 mV
I (5366) pm: Frequency switching config: CPU_MAX: 240, APB_MAX: 80, APB_MIN: 80, Light sleep: ENABLED
I (5366) sleep: Code start at 0x42000020, total 114487, data start at 0x3c020020, total 47724 Bytes
0x42000020: _stext at ??:?
W (5366) EXAMPLE: Automatic light sleep ENABLED!
I (5376) EXAMPLE: ADC1 Channel[5] Raw Data: 1735
I (5376) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1409 mV
I (6386) EXAMPLE: ADC1 Channel[5] Raw Data: 1728
I (6386) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1404 mV
I (7386) EXAMPLE: ADC1 Channel[5] Raw Data: 1728
I (7386) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1404 mV
I (8386) EXAMPLE: ADC1 Channel[5] Raw Data: 1728
I (8386) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1404 mV
I (9396) EXAMPLE: ADC1 Channel[5] Raw Data: 1727
I (9396) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1402 mV
I (10396) pm: Frequency switching config: CPU_MAX: 240, APB_MAX: 80, APB_MIN: 80, Light sleep: DISABLED
W (10396) EXAMPLE: Automatic light sleep DISABLED!
I (10396) EXAMPLE: ADC1 Channel[5] Raw Data: 1728
I (10406) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1404 mV
I (11416) EXAMPLE: ADC1 Channel[5] Raw Data: 1735
I (11416) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1409 mV
I (12416) EXAMPLE: ADC1 Channel[5] Raw Data: 1735
I (12416) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1409 mV
I (13416) EXAMPLE: ADC1 Channel[5] Raw Data: 1737
I (13416) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1411 mV
I (14416) EXAMPLE: ADC1 Channel[5] Raw Data: 1737
I (14416) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1411 mV
I (15416) pm: Frequency switching config: CPU_MAX: 240, APB_MAX: 80, APB_MIN: 80, Light sleep: ENABLED
I (15416) sleep: Code start at 0x42000020, total 114487, data start at 0x3c020020, total 47724 Bytes
0x42000020: _stext at ??:?
W (15416) EXAMPLE: Automatic light sleep ENABLED!
I (15426) EXAMPLE: ADC1 Channel[5] Raw Data: 1728
I (15426) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1404 mV
I (16436) EXAMPLE: ADC1 Channel[5] Raw Data: 1727
I (16436) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1402 mV
I (17436) EXAMPLE: ADC1 Channel[5] Raw Data: 1734
I (17436) EXAMPLE: ADC1 Channel[5] Cali Voltage: 1407 mV
Done
I'm thinking if it's related to hardware. I'm using ESP32-S3-WROOM-1 and ESP32-S3-USB-OTG board for testing. (currently no devkitC-1 in my side yet)
BTW how is your input from? Would you help check if the input is stable as well.
Are the design differences between the ESP32-S3-USB-OTG and ESP32-S3-DevKitC-1 so substantial that they justify a difference in behaviour of the ADC? I hope not.
The input (a LiPo processed with a voltage divider and 100nF capacitor over it) is stable (as measured with a multimeter). I can check with an oscilloscope if there are no dips when sampling.
I don't see what the differences are between v5.1.2 and 482a8fb2d7, because all files seem to be identical.
Could it be that I've applied patches to work with the ESP-ADF?
It appears that when connecting the multimeter directly to the GPIO-pin on which masurements are made, the readings are drastically affected when the multimeter is connected and light sleep is enabled while the readings aren't affected when it is disabled.
This makes me think maybe internally something is disconnected? I tried gpio_reset_pin and gpio_sleep_sel_dis before configuring the adc, but the behaviour remains unchanged. Is there anything else I could test that you know of?
Hi @Icarus113,
I'm still not a step further and I don't see how I could make it easier to troubleshoot for you guys; there's a slightly modified basic example showing the undesired behaviour on one of your development kits.
We're relying on ADC functionality and it would be ridiculous if we would have to grab an I2C ADC while we otherwise have a perfectly fine ADC on board.
Kind regards,
Jochem
I think this issue is related.
I've just repeated this test on V5.1.4 and it is still present. Is there by any change a newer chip revision?
Answers checklist.
IDF version.
v5.1.2
Espressif SoC revision.
ESP32-S3 (revision v0.1)
Operating System used.
Windows
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
CMD
Development Kit.
Custom Board with ESP32-S3-M0N16R8
Power Supply used.
Battery
What is the expected behavior?
I expect samples taken by the ADC using the oneshot API to be the same regardless of wether the automatic light-sleep feature is enabled.
What is the actual behavior?
Samples taken with automatic light sleep enabled are approximately 500mV lower than those taken with automatic light sleep off.
Steps to reproduce.
Debug Logs.
Without automatic light sleep