Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22002

CCS/MSP430G2230: Port1 interrupt not triggering

$
0
0

Part Number:MSP430G2230

Tool/software: Code Composer Studio

I have a code running on an MSP430G2230 with TimerA and Port1 ISR. ADC measurements and calculations are mostly performed in TimerA ISR which also sets to Hi/Lo the output signal GD=P1.5, while the idea behind Port1 ISR is to call TimerA_ISR if a change on single input TEMP=P1.7 occurs from Low to High while being in LPM3 ( I have a rapid voltage swing on TEMP from ~0.5V to ~2.5V in that case, so that should work with the Schmitt trigger on input 1).

Port1 GD output and TEMP input are configured at startup:

// Configure GD output (P1.5)
      P1DIR |= GD;                            // Set GD to output direction
      P1OUT &= ~GD;                            // Initialize GD to low at startup

// Configure Port1 input
      P1DIR &= ~TEMP;
      P1SEL &= ~TEMP
      P1REN |= TEMP;                 // Enable internal pull-up/down resistors
      P1OUT &= ~TEMP;                 //Select pull-down mode for P1.TEMP

ADC configuration is such that only the two other available inputs on MSP430G2230 are set as analog inputs, so TEMP is not overriden as digital input by the ADC setup.

In TimerA_ISR the Port1 Interrupt is enabled:

    // Port 1.TEMP interrupt enable
    P1IE |= TEMP;                             // P1.TEMP interrupt enabled
    P1IES &= ~TEMP;                            // P1.TEMP Lo/Hi edge
    P1IFG &= ~TEMP;                           // P1.TEMP IFG cleared

    // This is test code
    // P1OUT |= GD;
    P1IFG |= TEMP;                           // P1.TEMP IFG set
      
__bis_SR_register_on_exit(LPM3_bits + GIE);        // Enter LPM3 w/ interrupt

The test code above is used to set GD output to high when the line is uncommented and that works perfectly. On the other hand, if I force Port1 interrupt with the last line of the test code and set the GD output high from the Port1_ISR, nothing happens. This shows that the microcontroller never enters the ISR:

// Port 1 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(PORT1_VECTOR))) Port_1 (void)
#else
#error Compiler not supported!
#endif
{
    P1OUT |= GD;                                    // Turn on GD
//    // call immediately Timer_A ISR
//    TA0CCTL0 |= CCIE;                          // TA0CCR0 interrupt enabled
//    TA0CCTL0 |= CCIFG;                          // TA0CCR0 interrupt enabled P1IFG &= ~TEMP; // P1.TEMP IFG cleared __bis_SR_register_on_exit(LPM3_bits + GIE); // Enter LPM3 w/ interrupt }

ADC interrupt is not enabled, so it should not prohibit the Port1_ISR from running because of the higher priority

Does anybody have an idea what is going on here? Why does Port1_ISR not trigger despite of manually setting the interrupt flag?


Viewing all articles
Browse latest Browse all 22002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>