Go Down

Topic: INT2 pin verboten? (Arduino core) (Read 930 times) previous topic - next topic

Drmn4ea

Continuing porting the Mosquino project (ATmega644pa) to the 1.0 core, I finally decided to chase down the INT2 pin issue that's been bothering me since 0022. Lo and behold... only INT0 and INT1 are handled, or even allowed, in WInterrupts.c.

In fact, it looks like somebody went to some length to remove all support for INT2 for the non-ginormous chips (e.g. #define EXTERNAL_NUM_INTERRUPTS 2 in wiring_private.h). Based on the trouble gone to, I assume this was done for some kind of important reason. Does anyone have a clue what that reason is/was?

E.g.:
Does use of the INT2 pin break horribly on some old Arduino board / AVR flavor (chip erratum) / avr-gcc version?
Was a lead developer hurting for a couple bytes Flash/RAM and decided 2 interrupts were enough?
Could it really have just been an oversight after all?

I have re-added it and it seems to work fine on my board, but I'm curious if I'm undoing someone's significant research and some bizarre issue will come to bite later.

Thanks!

Nick Gammon

If the interrupt exists on the processor I see no reason to not use it.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

skyjumper

I use INT2 on my 1284P board and Arduino 1.0 without modifications. It seems to work fine.

Drmn4ea

Are you using the version straight from the repository?

Based on your reply I just dug for it (to link to and show how the INT2 support has been removed since 0022)... only to find the Github version has it again! The repository version is almost byte-for-byte identical to what I re-wrote into the release version last night :-/ (downloaded a few days ago). Just how stale is the release version on the Arduino homepage, anyway?

skyjumper


Are you using the version straight from the repository?

Based on your reply I just dug for it (to link to and show how the INT2 support has been removed since 0022)... only to find the Github version has it again! The repository version is almost byte-for-byte identical to what I re-wrote into the release version last night :-/ (downloaded a few days ago). Just how stale is the release version on the Arduino homepage, anyway?


Actually, you're right. I am using ManiacBug's 1284P distribution, so I don't know where he sourced it from and what changes he has made. So my comment is not relevant to Arduino 1.0 unmodified. Sorry about that.


Drmn4ea

...on further inspection, the current repository version is still missing support for detachInterrupt() on INT2. Neither will it detect the '644p/a as having a 3rd interrupt pin. Maybe I'll try submitting a patch?

skyjumper

I just had a look at the Winterrupts.c used in maniacbug's Mighty 1284 stuff, and INT2 is supported. So that's why I had no trouble with it. Prior to that I was using cores from ARV Developers from 022, but I don't think I tried to use INT2 yet.

I'm sure if you were to submit or publish a patch people would appreciate it. There are only so many hardware interrupts, its nice to be able to use them all.


Drmn4ea


Go Up