I have a lighting project that I want to control the light on it's own but I also want it to be controlled by external PWM source. There are numourous LED drivers that can do pulse application with EN tied to Vin make it suitable for higher voltage PWM as control and power source at the same time. With that solved, the next problem would be how to switch between external and internal PWM control.
Since the power input (12 VDC) also powers the MCU through an LDO, there are 2 options:
If I understand it correctly, in this PFET configuration, when the MCU signal is not present (meaning it's being pulled low) then the FET is switched on. Hence when the external input is constant 12 V or PWM 12 V the light will adjust accordingly. The downside is when using MCU's PWM signal to control I need to control it reversely (higher the duty cycle the dimmer the lights.)
NFET is the general approach when it comes to PWM control (such as controlling fan speed,) but I am not feeling comfortable when thevinput is 12 V PWM. My thought is changing the MCU output to constant pull-up when using 12 V PWM input, but doing so means the MCU is also turning on and off with the 12 V PWM. I know it's the same with the PFET but it won't depend on the MCU's signal to switch the FET in order to make the 12 V PWM work. At least with the PFET I could insert a PD resistor so it can stay logic low.
Which solution is better? Will PWM as power source to MCU will cause any problem to the MCU for being powered on and off?