The very first thing I would check is the idle air control valve. This valve is used to fix all of the problems you are experiencing. The trouble code is in regards XXXXX XXXXX also. The first thing I would do is remove it and verify that the valve is not gummed up or anything of that nature. Here is how to access the idle air control valve.
If this is not all gummed up or anything like that, chances are that you will need a new idle air control valve. I would though, check the wiring at the valve to the engine control coputer to verify that there is no trouble there. The proper way to diagnosie this requires a class 2 scan tool like the repair facilities have. If you have access to one of those, i can assist you further.