Piotr Ryba

MPC5604B IRQ

Discussion created by Piotr Ryba on Feb 15, 2012
Latest reply on Mar 21, 2013 by Ralph Heinbach

Hi, since tree days i have been trying to run interrupt on my MPC5604B. I chcecked everytking but i can't understand what i'm doing wrong. Code never go into IRQ_1 function. Could anybody help me to run PIT interrupt? I use CW 5.9.0 and that is my code:

#include "MPC5604B_M27V.h"#include "IntcInterrupts.h"#include "watchdog.h"void modes_clock_init(void){ ME.MER.R = 0x0000001D;           // Enable DRUN, RUN0, SAFE, RESET modes                                 // Initialize PLL before turning it on:           // Use 1 of the next 2 lines depending on crystal frequency:  CGM.FMPLL_CR.R = 0x02400100;     // 8 MHz xtal: Set PLL0 to 64 MHz     ME.RUN[0].R = 0x001F0074;        // RUN0 cfg: 16MHzIRCON,OSC0ON,PLL0ON,syclk=PLL   ME.RUNPC[1].R = 0x00000010;      // Peri. Cfg. 1 settings: only run in RUN0 mode  ME.PCTL[92].R = 0x01;           /* PIT, RTI: select ME_RUN_PC[0] */                                      // Mode Transition to enter RUN0 mode:  ME.MCTL.R = 0x40005AF0;          // Enter RUN0 Mode & Key  ME.MCTL.R = 0x4000A50F;          // Enter RUN0 Mode & Inverted Key    while (ME.GS.B.S_MTRANS) {}      // Wait for mode transition to complete                                   // Note: could wait here using timer and/or I_TC IRQ  while(ME.GS.B.S_CURRENTMODE != 4) {}// Verify RUN0 is the current mode }void irq_enable(void) { INTC.CPR.B.PRI = 0;          /* Single Core: Lower INTC's current priority */ asm(" wrteei 1");         /* Enable external interrupts */}void IRQ_1(void){ uart0_send_char('1'); PIT.CH[0].TFLG.B.TIF=1;  }void main(void) { int i=0; modes_clock_init(); watchdog_disable();  INTC_InitINTCInterrupts(); INTC_InstallINTCInterruptHandler(IRQ_1, 59, 1); INTC.MCR.B.HVEN = 1;   PIT.PITMCR.B.FRZ=1; PIT.PITMCR.B.MDIS=0; PIT.CH[0].LDVAL.R  = 64000; PIT.CH[0].TCTRL.B.TIE  = 0x1 ;   PIT.CH[0].TCTRL.B.TEN = 0x1 ;           irq_enable(); while(1){  i++; }}

 Thanks for help.

Outcomes