AnsweredAssumed Answered

CTU (un)freeze problem

Question asked by Hrvoje Erjavec on Mar 9, 2017
Latest reply on Mar 20, 2017 by Peter Vlna



I am using MPC5744P, and the configuration of PWM-CTU-ADC for sampling the ADC on PWM trigger. I am freezing the CTU when entering debug mode in order to disable interrupts that are triggered by the PWM, because PWM triggers continue to work even when the debug mode is entered. PWM.CTRL2.B.DBGEN only disables the output of the PWM submodule, not the triggers that go to the CTU. If I don't disable the CTU, debugging is difficult, because an interrupt is triggered while I am in debug (e.g. breakpoint is encountered), and on exit from debug mode (continue is pressed) the interrupt is executed, and the same breakpoint is triggered again on return from interrupt.


I have disabled the CTU_0 in debug mode by setting MC_ME.PCTL251.B.DBG_F bit.


This configuration works unreliably because sometimes the CTU doesn't unfreeze on the debug mode exit! This is potentially very dangerous in motor control applications, because on debug exit, the CTU remains freezed, while the PWM is working, and the code is executed. 


Now I have fixed this by freezing the PWM instead of the CTU, although the CTU freeze should have worked properly.


Can anybody help, or share some experiences on this matter?