OVMS3-idf/components
Ivan Grokhotkov 6b3a8acdc3 pm: fix entering light sleep in single core mode
Tickless idle/light sleep procedure had a bug in single core mode.
Consider the flow of events:
1. Idle task runs and calls vApplicationIdleHook
2. This calls esp_vApplicationIdleHook, which calls esp_pm_impl_idle_hook, and pm lock for RTOS on the current core is released.
3. Then esp_vApplicationIdleHook calls esp_pm_impl_waiti, which checks that s_entered_light_sleep[core_id]==false and goes into waiti state.
4. Some interrupt happens, calls esp_pm_impl_isr_hook, which takes pm lock for RTOS. PM state goes back to CPU_FREQ_MAX.
5. Once the interrupt is over, vApplicationIdleHook returns, and Idle task continues to run, finally reaching the call to vApplicationSleep.
6. vApplicationSleep does not enter light sleep, because esp_pm_impl_isr_hook has already changed PM state from IDLE to CPU_FREQ_MAX.

This didn’t happen in dual core mode, because waiti state of one CPU was interrupted by CCOMPARE update interrupt from the other CPU, in which case PM lock for FreeRTOS was not taken.

Fix by inverting the meaning of the flag (for convenience) and only setting it to true when vApplicationSleep actually fails to enter light sleep.
2018-11-21 03:42:15 +00:00
..
app_trace cmake: Add support for test build 2018-10-20 12:07:24 +08:00
app_update cmake: Add support for test build 2018-10-20 12:07:24 +08:00
asio cmake: make main a component again 2018-09-11 09:44:12 +08:00
aws_iot cmake: make main a component again 2018-09-11 09:44:12 +08:00
bootloader bootloader: verify that loaded image does not overlap bootloader code 2018-10-26 12:44:10 +08:00
bootloader_support bootloader: verify that loaded image does not overlap bootloader code 2018-10-26 12:44:10 +08:00
bt Merge branch 'bugfix/btdm_controller_disable_v3.2' into 'release/v3.2' 2018-11-21 11:26:14 +08:00
coap cmake: silence some warnings in coap, bt, expat, libsodium, lwip and examples/bluetooth 2018-09-20 18:53:15 +08:00
console cmake: fix source list issues 2018-09-13 08:56:59 +08:00
cxx cmake: Add support for test build 2018-10-20 12:07:24 +08:00
driver aes/sha/mpi: Bugfix a use of shared registers. 2018-11-05 04:22:47 +00:00
esp-tls Merge branch 'bugfix/esp-tls-doc' into 'master' 2018-11-05 12:30:22 +08:00
esp32 pm: fix entering light sleep in single core mode 2018-11-21 03:42:15 +00:00
esp_adc_cal cmake: make main a component again 2018-09-11 09:44:12 +08:00
esp_event esp_event: lower test performance threshold for PSRAM config 2018-11-01 13:50:08 +08:00
esp_http_client esp_http_client: Fix crash in async mode 2018-10-30 09:58:57 +00:00
esp_http_server HTTP Server : Added esp_ prefix to http_server component files 2018-10-24 17:32:20 +05:30
esp_https_ota cmake: make main a component again 2018-09-11 09:44:12 +08:00
esp_ringbuf cmake: Add support for test build 2018-10-20 12:07:24 +08:00
espcoredump cmake: Add support for test build 2018-10-20 12:07:24 +08:00
esptool_py Merge branch 'bugfix/run_esptool_espport' into 'master' 2018-10-17 08:14:20 +08:00
ethernet ethernet: multi-call failure in esp_eth_init 2018-11-19 14:55:43 +08:00
expat cmake: Add support for test build 2018-10-20 12:07:24 +08:00
fatfs cmake: Add support for test build 2018-10-20 12:07:24 +08:00
freemodbus examples: freemodbus port slave basic implementation 2018-10-17 12:47:12 +02:00
freertos freertos: fix compilation warning in single core mode 2018-11-21 03:42:15 +00:00
heap cmake: Add support for test build 2018-10-20 12:07:24 +08:00
idf_test Merge branch 'test/fix_bug_of_scan_interval_and_windows' into 'master' 2018-11-05 11:00:58 +08:00
jsmn cmake: make main a component again 2018-09-11 09:44:12 +08:00
json cmake: make main a component again 2018-09-11 09:44:12 +08:00
libsodium cmake: Add support for test build 2018-10-20 12:07:24 +08:00
log cmake: make main a component again 2018-09-11 09:44:12 +08:00
lwip ethernet: fix some bugs in phy&mac driver 2018-11-19 14:55:43 +08:00
mbedtls aes/sha/mpi: Bugfix a use of shared registers. 2018-11-05 04:22:47 +00:00
mdns mdns: sending search packets also in probing and announcing state 2018-11-19 04:38:04 +01:00
micro-ecc cmake: make main a component again 2018-09-11 09:44:12 +08:00
mqtt mqtt: ssl mutual authentication example added per PR from github, corrected cmake build, updated per idf style 2018-10-30 08:04:09 +01:00
newlib newlib: Fix UT adjtime 2018-11-01 20:34:39 +08:00
nghttp cmake: make main a component again 2018-09-11 09:44:12 +08:00
nvs_flash cmake: Add support for test build 2018-10-20 12:07:24 +08:00
openssl cmake: make main a component again 2018-09-11 09:44:12 +08:00
partition_table cmake: Add support for test build 2018-10-20 12:07:24 +08:00
protobuf-c protobuf-c : Added Google's protocol buffer C library as sub-module 2018-10-02 19:07:28 +05:30
protocomm Protocomm : Use esp_http_server instead of http_server 2018-10-24 17:32:43 +05:30
pthread Merge branch 'feature/cmake-unit-test' into 'master' 2018-10-22 16:29:15 +08:00
sdmmc cmake: Add support for test build 2018-10-20 12:07:24 +08:00
smartconfig_ack cmake: make main a component again 2018-09-11 09:44:12 +08:00
soc aes/sha/mpi: Bugfix a use of shared registers. 2018-11-05 04:22:47 +00:00
spi_flash cmake: Add support for test build 2018-10-20 12:07:24 +08:00
spiffs spiffs: increase timeout in readdir test 2018-11-21 03:42:15 +00:00
tcp_transport Merge branch 'bugfix/esp_http_client_async_crash' into 'master' 2018-11-05 12:30:04 +08:00
tcpip_adapter mdns: fixed crashes on network changes 2018-10-24 12:03:41 +02:00
ulp cmake: Add support for test build 2018-10-20 12:07:24 +08:00
vfs cmake: Add support for test build 2018-10-20 12:07:24 +08:00
wear_levelling Version update from V1 to V2 now done in correct way. 2018-10-26 09:21:30 +03:00
wifi_provisioning Examples : Added provisioning examples, tests and client tool. 2018-10-02 19:07:28 +05:30
wpa_supplicant cmake: Add support for test build 2018-10-20 12:07:24 +08:00
xtensa-debug-module cmake: make main a component again 2018-09-11 09:44:12 +08:00