I paid a Cummins shop $600 for trouble shooting a rough runner with laptops and codes.  Oddly, the ATC light would flash when it missed a beat and that was confusing them.  Finally, a "good 'ole boy' blurted out, "Just change the *%X&n filters."  It has run well ever since and the ACT light quit flashing.  For the $600 they found a code saying the fuel pump had not been delivering enough fuel so the engine had to "de-rate".  The pump could pull enough fuel through the filters for the de-rated state, so it would decide to lurch back to "normal".
On the first sign of trouble, change the fuel filters!
I now have spare filters sealed in plastic, a couple strap wrenches and think I remember how to do change them.  If I forget, I'll call Marty for coaching.