Since you have a p0340 code, that is a circuit code which means you need to check all of the circuit parts for function, including wiring, and ecu function.