Poor idle nissan sentra

I have a 2000 Nissan Sentra with a 2.0L. I have 2 codes, one is P0325 Knock sensor and P0171 bank one lean, which I find strange because the spark plugs are black. It also has a rough idle ans will sometimes die when stopped in gear. Anyone have any ideas?

Thanks, Tod

The engine computer has decided that the engine is running lean (P0171). Why should it think this? Where does it get its information from, to make this decision? It gets its infomation from the oxygen sensor and the MAF (Mass Air Flow) senor, for this decision. Could those voltage inputs be wrong? A check with an electrical multimeter (“voltmeter”) and a scan tool would show if those voltage signals are wrong.

Thank you! That makes sense, I’ll give it a try.
Best regards, Tod

If you have an electrical multi-tester and a service manual for the vehicle you should be able to figure out how to measure the electrical resistance of your fuel injectors. I had a rough idle/acceleration problem with my '93 and that’s what it turned out to be. No code were displayed so I was pretty much in the dark while trying to figure it out. Just a thought.