Hello,
I tried copying the ISR from the msp430fr267x_eCOMP_03.c example here:
https://dev.ti.com/tirex/explore/node?node=ALrqqPTuSq4RjxJIqH-9pQ__IOGqZri__LATEST
I modified the code slightly to this:
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=ECOMP0_VECTOR __interrupt void ECOMP0_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(ECOMP0_VECTOR))) ECOMP0_ISR (void) #else #error Compiler not supported! #endif { switch(__even_in_range(CPIV, CPIV__CPIIFG)) { case CPIV__NONE: break; case CPIV__CPIFG: break; case CPIV__CPIIFG: break; default: break; } }
When I try running, it gets stuck in that ISR and won't advance. The disassembly looks like this:
ECOMP0_ISR():
00b574: 1300 RETI
00b576: FFFF FFFF AND.B @R15+,0xffff(R15)
00b57a: FFFF FFFF AND.B @R15+,0xffff(R15)
00b57e: FFFF FFFF AND.B @R15+,0xffff(R15)
00b582: FFFF FFFF AND.B @R15+,0xffff(R15)
...
I checked some other ISRs in my code set and, based on them, tried replacing the switch statement with this:
switch(__even_in_range(CP0IV, CPIV__CPIIFG))
replacing CPIV with CP0IV.
Now the code keeps running after going into the ISR and the Disassembly looks better:
ECOMP0_ISR():
00b56c: 140F PUSHM.A #1,R15
84 switch(__even_in_range(CP0IV, CPIV__CPIIFG))
00b56e: 421F 08E8 MOV.W &eCOMP0_CP0IV,R15
00b572: 160F POPM.A #1,R15
00b574: 1300 RETI
Here's what I found of each in msp430fr2476.h:
SFR_16BIT(CP0IV); /* Comparator Interrupt Vector Word Register */
#define CPIV (0xffff) /* Comparator interrupt vector word register */
Is this a typo in the example? Or was I doing something else wrong? Thanks!