How to enable Reentrant interrupt handlers in kinetis K70

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to enable Reentrant interrupt handlers in kinetis K70

Jump to solution
1,218 Views
mauriziolenzini
Contributor I

I have a TWR-K70F120M: kinetis k70 120MHz Tower System Module.

I have connected a elettric signal to PORTB and i have connected e isr handler to signal transition.

Electric signal

     _____          ______          ______

    |         |         |          |         |          |

__|          |_____|          |_____|          |_____  ------> PORTB  

  ( 1 )             ( 2 )                ( 3 )

     

Interrupt handler is called every transition of the elettric signal ( in the figure is 1,2,3 ).

The interrupt handler is the follow code:

#define EN_ERR_SCHEDULER_INT_TOO_LONG (10)

static bool wbFlag = false; /* control the reentrant function */

__ isr void isr_handler( void )

{

  /* l'interrupt precedente è durato troppo ? */

  if ( wbFlag != true )

  {

    /* flag reentrant function  */

    wbFlag = TRUE;  

  }

  else

  {  

    vDebugPrint( EN_ERR_SCHEDULER_INT_TOO_LONG );

  }

   while(1);

   wbFlag = false;

}

at the step ( 1 ) the program jump to the handler but not in the 2nd e third impulse. Is it possible to enable a reentrand interrupt in kinetis k70?

 

the setup is follow ( setup is call one time at the startup of the system ):

sllRq = 88; /*Port control module Pin Detect (Port B) */

void vEnableIrq (SLONG slIRQ)

{

  SLONG slDiv;

 

  /* Make sure that the IRQ is an allowable number. Right now up to 91 is

  * used.

  */

  if ( slIRQ > 91 )

  {

    vDebugPrint("\nERR! Invalid IRQ value passed to enable irq function!\n");

  }

 

  /* Determine which of the NVICISERs corresponds to the irq */

  slDiv = ( slIRQ / 32 );

 

  switch ( slDiv )

  {

    case 0x0:

      NVICICPR0 = 1 << ( slIRQ % 32 );

      NVICISER0 = 1 << ( slIRQ % 32 );

    break;

    case 0x1:

      NVICICPR1 = 1 << ( slIRQ % 32 );

      NVICISER1 = 1 << ( slIRQ % 32 );

    break;

    case 0x2: /* program execute this case !!!!! */

      NVICISER2 = 1 << ( slIRQ % 32 );

      NVICICPR2 = 1 << ( slIRQ % 32 );

      PORTB_PCR18 |= PORT_PCR_ISF(0) | PORT_PCR_IRQC(9) |  PORT_PCR_MUX(1);

      NVICIP88 = 0x00;

    break;

  }             

}

I need to control the reentrant interrupt because this application must check the excessive duration of the code in isr handler.

0 Kudos
Reply
1 Solution
675 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

Cortex-M4 just support Preemption, but no reentrant, there is a state of "Active and pending" for your case: The exception is being serviced by the processor and there is a pending exception from the same source. Since there is a while(1) loop in the end of the ISR handler.

Hope that makes sense,

B.R

Kan

View solution in original post

0 Kudos
Reply
1 Reply
676 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi,

Cortex-M4 just support Preemption, but no reentrant, there is a state of "Active and pending" for your case: The exception is being serviced by the processor and there is a pending exception from the same source. Since there is a while(1) loop in the end of the ISR handler.

Hope that makes sense,

B.R

Kan

0 Kudos
Reply