I've been trying to switch voltage rails (both Vcc and Gnd) of a device on and off from a digital pin on a Teensy 3.2. I have made a corresponding Low side switch using BC547 npn transistor and a High side switch using a BC557 pnp transistor with another BC547 to serve as a level shifter as it switches 5V from 3.3V and an inverter since I am using the same digital pin for both. The load is an tiny lcd display that draws no more than 100mA. I've tested the two circuits individually and they work flawlessly.
The reason I want to switch both Vcc and Gnd is because the Teensy goes through a sleep mode and even if I used only Low side switching, the display used to flicker and not turn off like I wanted it to. And I'm thinking that would lower my power consumption but that isn't really a matter to me although I'm not sure if that really does lower it.
The problem I am facing is when I switch both Vcc and Gnd off through the transistors and turn them on again, the lcd is misbehaving, i.e is not intialized properly, it does not behave the way it would when it is powered directly and completely fails its purpose by not displaying anything. I tried adding a delay between turning on the transistors and initialization but that doesn't seem to help. Am I doing something wrong here or should I connect the Gnd before Vcc? I'm pretty sure I'm missing something here but I can't seem to figure it out. Can someone help me out? Thanks in advance.