2003 saturn

I’m stumped . While driving , it stalls . Like it either runs out of gas or floods out . Smells like bad gas when this happens . Diagnostic tool shows cam shaft pos sensor . Changed it . no fix . ???

Read this code description:

http://www.obd-codes.com/p0340

It says that you may have a broken wire in the circuit, a bad connection, a bad PCM, or a bad crank angle sensor.