In one application we are using an MC9S08GT60 MCU for displaying text in an LCD. This LCD requires us to implement some delays between commands. These delays consist in a function call that has a cycle that verifies the value of a timer and refreshes the Watchdog. We are using one of the TPM modules in the MCU as timer. In some cases it happens that the application gets cycled forever. I tracked down this situation and discoverd the application is in this cycle and the timer is not running. Verifying the memory addresses, I discovered the TPM Status and Control register has a value that does not correspond to a valid value for the application. Its normal value is 0x4F, with the timer overflow flag active it is 0xCF and when cycled, it has ALWAYS a value of 0x01. No other register next to it has a different value from the configured and correct ones. We wonder if some process of the MCU causes this situation and how could we deal with it.
Thanks in advance.