Hi. I am short with MCU pins and I am trying to mix an LED output with an interrupt input to wake up the MCU from a deep sleep state on the same pin I/O. The MCU can only be woken up from deep sleep through an interrupt high input while is in deep sleep state. I send the MCU to deep sleep because I disconnect main power and keep MCU in deep sleep powered with a battery.
Right now I use two pins:
- One pin is used with a LED which is turned on with a high signal (3V) from MCU in normal operation (when is awake).
- Other pin is used as interrupt input to wake the MCU up when main 3V power is connected. As this pin is directly tied to main power, it always see 3V while the main power is on. When main power is disconnected (I still have battery power), I send the MCU to deep sleep and when the main power is back on the pin interrupt input see again 3V to wake up.
I want to mix both pins in only one pin I/O by changing the configuration of the pin on each situation:
- In normal operation (main power is on), the pin is configured as an output for the LED (default state is low to have the LED off).
- When main power turns off, before sending the MCU to deep sleep I change the pin configuration as interrupt input.
- When main power is back on (3V), the MCU wakes up and I change the the pin configuration back to output for the LED.
My problem with my configurations mixing idea is that the pin always see 3V while main power is on, therefore the LED is always on and I cant control it with the MCU.
Does any one have any suggestion? Thanks
Right now I use two pins:
- One pin is used with a LED which is turned on with a high signal (3V) from MCU in normal operation (when is awake).
- Other pin is used as interrupt input to wake the MCU up when main 3V power is connected. As this pin is directly tied to main power, it always see 3V while the main power is on. When main power is disconnected (I still have battery power), I send the MCU to deep sleep and when the main power is back on the pin interrupt input see again 3V to wake up.
I want to mix both pins in only one pin I/O by changing the configuration of the pin on each situation:
- In normal operation (main power is on), the pin is configured as an output for the LED (default state is low to have the LED off).
- When main power turns off, before sending the MCU to deep sleep I change the pin configuration as interrupt input.
- When main power is back on (3V), the MCU wakes up and I change the the pin configuration back to output for the LED.
My problem with my configurations mixing idea is that the pin always see 3V while main power is on, therefore the LED is always on and I cant control it with the MCU.
Does any one have any suggestion? Thanks
