Itsy 32u4 Interrupt pin assignments may be wrong

Please tell us which board you are using.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Post Reply
User avatar
TomHumbleAndHandsome
 
Posts: 98
Joined: Mon Feb 15, 2021 6:38 pm

Itsy 32u4 Interrupt pin assignments may be wrong

Post by TomHumbleAndHandsome »

Big arrow shows "PCINTs", what are these? Red circle shows hardware interrupt as "6" in the drawing and "4" in the text.
Big arrow shows "PCINTs", what are these? Red circle shows hardware interrupt as "6" in the drawing and "4" in the text.
Untitled.png (872.43 KiB) Viewed 716 times
Hi, I'm developing code on a 3v 32u4 and I have a couple questions about the interrupts:

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.

User avatar
sj_remington
 
Posts: 461
Joined: Mon Jul 27, 2020 4:51 pm

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by sj_remington »

PCINT is fully described in the ATmega32U4 data sheet. It is a hardware interrupt, by standard conventions.

User avatar
TomHumbleAndHandsome
 
Posts: 98
Joined: Mon Feb 15, 2021 6:38 pm

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by TomHumbleAndHandsome »

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?

User avatar
sj_remington
 
Posts: 461
Joined: Mon Jul 27, 2020 4:51 pm

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by sj_remington »

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.
Capture.PNG
Capture.PNG (77.52 KiB) Viewed 84 times

User avatar
TomHumbleAndHandsome
 
Posts: 98
Joined: Mon Feb 15, 2021 6:38 pm

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by TomHumbleAndHandsome »

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.

User avatar
argonblue
 
Posts: 67
Joined: Wed Apr 25, 2012 12:18 am

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by argonblue »

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.

User avatar
adafruit_support_bill
 
Posts: 84445
Joined: Sat Feb 07, 2009 10:11 am

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by adafruit_support_bill »

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/

User avatar
argonblue
 
Posts: 67
Joined: Wed Apr 25, 2012 12:18 am

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by argonblue »

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.
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.

User avatar
adafruit_support_bill
 
Posts: 84445
Joined: Sat Feb 07, 2009 10:11 am

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by adafruit_support_bill »

There is a pin-change interrupt library for the Arduino IDE that supports the 32U4 here:
https://www.arduino.cc/reference/en/lib ... interrupt/

User avatar
argonblue
 
Posts: 67
Joined: Wed Apr 25, 2012 12:18 am

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by argonblue »

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.
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.

User avatar
TomHumbleAndHandsome
 
Posts: 98
Joined: Mon Feb 15, 2021 6:38 pm

Re: Itsy 32u4 Interrupt pin assignments may be wrong

Post by TomHumbleAndHandsome »

Thanks

Post Reply
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy 32u4, M0, M4”