From: hvo on
Hi,

I am trying to implement an interrupt handler which only interrupts on the
rising edge of a gpio signal. So far, it always interrupt regardless of
input signal, rising or falling. here is my MHS snippit

BEGIN microblaze
PARAMETER INSTANCE = microblaze_0
PARAMETER C_INTERCONNECT = 1
PARAMETER HW_VER = 7.10.d
PARAMETER C_DEBUG_ENABLED = 1
PARAMETER C_AREA_OPTIMIZED = 1
PARAMETER C_INTERRUPT_IS_EDGE = 1
PARAMETER C_EDGE_IS_POSITIVE = 1
BUS_INTERFACE DLMB = dlmb
BUS_INTERFACE ILMB = ilmb
BUS_INTERFACE DPLB = mb_plb
BUS_INTERFACE IPLB = mb_plb
BUS_INTERFACE DEBUG = microblaze_0_dbg
PORT MB_RESET = mb_reset
PORT Interrupt = Interrupt
END

BEGIN xps_gpio
PARAMETER INSTANCE = DIPs_4Bit
PARAMETER HW_VER = 1.00.a
PARAMETER C_GPIO_WIDTH = 4
PARAMETER C_IS_BIDIR = 0
PARAMETER C_ALL_INPUTS = 1
PARAMETER C_BASEADDR = 0x81420000
PARAMETER C_HIGHADDR = 0x8142ffff
PARAMETER C_INTERRUPT_PRESENT = 1
PARAMETER C_IS_DUAL = 1
PARAMETER C_ALL_INPUTS_2 = 1
PARAMETER C_IS_BIDIR_2 = 0
BUS_INTERFACE SPLB = mb_plb
PORT GPIO_in = fpga_0_DIPs_4Bit_GPIO_in
PORT IP2INTC_Irpt = gpio_interrupt
PORT GPIO2_in = fpga_channel_2_in
END

BEGIN xps_intc
PARAMETER INSTANCE = xps_intc_0
PARAMETER HW_VER = 1.00.a
PARAMETER C_KIND_OF_INTR = 0xFFFFFFFF
PARAMETER C_KIND_OF_EDGE = 0xFFFFFFFF
PARAMETER C_BASEADDR = 0x81800000
PARAMETER C_HIGHADDR = 0x8180ffff
BUS_INTERFACE SPLB = mb_plb
PORT Irq = Interrupt
PORT Intr =
Ethernet_MAC_IP2INTC_Irpt&xps_timer_1_Interrupt&gpio_interrupt
END

----------------------------------------------------------------------------
here is my main code:

int main(void)
{
// init the gpio interrupt
XGpio_Initialize(&Gpio, XPAR_DIPS_4BIT_DEVICE_ID);

// enable global interrupt
XGpio_InterruptGlobalEnable(&Gpio);

// enable channels 1 and 2
XGpio_InterruptEnable(&Gpio, INTR_CHANNEL2_MASK);
XGpio_InterruptEnable(&Gpio, INTR_CHANNEL1_MASK);

}


// static main thread in xilkernel
int main_thread()
{
// registers the interrupt handler
register_int_handler(DIPSWITCH_ID, handler, &Gpio);

// enable the interrupt
enable_interrupt (DIPSWITCH_ID);

// create a thread below

}


// interrupt handler function
void handler(void)
{
// first disable interrupt
disable_interrupt(DIPSWITCH_ID);

// process interrupt......

// Clear interrupt
XGpio_InterruptClear(&Gpio, INTR_CHANNEL1_MASK);
XGpio_InterruptClear(&Gpio, INTR_CHANNEL2_MASK);

// re-enable the interrupt
enable_interrupt(DIPSWITCH_ID);

}


------------------------------------------------------------------------
in my MHS file, I've defined the kind of interrupt to edge for both the
microblaze and interrupt controller and yet I always get an interrupt
everytime the gpio signal changes level.

Is there something i've overlooked?

Please help
Regards

---------------------------------------
This message was sent using the comp.arch.fpga web interface on
http://www.FPGARelated.com
From: austin on
I believe...

You have the option enabled that generates an interrupt any time a
gpio bit changes state.

If this is not what you wanted, then don't do that...

http://www.xilinx.com/support/documentation/ip_documentation/opb_gpio.pdf

page 9

This has nothing to do with rising edge, or level, for the interrupt
controller as the system will ensure that every time a gpio bit
changes state, it generates an interrupt.

Austin
From: hvo on
>I believe...
>
>You have the option enabled that generates an interrupt any time a
>gpio bit changes state.
>
>If this is not what you wanted, then don't do that...
>
>http://www.xilinx.com/support/documentation/ip_documentation/opb_gpio.pdf
>
>page 9
>
>This has nothing to do with rising edge, or level, for the interrupt
>controller as the system will ensure that every time a gpio bit
>changes state, it generates an interrupt.
>
>Austin
>

Yes I see the limitation of GPIO interrupts. There are no parameters to
set the gpio to only generate an interrupt on a rising or falling edge.

How else can I connect an external interrupt without using GPIO?

Best Regards



---------------------------------------
This message was sent using the comp.arch.fpga web interface on
http://www.FPGARelated.com
From: Martin Thompson on
"hvo" <hai.vo(a)synrad.com> writes:

> Yes I see the limitation of GPIO interrupts. There are no parameters to
> set the gpio to only generate an interrupt on a rising or falling edge.
>
> How else can I connect an external interrupt without using GPIO?
>

Create an external pin for it - give it an "INTERRUPT" type, and
you can set it to be edge or level triggered, and what polarity it
should be.

You get an MHS line like this for example:
PORT xps_epc_usb_HC_IRQ = USB_HC_IRQ, DIR = I, SIGIS = INTERRUPT, SENSITIVITY = LEVEL_LOW

Cheers,
Martin

--
martin.j.thompson(a)trw.com
TRW Conekt - Consultancy in Engineering, Knowledge and Technology
http://www.conekt.net/electronics.html
From: hvo on
>"hvo" <hai.vo(a)synrad.com> writes:
>
>> Yes I see the limitation of GPIO interrupts. There are no parameters
to
>> set the gpio to only generate an interrupt on a rising or falling edge.

>>
>> How else can I connect an external interrupt without using GPIO?
>>
>
>Create an external pin for it - give it an "INTERRUPT" type, and
>you can set it to be edge or level triggered, and what polarity it
>should be.
>
>You get an MHS line like this for example:
> PORT xps_epc_usb_HC_IRQ = USB_HC_IRQ, DIR = I, SIGIS = INTERRUPT,
SENSITIVITY = LEVEL_LOW
>
>Cheers,
>Martin
>
>--
>martin.j.thompson(a)trw.com
>TRW Conekt - Consultancy in Engineering, Knowledge and Technology
>http://www.conekt.net/electronics.html
>


Thanks!

That worked for me. This is definately more versatile than GPIO
interrtupts, and it takes less slices to implement.

Cheers
HV

---------------------------------------
This message was sent using the comp.arch.fpga web interface on
http://www.FPGARelated.com