ESP32-C3 modem sleep

Hi, Jason et al.!

Maybe this is not the best topic to ask about it, but I was fixing the similar errors for two days and have found this topic. I will start from AFAR :smiley:

What I need to do is to implement modem-sleep of ESP32C3 chip. I’ve found this example:

I do use Arduino for the board, but since I need to do the menuconfig changes, I understood, I need to go with the following setting in my ini file:

framework = arduino, espidf

With this, I was able to have sdkconfig in my project and use menuconfig to change the values according to the Readme.
I am a complete dummy in espidf sdk, but for me it looks like the whole code of that example is just for the general BLE connection, and everything related to the modem-sleep mode is the pm config and light-sleep enable thing.
Which raises a question:

  • do I need to do the espidf + arduino just for sdkconfig file? Because the pm_config and light_sleep is something you can do in arduino just importing appropriate esp libraries
  • if it is indeed needed, how to minimize the C code? is it as easy as to just create an app_main entry point for the application similar to the arduino-esp blinky example you have in the pioarduino repository? So then from that app_main I can navigate to my normal cpp arduino code?

I can imagine I do it completely wrong and don’t understand many things, but maybe you guys can guide me here a little.

Since there is no default NimBLE support in Arduino there is no easy solution. Probably easier and faster to reach the goal is to code everything with espidf. Even when managed to compile with Arduino with needed changes, i don’t know if Arduino will work at all with the changed power mode settings.

You mean, that there’s no official Espressif made ESP32 Nimble library?
BTW, wouldn’t this work?
https://docs.arduino.cc/libraries/nimble-arduino/

Arduino NimBLE support is currently developed. idk if this lib is working together with the esp32

BTW, just finished porting BLE functionality from BLEDevice (bluedroid Arduino Library) to Arduino Nimble - works as expected.