Problem with WKP (/A7) after System.sleep

Hey,

I came across a strange problem with the WKP (/A7) pin… Using a simple code, I made my Photon sleep and wake up through the A6 pin. However, when my Photon woke up, it wasn’t able to use WKP (/A7) properly; I wasn’t able to turn on an LED, for example. Using the same code, but changing WKP to another pin (D5 for instance), I didn’t come across the same problem… Would anyone know what the proble might be?
Here’s my code:

#include "application.h"

void setup() {
    pinMode(A6, INPUT_PULLUP);
    delay(20000);
    System.sleep(A6, FALLING); // waking up on the rising edge of the A6 pin
}

void loop() {
    pinMode(WKP, OUTPUT);
    digitalWrite(WKP, HIGH);
}

Sounds similar to this:

@wesner0019 Yes, it seems like the same problem, here.

I looked into the firmware and it seems like WKP is automatically enabled as the wake up pin when System.sleep() is used (whether it be in stop mode or deep sleep mode).
In the firmware/hal/src/stm32f2xx/core_hal_stm32f2xx.c file, the function void HAL_Core_Execute_Stop_Mode(void) seems to enable WKP as the wake up pin with this function: PWR_WakeUpPinCmd(ENABLE); [found in the firmware/bootloader/src/photon/stdperiphdriver/stm32f2xx_pwr.c file], regardless of the pin previously defined as the wake up pin.
Do you think this is really the problem? Anyone knows how to change that?

Thanks in advance for your answer.

Edit: looking again into the code, what I wrote earlier probably isn’t true… though I’m not sure. :confused:
Because in the file firmware/hal/src/core/core_hal.c, the function void HAL_Core_Execute_Stop_Mode(void) does seem to take into account the wake up pin defined by ***void HAL_Core_Enter_Stop_Mode(void)***. So definitely confused about what libraries are used and what is really wrong with my code. :pensive: