Mysterious interrupts on Teensy 4.0

Status
Not open for further replies.
For Teensy 4.0 core code, I believe that the only thing from not using the DSB will be just that sometimes the internal ISR is called but it does not find any GPIO pin which triggered the interrupt, so simply the ISR does nothing. In other words, just a little bit of computing power waste :) For most purposes, it should be fine when the task is not really time-critical (but my case was indeed.) On the other hand, I guess adding DSB to the internal ISR of the Teensy 4.0 core may not harm anything:)

I will read the sections in the ARM manual on the DSB, and the T4 beta thread. Thanks a lot for the wonderful and fast help!!!
 
_VectorsRam[] is not set with Arduino attachInterrupt( ). How does it work then?

Code:
void setup() {
    pinMode(PIN, INPUT_PULLUP);
    attachInterrupt(PIN, dummy, FALLING);
    _VectorsRam[IRQ_GPIO6789 + 16] = isr;
}

Hummm... I don't know what _VectorsRam[] array refers to but when an interrupt is set with the Arduino attachInterrupt function, it doesn't set any members of the array.
Ex.:
I set GPIO22 as interrupt and tested the 176 _VectorRam[] values to see if it matches the isr I passed.
Nothing.

Does someone know details how _VectorsRam[] can be used?
 
@snooppy Not sure if this is related to the above posting?
Yes ;)

But first thing, you should typically not need to know much about _VectorsRam...
If you wish to set an interrupt, use attachInterrupt for pins and for most direct Interrupt stuff use attachInterruptVector

But things like this, just do a global search in your favorite editor or grep for _VectorsRam and you will find it in startup.c

And you will find a little piece of code like:
Code:
	// set up blank interrupt & exception vector table
	for (i=0; i < NVIC_NUM_INTERRUPTS + 16; i++) _VectorsRam[i] = &unused_interrupt_vector;
	for (i=0; i < NVIC_NUM_INTERRUPTS; i++) NVIC_SET_PRIORITY(i, 128);
	SCB_VTOR = (uint32_t)_VectorsRam;
Where you will see that it sets all of the interrupts to the unused_interrupt_vector at default priority.
And the SCB_VTOR line tells the system to now use this area of memory for the interrupt vector.

And again if you wish to use your own vector here, which takes over all processing of all pins ISRs.... you could do:
Code:
void setup() {
    pinMode(PIN, INPUT_PULLUP);
    attachInterrupt(PIN, dummy, FALLING);
    attachInterruptVector(IRQ_GPIO6789, &isr);
}
assuming isr is a function that you have with the right setup, like: void isr();

And of course that you then in your ISR do all of the appropriate stuff to handle the interrupt, like update the appropriate registers, such that you don't end up in an endless ISR loop.
i.e. it returns, sees that your condition is still set and calls it again...
 
Status
Not open for further replies.
Back
Top