AnsweredAssumed Answered

I am working with ADSP21060 processor. I used TIMER0 interrupt to periodically execute a task . Plz explain the interrupt working flow

Question asked by sulficker on Oct 3, 2013
Latest reply on Oct 4, 2013 by MaheshN

Question : I am working with 21060 processor. To periodically execute a task in every 0.5 ms i use a TIMER0 interrput. Pseudo code is attached. Here i am calling   interrupt (SIG_TMZ0,timer_isr). Once the timer_isr() function completes where the control will be coming. Is it comes to the point asm("wait:nop;\

    jump wait;"); or at the start of main because i am using nope at the end of timer_isr(). How the RTI instruction is embedded in the module, since i am not wrinting RTI as i have implemented the code in C language. Is RTI is taken care by the call interrupt (SIG_TMZ0,timer_isr)?

 

void main()

{

   

// Initialising the Serial Ports of ADSP21060

     

 

    init();

   

    //Initialising the DAC's with all zeroes

    position_op1 = 0;

    position_op2 = 0;

    adcip = 0;

    prev_adcip = 0;

       Va1 = 3.3941;

    Va2 = 3.3941;

    Vb1 = 3.3941;

    Vb2 = 3.3941;

    hall_loop1 = 0x00000000;

    hall_loop2 = 0x00000000;

   

   

 

    for(i=0;i<N;i++)

    {

        x[i] = 0;

        y[i] = 0;

        dx[i] = 0;

    }

  /*timer_set(unsigned int tperiod, unsigned int tcount)

  time between int = 500 us */

    if((timer_set(15151,15151)!=1))

        hold_tcount = timer_on();

    interrupt (SIG_TMZ0,timer_isr);

   

    asm("wait:nop;\

    jump wait;");

   

}

 

/*-----------------------------------------------------------------------------*/

 

void timer_isr()

{

   

       

    simc25(adcip1, &prev_adcip1, y_loop1, &flag_loop1, &f_sign_loop1, &position_op1, &Va1, &Vb1, &hall_loop1);

   

    mul_dac_loop1();

    simc25(adcip2, &prev_adcip2, y_loop2, &flag_loop2, &f_sign_loop2, &position_op2, &Va2, &Vb2, &hall_loop2);

 

   

    mul_dac_loop2();//implemented in assembly

    asm("nop;");

 

}

 

 

/*-----------------------------------------------------------------------------*/

 

void simc25(float adcip, float *prev_adcip, float y[], unsigned int* flag_in, float* sign_in, float* position_op, float *Va, float *Vb, unsigned int* hall_input)

{

   

   

    adcip_m = adcip;                //ADC input

    prev_adcip_m = *prev_adcip;     //Disturbance

    u = (adcip+*prev_adcip)/2;

    u1 = (adcip_m+prev_adcip_m)/2;

   

    for (i=0; i<N; i++)

    {   

        states[i] = y[i];

    }

   

{

....Some logics implemented here

 

}   

 

   *Va = y[3];

    *Vb = y[4];

   

    *prev_adcip = adcip;

   

}

 

   /*-----------------------------------------------------------------------------*/

Outcomes