I want to attach an interrupt to 10 or 11 pins on same PORT (PB). Is there any way to do so in an instruction or I have to attach as many interrupts as pins?
Thanks in advance.
[stevestrong – Wed Apr 11, 2018 7:11 am] –
As the ISRs can be different, it is normal to use different function calls to attach ISRs to each pin separately.
I’m trying to control a parallel connection on any change, so all routines will be same function.
Even so, if more than a pin changes I need to ISR be called only once, so a PORT interrupt could be more convenient.
I was hoping to be able to attach an interrupt to whole port, better if I can use a mask to select desired pins.
If not, I need to clear other pins’ interrupt flag when any ISR is called.
Can anyone point me in the direction on how to do so (any of these)?
Thanks.
But something I was trying but didn’t work well was this:
exti_attach_interrupt(/*(afio_exti_num)*/ EXTI4, gpio_exti_port(GPIOB), inputCheck, EXTI_FALLING);
attachInterrupt(<pin>, <pin_isr>, <edge>);[stevestrong – Wed Apr 11, 2018 11:18 am] –
The “Arduino”-way to attach interrupts is:
attachInterrupt(<pin>, <pin_isr>, <edge>);
[stevestrong – Wed Apr 11, 2018 12:04 pm] –
If you would tell us more about what you are trying to achieve we may be able to recommend you other technics, like using DMA at pin state change to store the IO port value (if your input pins are all part of the same IO port). This could free up some time in the main level for other stuff.
I have a bunch of signals connected. They are related and synchronized running at 1MHz or a divider, except one of that signals that runs with very small pulses (still at same frequency, but I don’t want to loose that pulses).
So, I have this function as pin interrupt (on fast-pulsing pin) and inside a 1MHz timer interrupt (it does few extra things):
void inputCheck() {
uint16_t newdata = GPIOB->regs->IDR & INPUT_MASK;
if (newdata != incomingData) {
incomingData = newdata;
newIncomingData = true;
}
}
If that didn’t work, you should take a look at the code in the core to see what it does when you attach an interrupt , as Leaflabs probably didn’t expect this sort of thing to be required as often people want to attach differnt handlers to each pin
[RogerClark – Wed Apr 11, 2018 9:32 pm] –
Did you try simply attaching the same interrupt handler to all the pins you want to trigger from?If that didn’t work, you should take a look at the code in the core to see what it does when you attach an interrupt , as Leaflabs probably didn’t expect this sort of thing to be required as often people want to attach differnt handlers to each pin
Sincerely, no: I expectbmore than one call if more than a pin changes.
I’ll try it if actual implementation fails…
hey are related and synchronized running at 1MHz
You probably want to think of a hardware based solutions, like cold or fpga. Or a software solution in 29 years from now,
[dannyf – Fri Apr 13, 2018 6:28 pm] –
hey are related and synchronized running at 1MHz
You probably want to think of a hardware based solutions, like cold or fpga. Or a software solution in 29 years from now,
![]()
I hope I don’t need it.
It only needs transmit or receive 12k data in bursts at maximum of 1 000 000 signals per second, but no processing, simply from/to memory.
My 1st tests seems to work even with time fuctions working and few Serial debug enabled. Still developing the control loops, as time reading/writing is very little compared of time doing nothing and it’s controlled by a bunch of signals.



