This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

nested interrupt on msp430

Other Parts Discussed in Thread: MSP430G2544

Hi,

i am sending command over uart on msp430g2544 for pwm generation to drive motor and taking feedback from motor with

port 1 gpio using ISR. i am not getting interrupts on port 1 after enabling global interrupt inside ISR.

simply it stuck and not responding on further commands.

please can you tell me how to handle interrupts within ISR.

Regards,

Akash

  • hi Akash!

    Normally there is no need to enable interrupts in interrupts. Your description sounds like you maybe never leave the interrupt function because the IFG does not get cleared. Please post your code so we can see what we are talking about.

    Dennis
  • Hi Dennis,

    I am sending command over UART to generate PWM with sent steps in UART packet. on each PWM interrupt i am counting

    steps and if steps is over i am turning off the timer as well as taking feedback from port 1 with interrupt on falling edge to check status of motor.

    here's my sample code.

    main() {

        /* enabling global interrupt and port 1 interrupt */

        /* starting timer if command is send over UART to do so*/
        TACCR0 = i_px_uart_cmd->speed;
        TACCR2 = (i_px_uart_cmd->speed >> 1) - 1;

        TACCTL2 = OUTMOD_7 + CCIE;
        TACTL   = TASSEL_2 + MC_1 + TAIE;

    }

    /* PWM isr routine */

    #pragma vector=TIMERA1_VECTOR
    __interrupt void pan_pwm_service(void)
    {
        static unsigned short int pan_steps;

        if(TACCTL2 & CCIFG) {
            pan_steps++;                                    // if it is pwm interrupt, inc step
            TACCTL2 &= ~CCIFG;
        }
        __bis_SR_register(GIE);

        if (pan_steps > gPanSteps) {
                pan_steps = 0;                             // stepping over

              /* stop timer */
        }
    }

    /* read status on port */

    #pragma vector=PORT1_VECTOR
    __interrupt void Port_1(void)
    {
        PAN_PORT_IFG &= ~PAN_HOME;
        gPanHOME++;
    }

    Regards,

    Akash

  • Hi Akash!

    This isn't the complete code, right? The main is missing some things. Would you mind to upload everything? Or add as a file?

    Dennis

**Attention** This is a public forum