Hi folks. I would like some input on a project I’m currently working on. I’ve hit the proverbial wall when it comes to interrupt usage (or potential usage.)
I’m trying to build a dev board that incorporates an Atmega32U4, ADXL345, DS3231, nRF24L01+, a battery charger circuit, and a buck/boost (for starters - there may be more added later.)
The problem I’m faced with is coming up with enough interrupts for the three main devices, the ADXL345, the DS3231, and the nRF24L01+ as I will potentially be using the interrupt on each one of them.
The Arduino Leonardo bootloader for the 32U4 gives me interrupts on pins 0, 1, 2, 3, and 7. Except, the UART (which I will also use) is on pins 0 and 1, and pins 2 and 3 are used for I2C, which leaves me with only pin 7 available for an external interrupt. And that’s where I’m stuck.
I don’t want to move away from the Arduino bootloader because what this is being made for is meant to be used with libraries written for the Arduino IDE so it would make sense for me to use the bootloader for it as well.
So my question is: what other options do I have? What else can I do here? I suppose I could jump the chasm and go straight to an ARM based system using the Arduino Due platform but before I do that, I wanted to see if I have another option first.
I believe there are 8 other external “pin change” interrupts available. They aren’t as easy to use as the more direct ext int pins but that’s your only recourse. See section 11 in the 32U4 datasheet.
Mee_n_Mac:
I believe there are 8 other external “pin change” interrupts available. They aren’t as easy to use as the more direct ext int pins but that’s your only recourse. See section 11 in the 32U4 datasheet.
Right, I know that, however I don’t know if they can be accessed (easily) by using the Arduino Leonardo bootloader. I can’t expect end-users of the dev board to know what they need to do to access those other pins …
Hmmmm I’ve never looked but perhaps someone has made a simple to use “pin change” library ? If the end user could be expected to attach, detach and write the ISR, maybe a library can make it that easy.
MartinL: The PinChangeInt library does work with the Arduino Micro, but its ATmega32U4 microcontroller only supports this functionality on the 8 pins of port B. These pins are: SS, SCK, MOSI, MISO, as well as digital pins 8, 9, 10 and 11. In this regard the Micro is at a disadvantage with respect to the ATmega328 based Arduinos, such as the Uno and Nano, who support pin change interrupts on most of their pins.
So existing Uno PCI libraries would seem to work but there’s really only 4 GPIO pins to be used.