I'm currently designing a circuit based on a STM32F722ze (datasheet, reference manual).
As far as I understand from section 3.11 of datasheet and 10 from reference manual, for each "external interrupt channel" (EXTI0 to EXTI16), I can choose exactly on pin (for EXTIx, I can pick whatever the pin #x from any port).
So as far as I understand, I can only get 16 external interrupts in total.
Do you know if it is somehow possible to get more interrupt pins (even if it requires to read a few pins an check the differences manually to know which one generated the interruption)?
The ideas I have:
connection several pins to the same EXTIx (for example connection PA0, PB0 and PC0 to EXTIO) and when an interrupt occurs check which pin(s) changed since last interrupt. If I understand right, this is NOT possible on STM32F722
have an interrupt on any change on a given port (for example if any pin between PA0 and PA15 changes), and comparing to previous state to know which pin(s) changed. If I'm not mistaken, this exists in the ATmega microcontrollers: I haven't read about it for STM32 microcontrollers yet, but maybe I just missed it?
the "hardware" way: XOR all the pins I want to use as interrupts and put the XOR on a EXTIx pin, and use normal GPIO_inputs for all the individual pins: that way, I know each time a pin changed, and I can then check which one by reading all of them. (NB : it might be wiser to use several EXTIx pins, each XORing the pins of one port, as to speed up reading/comparison). One drawback is that if 2 pins change at the same time (i.e. faster than what the XOR + interrupt can react), there will be no interruption generated.
other ideas?
EDIT: for context, why do I want so many interrupts?
I'm developping a robot for cave exploration, that will navigate within narrow cracks (to narrow for humans to pass through), pushing against both walls to avoid falling into the bottom of the crack. For this, I use 8 arms (4 on each side) with a wheel at the end. For each arm, I need one motor for the wheel and one motor to move the arm and press it against the wall.
For the 8 wheels motors, I will probably soon add quadrature encoders in order to 1) detect motor stall (in adition to current measurement) 2) insure same speed on all 8 motors 3) get an estimation of the distance the robot made in the crack (which is an important factor, as the main goal of the robot is to know for how long one would need to enlarge the crack in order for humans to pass). So 8 motors * 2 signals = 16 interrupts.
So just for with the wheel motors, I already use all the interrupts I have.
For now, I'm not sure if I will need more, but as the PCB will be quite expancive already, I would like add extra connectors for adding aditionnal features as the development of the prototype advances. For now, one use for additionnal interrupts would be to measure the position of the arms with encoders (for now, it's done with potentiometers, which are not very accurate). Other uses might come that I'm not thinking of yet.
So if it is too complicated, I will stay with the 16 interrupts, but if there is a simple enough solution, I'd rather plan some more now.
For the quadrature encoder interrupts, it's the edges I'm interrested in, that's why I was suggestion to XOR the interrupts. NB : if having 2 changes at the same time occure but seldomly, it's still OK (if I miss 1% of interrupts, it will only result in 1% of distance error, which is far bellow the error due to other reasons (wheels sliping, non parallel walls, ...).
For other type of interrupts (like faults or sensor data ready, I agree that ORing or ANDing might be more usefull).
EDIT 2 : Maybe I'm thinking the problem the wrong way : maybe I can find some dedicated ICs to manage the encoders instead of getting all the interruptions directly on the STM32. That way I dont need all those interruptions pins, and I save a lot of CPU time on the STM32