Cerbuino - which Arduino style inputs can/can't be InterruptPort?

D3 throws an error if I try to add an an Interrupt handler to it. Are there others? Is this documented somewhere I missed?

InterruptPort in4 = new InterruptPort(GHI.OSHW.Hardware.FEZCerbuino.Pin.Digital.D3, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
in4.OnInterrupt += new NativeEventHandler(in4_OnInterrupt);

Looks like FEZCerbuino.Pin.Interrupt enumeration is missing. I will get the pin name at the following

and then will check the MCU datasheet if that pin supports interrupts.

You can always just try them all until the exception is gone. :slight_smile:

OK. Tried and had issues with:
D3 (PC14)
D6 (PA10)
D10 (PA15)
D12 (PB4)
D13 (PB3)

All threw exceptions when creating interrupt event handler. Pretty sure D12 and D13 is because I’m using Ethernet so those are being used by Socket 1/SPI 1?

Yes, if you create a managed object that uses a pin you will not be able to create another object using the same pin. You will have to dispose the original object first.


It would be nice to add indication(*) for interrupt capable pins to the pinout document for Cerbuino. Similar to what you have for USBizi based boards.

I continued the test to include the Analog in pins and here, it got odd.

Definitely have an issue with A4 and A5, same error thrown as with the D pins listed. What is stranger though - if I step through the code that creates the NativeEventHandler objects, the errors are only thrown on A4 and A5. If I let the code execute without stepping through, it bombs on A1 as well. My code is dirt simple, just declaring the InterruptPort objects and adding the NativeEventHandler for each pin.

Don’t they all support interrupts?

Sez the datasheet:

[em]2.2.11 External interrupt/event controller (EXTI)
The external interrupt/event controller consists of 23 edge-detector lines used to generate
interrupt/event requests. Each line can be independently configured to select the trigger
event (rising edge, falling edge, both) and can be masked independently. A pending register
maintains the status of the interrupt requests. The EXTI can detect an external line with a
pulse width shorter than the Internal APB2 clock period. Up to 140 GPIOs can be connected
to the 16 external interrupt lines.

So, yes, it looks like they should all support interrupts.

The STM32 chips are in general more capable than the corresponding NXP parts, but they’re also in general much more complex to work with. You get what you “pay” for (in terms of sweat and tears), I guess.

Now I’m more confused. Why the exceptions when I try to create NativeEventHandler on specific pins? Also confused why stepping through yields different results on different pins.

Even if they should he has some problems on certain pins, so there might be an issue.

We will test on our end.