During a thermal regeneration of a Diesel particulate filter (DPF) the temperature inside the DPF may raise above critical thresholds in an uncontrolled way (thermal shock). Especially driving conditions with a comparable low exhaust gas mass flow and high oxygen content like idle speed may create a thermal shock. This paper presents a concept for an ECU software structure to prevent the DPF from reaching improper temperatures and the methodology in order to calibrate this ECU structure.The concept deals in general with a closed-loop control of the exhaust gas air-fuel-ratio during the critical engine operation phases. Those critical operation phases are identified at the engine test bench during “Drop-to-Idle” and “Drop-to-Overrun” experiments. The experiments show that those phases are critical having on the one hand a low exhaust gas mass flow and on the other hand a high oxygen percentage in the exhaust gas. Based on the experiments an ECU function is designed in order to detect the critical phases during real world driving conditions. As the DPF temperature and the DPF soot loading are two main criterions for critical operation phases a very accurate knowledge of these values is required. So a calibration method using nonlinear optimization is established which allows an accurate calibration of the ECU's soot combustion model. The DPF temperature itself is determined by using a discrete temperature model of the DPF which is based on the heat transfer between the exhaust gas and the catalyst brick while taking into account the exothermic heat of the soot combustion.The air-fuel-ratio (AFR) is set to a nearly stoichiometric value during the critical occurrences by raising the exhaust gas recirculation (EGR) rate on the one hand and an exactly dosed fuel injection on the other hand. Using a measurement of the AFR after turbocharger the throttle of the engine is used for a closed-loop control of the AFR. The fuel injection is realized with an external fuel injector which was available on the used truck engine. In order to decrease the AFR the fuel quantity injected by the external injector is converted within in the Diesel oxidation catalyst (DOC). As there is no AFR measurement after DOC a modelled AFR is taken into account downstream DOC. For the calibration of the closed-loop controllers advanced methods were used in order to achieve a fast and accurate control.By those measures the temperature increase inside the DPF can be reduced or even avoided so that also under critical driving conditions there is no damage on the DPF expected.