OS : MQX 3.2
Controller : M52259
I am trying to use the core watchdog timer for MCF52259.
I have the following queries:
1) The timer interrupt flag always remains 1. The reference manual says that writing a 1 to this bit in CWCR register would clear the interrupt request.
The code used is as given below:
//disable the timer
MCF_SCM_CWCR &= 0x7F;
//service the timer
MCF_SCM_CWSR = 0x55;
MCF_SCM_CWSR = 0xAA;
//clear the interrupt request
MCF_SCM_CWCR = 0x01;
MCF_SCM_CWCR |= 0x01;
Both the statements above makes the value of CWCR to be 0x01. The interrupt request is not cleared.
How can I clear it?
2) The reference manual says a value of '010' for CWT in CWCR gives a timeperiod of 2^13 bus clock frequency. If the bus frequency is 48Mhz, what would be the timeout period?
Will it be time = (48*10^6) / (2^13) ?