Digital interupts all equal in response times?

ekartgo

Member
Are all pins equal in response times for a digital transition on a T4.1?

I am setting no more than four interrupts active at a time to watch for either rising or falling edges.

For example:
Code:
void turn_on_coil2_fwd()
{
	if (!coil2_state)
	{
		noInterrupts();

		digitalWriteFast(HB2_ON_GPIO, HIGH);
		delayMicroseconds(US_PULSETIME);
		digitalWriteFast(HB2_ON_GPIO, LOW);

		interrupts();

		coil2_state = 1; // Don't pulse again

		// Set hard off and others for progression
		attachInterrupt(digitalPinToInterrupt(PTR2_GPIO), turn_off_coil2, RISING);
		attachInterrupt(digitalPinToInterrupt(PTR3_GPIO), turn_off_coil3, RISING); // Overlap
		attachInterrupt(digitalPinToInterrupt(PTR1_GPIO), turn_on_coil1_fwd, FALLING);
		attachInterrupt(digitalPinToInterrupt(PTR4_GPIO), turn_on_coil4_fwd, FALLING);
	}
}

Bryan
 
Are all pins equal in response times for a digital transition on a T4.1?

I am setting no more than four interrupts active at a time to watch for either rising or falling edges.

...
Bryan

Yes, that should be the case - with the exception of some conditional and instruction time.

While in FAST I/O mode all pins route through a single common interrupt routine given the 1062 MCU design.

There is then logic to parse the pin status for all ports to arrive at the first found needing attention.

See: ...\hardware\teensy\avr\cores\teensy4\interrupt.c
 
Thanks for the information. This comment in that interrupt.c file made me question if I should be using pins 6-9 instead of 9-12, or maybe avoiding them instead. I just wasn't quite sure what to make of it as I also ran into a similar comment someplace else when searching in regards to this chip.

// TODO: Use of Fast GPIO6 - GPIO9 probably breaks everything about attachInterrupt()

Bryan
 
Thanks for the information. This comment in that interrupt.c file made me question if I should be using pins 6-9 instead of 9-12, or maybe avoiding them instead. I just wasn't quite sure what to make of it as I also ran into a similar comment someplace else when searching in regards to this chip.

// TODO: Use of Fast GPIO6 - GPIO9 probably breaks everything about attachInterrupt()

Bryan

Suspect that concern was resolved with the attachInterrupt() code in that file as it has been in use for some long time now without issue ... the problem with comments ... ???
> no comment, no clue beyond what the code shows/does
> add a comment, then any code edit has to edit the comment as well

And "GPIO6 - GPIO9" refers to PORTS 6,7,8,9 that control/contain ALL pins - not individual pins.
 
Another option is if you switch one or more io pins back from fast mode to normal move. See iomux setting in startup.c
Each of the io ports have 2 interrupts, one for lower pins and one for higher pins. You would need to set your own interrupt handler.

If you only define one pin to use it your handler would not have to scan which pin… but you would need to clear the state…
 
Back
Top