I am doing a project with a numeric keypad, an ESP32 programmed in nanoFramework (CoreLibrary 1.9.0 p5, Esp32 1.3.2 p9). Now I want to wake up the controller with a keypress on one of the buttons. The code for handling the matrix works fine, buttons are responsive and working:
var row4 = controller.OpenPin(32);
row4.SetDriveMode(GpioPinDriveMode.Output);
...
var col3 = controller.OpenPin(12);
col3.SetDriveMode(GpioPinDriveMode.InputPullDown);
Before going to sleep i redefine the drive modes to have one pin at 3.3V:
Sleep.EnableWakeupByPin(Sleep.WakeupGpioPin.Pin32, 1);
col3.SetDriveMode(GpioPinDriveMode.OutputOpenDrainPullUp);
Sleep.StartLightSleep();
So the ESP32 goes into sleep as expected, but I cannot wake it up with pin 32.
What I've tried:
- Pin numbering seems a bit strange when it comes to RTC-pins. Pin32 seems to be RTC-Pin9. But the
WakeupGpioPin
-enum only contains normal GPIO numbers. - Tried to swap the two, Pin12 as WakeupPin and Pin32 as Pullup.
- Externally pulling the pin high or low - no effect
- The "level" parameter in
EnableWakeupByPin
seems to be the voltage level and 1 beeing HIGH, according to the espressif Docs. However, I also tried 0.
The pin numbering is per the Espressif documentation. You don't need to configure the GPIO pins before the call to EnableWakeupByPin unless used by application.
I have tested this and It looks like the Sleep.EnableWakeupByPin() is not working. We will look into the cause and get it fixed.
Try using the Sleep.EnableWakeupByMultiPins(). I have tested and that is working.