I using the MC13213NCB and I cannot seem to get interupts to work. I am trying to use TPM1 Channel 0 to generate an interupt to increment a counter and use that counter to time a time slice. I have added the vector to the vector table and when I look at the memory when a breakpoint is reached the correct initiated values are loaded into register x35. It seems no matter what I do it will not signal the interupt, so my code just waits until the counter reaches a value, but it is always 0.
When I startup the microcontoller I initialize the delay timer and the interrupts.When I run the program it stops at the while loop in the attached code. When I reference ENABLE_INT(), it is defined as "asm cli".
Is there some sort of initialization I am forgetting.
Any help would be greatly appreciated.
Solved! Go to Solution.
I was able to get it working. The OCDlyInit() function was setting the right clockA:clockB value, but MCUInit() was setting it to x00. I switched the order of the two and it runs.
Hello Warren, and welcome to the forum.
You have not shown the code that initialises the TPM module operation. This might possibly be within the MCUinit() function. Your problem could be within this code. Additionally, what method did you use to implement your ISR function within the vector table? What is the definition of the ISR macro?
The ENABLE_INT() macro provides the global enabling of all the individual interrupts that have been enabled within initialisation process for each module.
While not associated with your current problem, a couple of further comments about your ISR code -
Regards,
Mac
bigmac, I appreciate your help. I understand what you said about the TPM1C0SC_CHOF, I don't know why it was there. I have also changed the code to use TPM1C0V += E_PER_MS.
The MCUInit() function is found in mcu_hw_config.c from Freescale. I have provided a copy of the MCUInit() function. I have also provided a copy of the vector table in the attachment. I don't know what is meant by the ISR macro.
I have also provided a copy of OCDlyInit which initializes the TPM1.
I still don't know why it will not work.
Thanks again for helping.
I was able to get it working. The OCDlyInit() function was setting the right clockA:clockB value, but MCUInit() was setting it to x00. I switched the order of the two and it runs.