The Powertrain Control Module (PCM) controls the Oil Pressure Sensor (OPS) which is responsible for detecting the amount of oil pressure in the engine and relays, reading, or giving a voltage value to the Powertrain Control Module (PCM).
The value of the oil pressure is usually transmitted to an indicator on the dashboard so that the driver can observe the oil pressure. In others, the indicator may not be present, but there will be a signal such as a light which will give a warning in case of problems with the oil pressure.
This diagnostic code is activated when the PCM observes that the value obtained by the Oil Pressure Sensor (OPS) is outside the expected level. Perhaps, the value is fixed when it should be changing or is out of the norm. DTC code P0521 OBD2 is set probably due to an electrical problem.