KurtE
Senior Member+
Hi again,
I guess the hard part for some of us to understand is exactly what your goal is. Yes I understand wanting to learn how it works...
I also know there are ones up here who dislike Arduino and want to write everything from scratch...
Again hard to really know how to help here. Example what board are you using again?
As for where your interrupt function pointer needs to be held in the _VectorsFlash array depends on processor!
Example Teensy 3.2 this is in 105
Teensy 3.0 -> 58
On LC (c and d or on 47)
Teensy 3.6 in 77
Teensy 3.5 also on 77
So you need to make sure you are matching which hardware you are using...
Much easier to:
a) Use the system ISR handler name for the port: void portc_isr(void)
All this does is use the linker to put the address in the correct location in the Interrupt vector
b) Use attachInterruptVector(...
Yes I understand you want to do everything yourself... But it is also hard to know where you are drawing the line. That is you are using the names of registers and the like. You could instead create your own names for them and have their addresses as #defines... You are using the NVIC enable and set priority functions...
So again my advice is start off simple. Simply put your code into the portc_isr function, and try your work to enable it and the like and see if it gets called.
When I am in doubt in cases like this and I don't have a logic analyzer sitting on my desk (I have a few), I would then do something simple, like have my
setup code call pinMode(13, OUTPUT);
And then I would have my first ISR do something like: digitalWriteFast(13, HIGH); At the start of it and see if the LED ever goes on...
I guess the hard part for some of us to understand is exactly what your goal is. Yes I understand wanting to learn how it works...
I also know there are ones up here who dislike Arduino and want to write everything from scratch...
Again hard to really know how to help here. Example what board are you using again?
As for where your interrupt function pointer needs to be held in the _VectorsFlash array depends on processor!
Example Teensy 3.2 this is in 105
Teensy 3.0 -> 58
On LC (c and d or on 47)
Teensy 3.6 in 77
Teensy 3.5 also on 77
So you need to make sure you are matching which hardware you are using...
Much easier to:
a) Use the system ISR handler name for the port: void portc_isr(void)
All this does is use the linker to put the address in the correct location in the Interrupt vector
b) Use attachInterruptVector(...
Yes I understand you want to do everything yourself... But it is also hard to know where you are drawing the line. That is you are using the names of registers and the like. You could instead create your own names for them and have their addresses as #defines... You are using the NVIC enable and set priority functions...
So again my advice is start off simple. Simply put your code into the portc_isr function, and try your work to enable it and the like and see if it gets called.
When I am in doubt in cases like this and I don't have a logic analyzer sitting on my desk (I have a few), I would then do something simple, like have my
setup code call pinMode(13, OUTPUT);
And then I would have my first ISR do something like: digitalWriteFast(13, HIGH); At the start of it and see if the LED ever goes on...