Itsy 32u4 Interrupt pin assignments may be wrong
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- TomHumbleAndHandsome
- Posts: 99
- Joined: Mon Feb 15, 2021 6:38 pm
Itsy 32u4 Interrupt pin assignments may be wrong
1. What is a "PCINT" - the pinout document shows PCINT1 through PCINT7 but you can't use them as hardware interrupts. I can't find their usage documented anywhere.
2. The text on your learn page says GPIO pin 7 is hardware interrupt 4 but the pinout drawing shows it as hardware interrupt 6. Which is it?
Thanks in advance.
- sj_remington
- Posts: 994
- Joined: Mon Jul 27, 2020 4:51 pm
Re: Itsy 32u4 Interrupt pin assignments may be wrong
PCINT is fully described in the ATmega32U4 data sheet. It is a hardware interrupt, by standard conventions.
- TomHumbleAndHandsome
- Posts: 99
- Joined: Mon Feb 15, 2021 6:38 pm
Re: Itsy 32u4 Interrupt pin assignments may be wrong
Got it thanks. What threw me is that the radiohead library I'm using is able to map pin numbers to hardware interrupt numbers but only for some pins, not all of them so it wasn't able to map the pins that are called PCINT.
What about pin 7, is that hardware interrupt 6 or 4?
What about pin 7, is that hardware interrupt 6 or 4?
- sj_remington
- Posts: 994
- Joined: Mon Jul 27, 2020 4:51 pm
Re: Itsy 32u4 Interrupt pin assignments may be wrong
I don't know what you mean by 6 or 4. Provide the context for the question, and you will get reliable answers.
Again, the data sheet tells you exactly what these interrupts do, which pins are assigned to them and how they should be named. It is the very best and by far the most reliable source of information.
Page 3 of the data sheet is VERY useful. Note that pin PE6 has two functions, one of which is referred to as INT.6 and INT6 in the data sheet. It is restricted and different from all the other interrupts.
Again, the data sheet tells you exactly what these interrupts do, which pins are assigned to them and how they should be named. It is the very best and by far the most reliable source of information.
Page 3 of the data sheet is VERY useful. Note that pin PE6 has two functions, one of which is referred to as INT.6 and INT6 in the data sheet. It is restricted and different from all the other interrupts.
- TomHumbleAndHandsome
- Posts: 99
- Joined: Mon Feb 15, 2021 6:38 pm
Re: Itsy 32u4 Interrupt pin assignments may be wrong
SJ. Thank you for your response -
I do not access the pins on the CPU chip directly, I use the pins on the ItsyBitsy 32u4.
As such, I must use the documentation on the adafruit web page "https://learn.adafruit.com/introducting ... u4/pinouts" because the pin numbers on the chip are not the same as the pin numbers on the ItsyBitsy.
The image at the top of the "pinouts" page shows ItsyBitsy PIN 7 = PE6 = INT6. That's clear. However later on near the bottom of the same page it says pin 7 is interrupt #4. This contradicts the information provided in the image on the same page.
I do not access the pins on the CPU chip directly, I use the pins on the ItsyBitsy 32u4.
As such, I must use the documentation on the adafruit web page "https://learn.adafruit.com/introducting ... u4/pinouts" because the pin numbers on the chip are not the same as the pin numbers on the ItsyBitsy.
The image at the top of the "pinouts" page shows ItsyBitsy PIN 7 = PE6 = INT6. That's clear. However later on near the bottom of the same page it says pin 7 is interrupt #4. This contradicts the information provided in the image on the same page.
- argonblue
- Posts: 93
- Joined: Wed Apr 25, 2012 12:18 am
Re: Itsy 32u4 Interrupt pin assignments may be wrong
There is no INT4 or INT5 on the ATmega32U4, from what I can find in the datasheet. PE6 is INT6. You can cross-check the schematic to see if PE6 is indeed wired to pin 7 on the Itsy Bitsy.
- adafruit_support_bill
- Posts: 88041
- Joined: Sat Feb 07, 2009 10:11 am
Re: Itsy 32u4 Interrupt pin assignments may be wrong
There are 3 different numbering schemes at play here: The 32U4 processor pin designation, the digital pin numbering on the Itsy board and the Arduino Interrupt number. This mapping is defined by the board package for the Arduino IDE.
To reduce (some of the) confusion in the Arduino IDE, there is a function called "digitalPinToInterrupt()" that takes the digital pin number and converts it to the Arduino interrupt number for use by AttachInterrupt().
https://www.arduino.cc/reference/en/lan ... interrupt/
To reduce (some of the) confusion in the Arduino IDE, there is a function called "digitalPinToInterrupt()" that takes the digital pin number and converts it to the Arduino interrupt number for use by AttachInterrupt().
https://www.arduino.cc/reference/en/lan ... interrupt/
- argonblue
- Posts: 93
- Joined: Wed Apr 25, 2012 12:18 am
Re: Itsy 32u4 Interrupt pin assignments may be wrong
PCINT0 through PCINT7 are pin change interrupts. The datasheet describes their usage. I don't know how well they're supported in Arduino. They can only interrupt on logic level changes, not particular logic levels or edges.What is a "PCINT" - the pinout document shows PCINT1 through PCINT7 but you can't use them as hardware interrupts. I can't find their usage documented anywhere.
- adafruit_support_bill
- Posts: 88041
- Joined: Sat Feb 07, 2009 10:11 am
Re: Itsy 32u4 Interrupt pin assignments may be wrong
There is a pin-change interrupt library for the Arduino IDE that supports the 32U4 here:
https://www.arduino.cc/reference/en/lib ... interrupt/
https://www.arduino.cc/reference/en/lib ... interrupt/
- argonblue
- Posts: 93
- Joined: Wed Apr 25, 2012 12:18 am
Re: Itsy 32u4 Interrupt pin assignments may be wrong
The guide page turns out to be correct. ItsyBitsy (and Arduino) pin 7 is Arduino interrupt #4 for ATmega32U4 parts. Arduino uses a different interrupt numbering (sequential) than the Atmel datasheet (non-sequential). So ATmega32U4 PE6/INT6 is Arduino interrupt #4.The image at the top of the "pinouts" page shows ItsyBitsy PIN 7 = PE6 = INT6. That's clear. However later on near the bottom of the same page it says pin 7 is interrupt #4. This contradicts the information provided in the image on the same page.
- TomHumbleAndHandsome
- Posts: 99
- Joined: Mon Feb 15, 2021 6:38 pm
Please be positive and constructive with your questions and comments.