When I had the same problem, the EGR connector was loose.
Tightened the connector and cleared the code. Light never came back on, and idle was smooth again.
Problem could be more severe- Knock Sensors, but I'm not sure that this would cause stalling.
Oh what the heck, see Wes & Jesdas Q45.org:
http://www.q45.org/roughidle.html