Typically, the code P0340 leads to some sort of wiring issue. It could also be due to poor connection.
I have attached the trouble shooting steps for the P0340 below. Follow that guide it should help you pinpoint the issue.
Let me know of any questions.
Images (Click to make bigger)
Sunday, December 12th, 2021 AT 6:32 PM