Hallo, ich arbeite grad mit dem LPC2468 von nxp und rowley 1.7 mit dem cross connector, und habe probleme mit den interrupts! die IR routinen werden mehrmals nacheinander wiederholt obwohl kein neuer IR ansteht und das flag gelöscht wurde. Auch der sprung in die main funktion funktioniert nicht so wie er sein sollte!nach dem debuggen habe ich festgestellt, dass nach der ISR in die init() funktion zurück gespringt. kann mir vielleicht jemand helfen oder ein grund dafür sagen? hier der code:
1 | > #include <targets/LPC2468.h> |
2 | > #include <libarm.h> |
3 | >
|
4 | > void T1_IR(void) __attribute__ ((interrupt (\"IRQ\"))); |
5 | >
|
6 | > void init(void) |
7 | > { |
8 | > //peripheral clcok selection |
9 | > PCLKSEL0=0x4010;//PCLK for I2C0 and T1 -> CCLK |
10 | > PCLKSEL1=0x4;//PCLK for GPIO selection -> CCLK |
11 | >
|
12 | > //Power control |
13 | > PCONP=0x4;//timer T1 enable |
14 | >
|
15 | > //GPIO config |
16 | > IO0DIR &=~(1<<9);//P0.9 is an input |
17 | > IO0DIR |=1<<10;//P0.10 is an output |
18 | > IO0CLR |=1<<10;//P0.10 is clear |
19 | >
|
20 | > //I2C config |
21 | > I2C0CONSET=0x20;// I2C0 enable |
22 | > I2C0SCLH=0xc8;//set to 200 |
23 | > I2C0SCLL=0xc8;//set to 200 |
24 | >
|
25 | > //T1 config |
26 | > T1CTCR=0x0;//increment on rising PCLK edge |
27 | > T1PR=0x3fff;//set prescaler |
28 | > T1IR=0xff;//clears all IR of T1 |
29 | > T1MR0=0xffff;//MR0 is set to 0xffff |
30 | > T1MCR=0x3;//enables the MR0R of T1 |
31 | > T1TCR=0x1;//timer T1 and PC enable |
32 | >
|
33 | > //VIC config |
34 | > VICIntSelect=0x0;//IR is an IRQ |
35 | > VICVectPriority5=0x7;//Priority is set to 7 of f |
36 | > VICVectAddr5=(unsigned)T1_IR; |
37 | > VICIntEnable=0x20;//enables the T1 IR |
38 | >
|
39 | > libarm_set_irq(1); |
40 | >
|
41 | > } |
42 | >
|
43 | > void T1_IR(void) |
44 | > { |
45 | > T1IR=0x1; |
46 | > if(IO0PIN == 0x400) |
47 | > IO0SET = 1<<10; |
48 | > else |
49 | > IO0CLR = 1<<10; |
50 | >
|
51 | > VICAddress=0; |
52 | > } |
53 | >
|
54 | > int main(void) |
55 | > { |
56 | > int m=0; |
57 | > init(); |
58 | >
|
59 | > while(1) |
60 | > { |
61 | > m++; |
62 | >
|
63 | > } |
64 | > return 0; |
65 | > } |
66 | >
|