interrupt systick & PORT

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

interrupt systick & PORT

1,385 Views
thieulam
Contributor III
Hi to all!
I'm working with a kinetis kv58.
I'm using 2 interrupts that work regularly.
However, when I use the "InterruptLogicZero" mode, if I keep the PORTA pin set to zero, only the PORTA interrupt is executed.
Is there a priority setting to make the SysTick interrupt work too?
For me, the Systick interrupt is a priority.
Regards, Luca.
 
PORT_SetPinInterruptConfig(PORTA, 4U, kPORT_InterruptLogicZero);
void SysTick_Handler(void)
{  
      GPIO_PortToggle(BOARD_LED_GPIO, 1u << BOARD_LED_GPIO_PIN);
}
void PORTA_IRQHandler(void) {
   GPIO_ClearPinsInterruptFlags(GPIOA, 1U << 4);
}
0 Kudos
7 Replies

1,211 Views
thieulam
Contributor III

Ok Mark. 

thank you so much.

I have just filled out the form for the free version of utasker.

is it compatible with kinetis KV58?

0 Kudos

1,211 Views
mjbcswitzerland
Specialist V

Hi Luca

The KV58 is an advanced Cortex-M7 part which is not used by many people. It is not included in the Open Source version and only a basic (untested) port is presently available in the developer's version(!)

I don't have a TWR-KV58V220M and so have only simulated it (see below):

pastedImage_1.png

Although many modules are compatible with other parts, the KV58 has various new ones that are unique to it, which i haven't integrated. Since the module addresses do get moved around between different devices I expect that the basic port (which will do UARTs, Ethernet, port interrupts, low power modes, PITs, LPTMR, FlexTimers ad maybe a few more such generic modules) will probably fail on first attempts on the HW since something hasn't been spotted yet that needs a special setting. Sometimes it does work on first attempt but the KV58 is rather complex so the chances are lower. Fixing such things is easy though, but needs the HW tests to show it.

I'll give you access to the developer's version (which will simulate and run on around 80 development boards) so you can have a look at it and if you feel up to it you could see whether you can get the KV58 tweaked to work. I'll send you my email too so you can inform me of any issues so that I can point you in the correct direction at the beginning.

Regards

Mark

0 Kudos

1,211 Views
mjbcswitzerland
Specialist V

Hi Luca

When you configure the interrupt you can give it a priority - if the Systck's interrupt has a "lower" priority value than the GPIO port interrupt it will interrupt the other.

Regards

Mark

0 Kudos

1,211 Views
thieulam
Contributor III

hi!

can you tell me the name of the function to set the priority to interrupt systick?

0 Kudos

1,211 Views
mjbcswitzerland
Specialist V

Hi Luca

I use the uTasker project where the priorities are set with (for example):

    #define SYSTICK_PRIORITY           2
    #define PRIORITY_PORT_A_INT        6
    #define PRIORITY_PORT_B_INT        5
    #define PRIORITY_PORT_C_INT        7
    #define PRIORITY_PORT_D_INT        9
    #define PRIORITY_PORT_E_INT        9

If you are using another framework you will need to read its documentation or study its code, or wait for a response from someone managing its support.

Regards

Mark

0 Kudos

1,211 Views
thieulam
Contributor III

Have you ever tried  if with PORTA pin irq set to "interruptlogiczero" and with pin always at zero you shoot the systick interrupt ?

0 Kudos

1,211 Views
mjbcswitzerland
Specialist V

Luca

In the uTasker project I can do this:

1) Configure two port outputs for test purposes:

extern void fnUserHWInit(void)
{
    _CONFIG_DRIVE_PORT_OUTPUT_VALUE(C, (PORTC_BIT3 | PORTC_BIT4), (PORTC_BIT3 | PORTC_BIT4), (PORT_SRE_SLOW | PORT_DSE_HIGH));

}

2) Configure a 100us SYSTICK with high priority:

#define _TICK_RESOLUTION     TICK_UNIT_US(100)
#define SYSTICK_PRIORITY           1

3) Configure an input with level sensitive interrupt at lower priority

#define PRIORITY_PORT_A_INT        6

static void fnInitIRQ(void)
{
    INTERRUPT_SETUP interrupt_setup;                             // interrupt configuration parameters
    interrupt_setup.int_type       = PORT_INTERRUPT;             // identifier to configure port interrupt
    interrupt_setup.int_handler    = test_irq;                   // handling function

    interrupt_setup.int_priority   = PRIORITY_PORT_A_INT;        // interrupt priority level

    interrupt_setup.int_port       = PORTA;                      // the port that the interrupt input is on

    interrupt_setup.int_port_bits = PORTA_BIT10;                 // the IRQ input connecte

    interrupt_setup.int_port_sense = (IRQ_LOW_LEVEL | PULLUP_ON);// interrupt is to be low level sensitive

    fnConfigureInterrupt((void *)&interrupt_setup);              // configure interrupt

}

4) In the SYSTICK interrupt handler I toggle one port each times it enters and in the IRQ handler I toggle the other port on each entry:
static __interrupt void _RealTimeInterrupt(void)
{
    _TOGGLE_PORT(C, PORTC_BIT3);
    ..

}

static void __callback_interrupt test_irq(void)
{
    _TOGGLE_PORT(C, PORTC_BIT4);

}

When I run this and press the input with level sensitive input this is the output that is recorded:

pastedImage_7.png

As can be seen, the 100us SYSTICK is still executed even when there is a continuous level sensitive interrupt on the input due to the fact that it has a higher interrupt priority and takes priority when both are pending and it also pre-empts the port interrupt handler.

If I then do

#define SYSTICK_PRIORITY           7

the result is

pastedImage_8.png

where it is seen that the SYSTICK interrupt is not called any more due to the fact that the port interrupt is always pending and has priority.

Regards

Mark

http://www.utasker.com/services.html