I suspect the NOx sensor is bad. When they fail, the engine starts and runs good cold, runs good warm under load, but at idle it rolls or lopes. What is happening is the NOx sensor likely has a value reading of zero, so the ECM is attempting to regulate fuel flow to an engine with no load at idle. The ECM triggers the FCM to increase and decrease pulse width at the injectors based on a false NOx reading, and the idle speed trying to rise above the idle control value, being caught and rolled back. Increased width is too much fuel, so ECM compensates and tries to drop the idle by decreasing the width. Then it is caught in a loop and keeps repeating.