This is very commonly caused by either a faulty crankshaft sensor or a faulty PCM ,Check the Crankshaft Position Sensor (CKP) and the Camshaft Position Sensor (CMP) signals with a lab scope. Check the wiring and connections at the CKP and CMP.
Check the voltage on the Yellow wire at the Camshaft Position (CMP) sensor. It should be about 8-9 volts and goes to the CMP sensor, the Crankshaft Position (CKP) sensor and the Vehicle Speed Sensor (VSS). Monitor the wire until the engine stalls. If the voltage drops down when it stalls, unplug one sensor at a time to see if the voltage comes back.