Pull up resistor on P-MOSFET gate. Not working
a better idea for this, if you want to use a PMOS high side switch, would be to have the ATSAMD21 switch a low-side NPN switch, which then switches the PMOS for the SIM530. Example:







simulate this circuit &ndash; Schematic created using CircuitLab

R2 (arbitrarily chosen to be 50x R1) pulls Q1 to ground (off) if D1 is in high impedance state, which it may be if the uC is off. This means M1 gate is definitely pulled up to 4.2 V.

The issue with your design is we don't know exactly what is inside the microcontroller output when it is off, so we shouldn't rely on it. Also, considering even when DOUT is a "1" it is 3.3 V, which is lower than the 4.2 V driving the Modem, so M1 may be partially on. While it seems to be working for your case, it is not great practice... If the load were running off 5 or 12 V, the V(GS) of M1 could become an issue.