Ok, so where do I begin?
I started having this problem last November, and have gone through a lot of trouble, learning, and money, before I was finally able to fix it.
In a nutshell, If you are getting 505 codes, or 500 codes, then your IACV has failed, and has taken your ECM with it.
Even if you are not getting these codes, I can assure you with 99% accuracy that this has happened to you (bad IACV I mean).
OK, a little lesson on how the system works:
Firstly, the ECM, throttle position sensor, and IACV sets the idle speed. There is NO mechanical idle adjustment.
When the engine is operating and idling normally, the main throttle valve is fully closed (i.e...your foot is off the gas pedal).
The engine still needs a little air for it to be able to idle though, and it gets that air via the IACV valve. That is it's job.
The IACV opens and close accordingly, letting in more or less air, depending on how cold the truck is.
On cold startups for example, the IACV opens up a little more, lets in more air, and therefore the truck will idle a little faster when cold.
As it warms up, the IACV closes up a little, lets in less air, and the idle drops to normal.
When the IACV fails, it fails in the closed position, and your engine gets no air, and it stalls. That's why you have to keep your foot on the gas pedal a little.
Your engine is starved for air.
Tightening up the throttle cable until it idles is not a fix. It only masks the problem.
Now for the fix: A new IACV, and a new or rebuilt ECM.
The IACV is around $400, and a new ECM from the dealer is over $1000.00
The good news is, there's a company in South Carolina that repairs them for this exact problem. Flat rate of $250.00
They are Circuit Board Medics.
That's what I did with mine....got it fixed.
It may be tempting to try and get a used IACV, or maybe pull one from a junker, but I caution against doing that.
If you install a used one, and it's no good, you'll blow the ECM again. Bite the bullet and get a new from from Nissan.
If you still need more info, check out this thread:
2002-pathfinder-wont-idle-any-suggestions-t530479.html