I'm currently designing device which will be powered from external PSU but also will have backup power system from battery. I'm trying to solve my problem. When external power source is down (5V - USB), I'm switching to battery source. Battery powers my 3,3V power line through LDO regulator. At the same time boost converter turns on and powers my 5V bus. I have problem that external 5V source (USB) is connected directly to my main 5V bus, same as my boost converter. Where is problem? Charging circuit is also powered from 5V bus (USB), that means battery will charge itself, it'll drain quickly.
I want to note that only one source will work at the same time, there are additional switching circuits which will take care of it. There is no possibility that boost converter will be working when external source is connected.
I came with such idea like on picture above. However I'm bit suspicious, will it work? N-channel mosfet is "inverted" and I'm unsure how it will behave in real life scenario. I tried it with simple simulation and it somehow work, but it's just simulation... Any advices are welcome. I'd like to keep it simple as possible. If 5V bus wouldn't be critical, I'd probably just use diode, but I need to keep it as close 5V as possible at this stage of design.
I was also thinking about doing same thing with NPN transistor, but I'm unsure because of power losses and current ratings (this part of bus consumes up to 200-250mA),
In tl;dr I want to avoid powering a piece of power bus, isolate it.